View Full Version : Terrains :)
07-15-2002, 09:09 AM
Guys, I made some programs to demonstrate how to work with HeightMaps (HeightField)...
I thought it would be helpful to some people.
It progressively goes from a very simple to a more robust terrain engine... The engine is not a complete fully loaded engine with collission detection and Matrix effects, but it opens up the doors to those who are learning.
p.s Please do not tell me if I could have gotten a better host name... I already know.
[This message has been edited by mancha (edited 07-15-2002).]
07-16-2002, 02:15 PM
A quick improvement. This is how you appear to calculate each vertex normal:
1. Sum the normals of all triangles sharing the vertex.
2. Divide the sum by the number of shared triangles to get the average normal.
Since, you are normalizing in step 3, step 2 does nothing useful.
07-16-2002, 04:37 PM
Thank you for your comments Jambolo... http://www.opengl.org/discussion_boards/ubb/smile.gif
Let me explain something...
First I take the cross product for our triangles, as you know http://www.opengl.org/discussion_boards/ubb/smile.gif
After that, we have two loops.
The first one (is this the one you are talking about?) computes the normals for the shared vertices of the vertical blocks and the second for the horizontal blocks... That way we have a nice even vertex normalization.
The reason why I dont divide by the number of shared vertices is because it makes no visible difference. I tried it and it did not to me at least. This is because there is only one triangle in one block that shares a normal vertex with a triangle in the next block. So you have very similar values that you add and divide by 2 and get pretty much the same value... Is kind of like adding (51+55)/2
Please, if you have improvements send them to me, email me or post them here. I would appreciate it...
How is it by the way? Did you like it?
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.