Sign in to follow this  
Sujal

Clip map textures

Recommended Posts

Sujal    129
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

Share this post


Link to post
Share on other sites
zedzeek    528
(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

Share this post


Link to post
Share on other sites
Sujal    129
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

Share this post


Link to post
Share on other sites
zedzeek    528
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

Share this post


Link to post
Share on other sites
Sujal    129
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this