Page 1 of 1
terrain normals
Posted: Tue Oct 15, 2019 8:05 pm
by Seven
How would I access the normals of the terrain node vertexes inside a shader?
Re: terrain normals
Posted: Wed Oct 16, 2019 2:36 pm
by CuteAlien
TerrainSceneNode seems to always use the IdentityMatrix. Not quite sure how that works (sorry, I still haven't worked myself with it). Maybe it re-calculates the terrain when the node is moved and mesh has absolute coordinates. Or the node can't be moved? I guess it's because the mesh has to change based on camera.
In that case I guess the normal passed to the vertex-shader should already be the correct normal without any need for further transformation. All you probably need to do is pass it on to the pixel-shader and normalize it in there once more.
No guarantees... I didn't try myself.