Jump to content
  • Advertisement
Sign in to follow this  
Deliverance

Lightmapping problem

This topic is 4416 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!! Can you please help me with this lightmapping problem: I seem to have seams at the edges of polygons and can't understand why, take a look here please http://www.godsofasgard.as.ro/engleza/images/uniform%20density1.JPG http://www.godsofasgard.as.ro/engleza/images/bad1.JPG http://www.godsofasgard.as.ro/engleza/images/wireframe.bmp.JPG So what could possibile be wrong? Here's how I create the lightmaps glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, 3, LIGHTMAP_SIZEW, LIGHTMAP_SIZEH, 0, GL_RGB, GL_UNSIGNED_BYTE, pPolygon->lightmap); Please, where could the problem be?

Share this post


Link to post
Share on other sites
Advertisement
In the second shot "bad1.jpg", are each of the tiles of your flat grid getting their own texture? If that is the case then this is fairly common with lightmapping and is called "bleeding". This happens when you are filtering your lightmaps and is very well explained in this flipcode article ...towards the end the author goes into detail as to what causes it and what can be done to remedy it.

If however each tile isn't getting it's own texture then i'm not sure what is going on [smile]

Hope this helps,
ViLiO

Share this post


Link to post
Share on other sites
In fact each triangle there get's a different texture for lightmapping, but how are the pixels from the edges are affected by filtering with illegal pixels? I mean there's no way out of the texture is it? and the seams do not appear on the diagonal edges there... They only appear on the sides of the texture, so how and by what illegal pixels(out of the map, that do not show on the screen) are affected the good pixels around the edges? Please clarify this for me, I'm a little :) confused

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You are using bilinear filtering so each pixel is a blend of four texels. When you sample in the middle of your lightmap texture you are averaging four *different* texels. Not so at the edges, due to the clamping. In the corners, where both u and u are clamped, the four sampled texels will be the same.

Share this post


Link to post
Share on other sites
one solution for this problem is to scale down the UVs a little bit (about a half texel) to the center of your polygon.

Share this post


Link to post
Share on other sites
1. Each vertex should have UV coords of the middle of the texel (half-texel accuracy.
2. Another easy solution is to put one row of texel around each side of the triangle - this way, it`ll definitely sample the texels that are neighbouring the edges.

Try either way and post results here.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!