Clip map textures

Started by
3 comments, last by Sujal 18 years ago
I need currently working on clipmapping textures. I got to a part where I can correctly update textures when user moves around. But I am having problem on how to map this texture on the terrain quickly. What I am doing now is, for each detail level I have allocated different textures (using glGenTextures). They all are loaded correctly and when user moves around they are correctly updated too(using torodial stuff). To map the texture in the terrain, I calculate area each textures covers, then enable the texture and texture map it. But the problem is I have to divide terrain depending upon the texture detail level. They have to match up exactly. here is what my algorithm look like at beginning . glGenTextures(maxTextures,levels) ... at render function . for i = 0 to max Detail Level { update Texture at Level i find the vertices that belong to texture level i bind texture at level i draw vertices that belong to texture level i } Is there other way of doing it.Do I have to use multi-textureing?? Are there any special extensions used?? Thanks Sujal
Advertisement
(if i understand right)
are the vertices for all the levels the same?
if so then you diffinitly should use multitexturing, the easiest method would be with shaders
eg color = detailA_color * detailA_amount + detailB_color * detailB_amount etc
Thank you very much for replying my question.

Sometime vertices cover more than one texture area. Lets say an area covered by group of vertices is

vvvvvvvvvvvvvvvvvv

Texture 1 only covers middle of the area
ttttt
Texture 2 coveres entire area
TTTTTTTTTTTTTTTTTTT

so correctly mapped texture should look like

TTTTTTtttttTTTTTTTT


How would you write multi-tex shader that will use only texture 1 for the middle and texture 2 for the rest? Sorry for my limited shader knowledge, I don't know how to limit texture 1 only to the middle.

Thanks again
Sujal
if your meshes dont share vertices
its not possible to do without z-fighting (unless u draw them in the right order with glPolygonOffset)

ie draw the larger mesh -> TTTTTTTTTTTTTTT
set polygon offset (experiment for the best values )
draw smaller mesh -> tttttt
Thanks again for replying. I don't let meshes overlap so there is no z-fighting.
Is there a way to use a mesh with multiple textures, and limit one texture in certain parts.

I think once I get solution to this I will entire clipmap texture and vertices working.

Thanks
Sujal

This topic is closed to new replies.

Advertisement