Generated normals of heightmap
I am working on a terrain renderer, because nobody has done that before and I want to be the first
I am happy with what I have so far, except my normal generation code.
I do 2 things. First I generate the normals orthogonal to each triangle. Here is a screen shot of the result http://www.blastersoft.com/OrthoNormals.jpg . As you can see, it''s half smooth. One of the two triangles in each quad is darker than it should be. I can''t figure out why.
The second thing I do is smooth the normals. That is, I replace the normals at each position with the average of all the normals at that position. The result is a lot better, but still I have the same problem, only smoothed. Here is a screen shot http://www.blastersoft.com/Smoothed.jpg
One thing I noticed is that the second triangle is not darker for triangles almost facing the directional light. When I move my directional light, I can see a patch of perfectly lit triangles with no darkers parts.
Can you help me out from the screen shots I provided?
Have you normalized your normals? Maybe it can cause such a problem. I''m not sure though.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement