Sign in to follow this  
Deliverance

Lightmapping problem

Recommended Posts

Deliverance    387
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
ViLiO    1326
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
Deliverance    387
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   
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
rapso    180
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
VladR    722
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

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