Normals and vertexes again

Started by
4 comments, last by meekman 17 years, 7 months ago
Hello people! I couldnt find information about normal's creation for landscapes. So once the map is created i have to light it. But! I need normal for every vertex, but vertex have one possible normal only. So the only way is to increase the count of the same vertexes to make for each of them own normal??? Or there is some other way to light the map? Please, give me some help!
location: Russia
Advertisement
Assuming your landscape is a heightmap/heightfield ...

Article on calculating normals for a heightfield

Regards,
ViLiO
Richard 'ViLiO' Thomasv.net | Twitter | YouTube
thnx for info.

In that article author says that i should average normals in every vertex, but there is one more problem - texturing.

I have to lay the texture on the every quad, so i have to define tu\tv coords for every quad, for every vertex. But every vertex have the only one tu,tv coords. SO what do i do to solve this?

location: Russia
Go higher than 1.0 for your coordinates.

For example....

Vertex at 0,0 = tex coord 0,0, vertex at 1,0 = tex coord 1,0
vertex at 1,0 = tex coord 1,0, vertex at 1,1 = tex coord 1,1
vertex at 2,0 = tex coord 2,0, vertex at 2,1 = tex coord 2,1

I had this same problem. That or you could use an alternative method of texturing, like laying a big texture over your terrain, or your heightmap so you know where to texture what if you're texturing based on height. Of course for the second two you'll need shaders.
lets say this is a very small portion of your terrain/landscape from a top down view:

v1v2v3
|\ |\ |
| \| \|
v4v5v6

this is possible as long as your texture will be mirrored along v2 and v5 (v1 and v3 will have same texcoords)....if you want the EXACT same texture applied to both quads then you are FORCED to do this:

v1v2v3v4
|\ | |\ |
| \| | \|
v5v6v7v8

get what i'm saying? v2 can have one texture coordinate, if you want the texture to repeat EXACLTY as it is on the first quad then you need to make new vertices (v1 and v3 will have same tex coords)
Yea, i got this. I have to increase the count of vertexes to be loaded. My algorithms mustbe remade, thats bad :(
Shit, i wish i have a few good free books where they say not only about how to create vertex buffer, but about real practice of game programming!

Thnx for all help


location: Russia

This topic is closed to new replies.

Advertisement