[osg-users] EXTERNAL: Re: World space normal.
Robert Osfield
robert.osfield at gmail.com
Thu Jul 12 01:31:06 PDT 2018
Hi Marlin,
On Wed, 11 Jul 2018 at 19:59, Rowley, Marlin R <marlin.r.rowley at lmco.com>
wrote:
> 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?
>
> No, I'm suggesting that you shouldn't be computing anything on the GPU in
world coordinates, not positions, not normals, not anything. Any time you
convert coordinates from local object coordinates into world coordinates
you introduce issues with precision. On the CPU you can workaround this by
using doubles, but on the GPU this is typically an option, so you are using
floats that just can't handle the precision issues.
So if you say you "absolutely need word space coordinates" but I'd say,
take a step back, come up with a algorithm that use eye coordinates or
local coordinate for doing calculations as this is (absolutely:-) required
to avoid precision issues.
This may require being a bit creative, but in the end you whole system will
work far better, it'll scale better, it'll avoid precision issues.
Robert.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180712/2d53d041/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 3114 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180712/2d53d041/attachment.jpg>
More information about the osg-users
mailing list