Hi,
Was going to propose what Glenn already proposed. This should work with
uniform scales on x,y,z coord. And IMHO that formula is more precise when
dealing with normals than vertices. Thats because the precision issues are
somewhat related to huge earth translation offsets in ModelView matrix.
N
Marlin,
This might work:
vec3 normalWorld = mat3(osg_ViewMatrixInverse) * gl_NormalMatrix *
gl_Normal;
But like Robert says, world coordinates on the GPU will lead to precision
loss, so only do it if you are content with a low-precision result.
Glenn Waldron
On Wed, Jul 11, 2018 at 9:34 AM Row
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 data
To:
OpenSceneGraph Users Subject: [osg-users]
World space normal.
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
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_Norm
5 matches
Mail list logo