Jump to content
  • Advertisement
Sign in to follow this  
zulfiqar malik

Detail terrain texturing

This topic is 4860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am using ROAM2 algorithm using diamond, with dual split and merge priority queues. The problem i am having right now is that currently i am applying a single texture to the whole terrain but that doesn't give enough detail in almost all the cases (no matter how small the distances maybe). I want to do some detail texturing on the terrain on the patches that are nearest to the viewer. The problem is that each diamond vertex has a texture coordinate associated with it, and that is according to the base texture that has already been applied on the geometry. How can i specifiy a second texture coordinate for the detail texture? Also, how do i maintain LOD's for the detail textures? I read an article by Charles Bloom regarding texture splatting, can anyone give me more details on that? Any help shall be highly appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Well for changing the texCoords for the detail texture, you could simply use the same texCoords from the base texture and then scale the texture matrix, here's what it looks like in OpenGL.

glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScalef(U_Scale, V_Scale, 1);
glMatrixMode(GL_MODELVIEW);

As for only applying it near the viewer, just compute the distance from each patch to the camera and scale the texCoords like above.

Share this post


Link to post
Share on other sites
If you want to apply a detail texture to a subset of triangles, then you can either:
1. Draw the farther triangles with one texture and then draw the closer triangles with two textures.
2. Draw all the triangles with one texture and then redraw the closer triangles with the detail texture.
3. Do something clever in the pixel shader.

I think #3 would be the best. You only have to draw once and you could adjust the blending between base and detail textures smoothly depending on the distance.


BTW, you can have more than 1 set of texture coords for each vertex, so that should not be a problem.

Share this post


Link to post
Share on other sites
Yeah, i know i can have more than 1 texture coordinates per-vertex, but that would be an awful waste of space considering that only a handful of patches near the viewpoint would be using those texture coordinates at any given time. Using a pixel shader is not an option since we are also giving support for cards that don't have programmable pipeline (Intel Extremely YUCKY Graphics :) ).

The texture matrix option looks good. I think i will give that one a try. Thanks everyone.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!