View Full Version : Terrain rendering with VBOs - normal map problem

02-17-2011, 07:53 AM

I implemented terrain rendering algorithm with VBOs.
I use VBO for vertices coordinates and texture coordinates.Now I want to add lighting, so I need normal map.
Problem is that normal map indexes are different from vertex and texture indexes (the same vertex has 2 different normals).
I know that correct solution should be pixel shading with GLSL, but I'm not familiar yet with shading language and I have to finish my initial version in few days, so I think pixel shading I will add in later versions.

Please do you have any suggestions how to add normal values that I could do it with VBOs ?


02-17-2011, 09:25 AM
I want to add lighting, so I need normal map.

I would advise you to use normal array along with your vertices, it's more simpler, you could use several normal for each vertex shared among polygons, it is more accurate and AFAIK, more common to lit models.

If you still want to use normal maps for this, here is a link talking about it:


And AFAIK again, normal maps are more used to do give a more impression of relief to your models.

02-17-2011, 10:20 AM
^Sorry, I actually meant normal arrays. That's what I want to do, but the problem I don't know how to use it with the same index array buffer since multiple index arrays are not supported.
For normal array each vertex has 2 different normals and the coordinate index array can't be used.

02-17-2011, 02:46 PM
Considering one face, one vertex has only one normal (2 with a mathematical definition), that points out of the surface.

You just have to make your normal array values match exactly the vertex array values, meaning v[0] = n[0] ... v[x] = n[x] and so on, even if it implies normal and/or vertex repetition.