[osg-users] EXTERNAL: Re: World space normal.

Rowley, Marlin R marlin.r.rowley at lmco.com
Wed Jul 11 09:29:48 PDT 2018


Robert,

Are you suggesting that I compute the world space normal in the application and pass it to the shader?  I absolutely need world space coordinates. If so, how would I get the normal of the triangle before evaluating the shader?

----------------------------------------
Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg at 01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.rowley at lmco.com<mailto:marlin.r.rowley at lmco.com>

From: osg-users <osg-users-bounces at lists.openscenegraph.org> On Behalf Of Robert Osfield
Sent: Wednesday, July 11, 2018 11:26 AM
To: OpenSceneGraph Users <osg-users at lists.openscenegraph.org>
Subject: EXTERNAL: Re: [osg-users] World space normal.

Hi Marlin,

It can be done, but I strongly recommend that you don't go transforming vertex or normal data into world coordinates in the shader.  I know there are some published algorithms that do this but it's a really bad practice and you shouldn't follow it as precision issues on only proper dataset will cause mayhem - the do the cals in world coordinates only for datasets with a local origin, it's just a mess for any real-word datasets.

Cheers,
Robert.




On Wed, 11 Jul 2018 at 14:17, Rowley, Marlin R <marlin.r.rowley at lmco.com<mailto:marlin.r.rowley at lmco.com>> wrote:
I have a world space vertex computed as follows:

WorldVertex = osg_ViewMatrixInverse * gl_ModelViewMatrix * aVertex;

I would like to get the world space normal from this vertex.  Is there an equivalent osg_* matrix that does the same thing?

I tried this:

NormalWorld = gl_NormalMatrix * gl_Normal;

But I know that is only putting the normal in view space.

----------------------------------------
Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg at 01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.rowley at lmco.com<mailto:marlin.r.rowley at lmco.com>

_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org<mailto: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/20180711/abb7c9fe/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 3114 bytes
Desc: image001.jpg
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180711/abb7c9fe/attachment.jpg>


More information about the osg-users mailing list