[osg-users] 回复: 回复: Understanding osg::CulingSet::pixelSize() andcomputePixelSizeVector()

Robert Osfield robert.osfield at gmail.com
Sun Aug 6 02:31:21 PDT 2017


Hi Young,

You can't work out pixel size in screen coordinates of an object in local
coordinates with the window, projection and modelview matrix, the only
thing you can do is cache the appropriate combination of these as
CullingSet does.

Robert.

On 5 August 2017 at 09:03, Young <337533078 at qq.com> wrote:

> Hi Robert,
> I think you are right.
> I am tring to use the PIXEL_SIZE_ON_SCREEN mode of LOD, and the most
> important is how to get a proper piexl threshold which used in the
> setRange(). So I want toknow is there a method to compute the pixel of the
> bounding sphere without the matrix (W, P, M).
>
> My method is     piexlParameter = bound.radius * bound.radius * C,  and C
> is a empirical value.  Is there a better method?
>
> I am looking forward to your reply.
> Young.
>
> ------------------ 原始邮件 ------------------
> *发件人:* "Robert Osfield";<robert.osfield at gmail.com>;
> *发送时间:* 2017年7月31日(星期一) 晚上7:34
> *收件人:* "OpenSceneGraph Users"<osg-users at lists.openscenegraph.org>;
> *主题:* Re: [osg-users] 回复: Understanding osg::CulingSet::pixelSize()
> andcomputePixelSizeVector()
>
> Hi Young,
>
> On 31 July 2017 at 10:19, Young <337533078 at qq.com> wrote:
>
>> Is _pixelSizeVector  meaning the ratio of space distance to screen pixel?
>>
>
> I don't recall off the top of my head, but looking at the code from
> CullingSet:
>
>         /** Compute the pixel of an object at position v, with specified
> radius.*/
>         float pixelSize(const Vec3& v,float radius) const { return
> radius/(v*_pixelSizeVector); }
>
> The _pixelSizeVector is a set of ratio that give the size in local
> coordinates of a pixel in screen space projected to a given distance away
> from the eye point.
>
> I'm not wording this well, it's a very long time since thought about the
> code - it's not a bit of the OSG discussed much, it just quietly works away
> doing it's job.  I've written lots of code over the years and if it works
> fine you really don't need to retain much knowledge about it...
>
> Robert.
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20170806/1bf5d19d/attachment.htm>


More information about the osg-users mailing list