Jump to content
  • Advertisement
Sign in to follow this  
gq3

OpenGL Opengl texture bug

This topic is 3303 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

Hey After implementing chunked lod algorithm, a problem appeared. As you might know the chunked lod algorithm involves rendering skirts to hide cracks between patches. Now when I apply texture to a certain chunk, the skirts of the same chunk will also have to be textured, in this case by stretching the texture, using the same texture coordinates. Everything works nicely, but there are some weird artifacts showing, only on the skirts. The artifact looks like a shadow, or a darkening of the texture, also it changes it's position as the camera moves (glulookat command) Here's a screenshot Free Image Hosting at www.ImageShack.us Thanks in adavance

Share this post


Link to post
Share on other sites
Advertisement
Hello gq3-

I suspect there is a basic texture-mapping problem here, such as invalid texture u,v coordinates. Have you dumped out what u,v values you are using?

However, I recommend avoiding cracks between patches altogether! I'm guessing these happen when you have one patch at one resolution adjacent to another patch at a different resolution. One solution here is for the vertices on the line between patches to use an interpolated height value rather than the actual height value. That way you won't have cracks at all.

BTW, I recommend libmini: libmini home page. That's a pretty powerful engine that I found to be reusable. I think it uses some interesting algorithms to avoid cracks and "snapping" due to LOD changes.

Of course, building your own CLOD algorithm is a lot more educational! It's a cool graphics area.

-Thomas

Share this post


Link to post
Share on other sites
Hello and thanks for your response

I don't think that the problem is caused by false texture coordinates, otherwise it would show some weird texture stretching or scrambling artifacts (which is not the case).

After analyzing the artifact, I found out more about it's nature, for example:

1)After enabling either of these lines:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 8);
almost all skirts seemed to be shadowed.

2)Actually only the skirts using 0 or 1 texture coordinates seem to be darkened, everything else (for example 0.5) seems to be fine.


Heres a pic to illustrate the problem




1,2,3 and 4 are different texture tiles (I have hidden some of the chunks to give a better picture)
A is the problematic skirt ( with u,v coords either 0 or 1)
B is the normal skirt ( with u.v coords 0.5 in this case)







Share this post


Link to post
Share on other sites
Hello gq3-

Sorry, I misunderstood your question. Your textures are rendering correctly, but you are seeing incorrect shadowing.

I'm afraid I don't have experience with that! My last suggestion would be to investigate the normals. Are the normals for the skirt polygons correct? My guess is that there is some issue with how the lighting is interacting with those faces.

-Thomas

Share this post


Link to post
Share on other sites
Ah yes, I forgot to mention, there isn't a single line of lighting/shadowing code in the project nor in the shaders. No normals are included whe drawing the scene. I'm open to all suggestions


EDIT:

After setting these parameters the problem disappeared:

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

[Edited by - gq3 on September 30, 2009 6:42:42 AM]

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!