Advertisement

Nice, but...

Started by December 26, 2003 07:48 AM
2 comments, last by Living Monstrosity 21 years, 2 months ago
I just finished my lightmapping code and it works fine on all surfaces and with as many lights as i want. The only problem is that a line appears at surface edges: At a low light map resolution it looks like this, as if one of them is moved one lightmap pixel away, in each dimension: Is this some standard mistake people make or should i post code? Some extra information: The line of dots yellow, blue and lightblue are parellel to the x axis. The dots blue, green and red are parellel to the y axis. blue is at 1/3 , green at a half and red at 2/3. [edited by - Living Monstrosity on December 26, 2003 9:16:12 AM]
- growl -
Are you drawing these quads using GL_TRIANGLE* or GL_QUADS? Try using GL_QUADS.

--------------------------------------------------------

There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.

There is another theory which states that this has already happened...
--------------------------------------------------------There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.There is another theory which states that this has already happened...
Advertisement
I am using triangles as i will need only triangles later, and indeed, the line disappears if i draw it as a quad.
There are two possible reasons for the line appearing:
1. a wrong texel position calculation
2. 1.0f,1.0f is near but not exactly the upper right (or another) corner

Does anyone know if there is indeed a slight diffirence between (1.0f,1.0f) and the far corner of the texture?
Else i will post my code.

[edited by - Living Monstrosity on December 26, 2003 10:53:12 AM]
- growl -
I did it:
I looked at the code a few times and discovered this:
When i calculated the texel position, i calculated the position at the lower left corner of the texel. So if the lightmap is differently rotated at another triangle, the lightmap coordinate would differ 0.0f to up to 0.5f in both dimensions.
To make sure it is in the middle i added 0.5f to the x and y lightmap coordinates before calculating the position.
Actually pretty logic.


[edited by - Living Monstrosity on December 26, 2003 11:02:21 AM]
- growl -

This topic is closed to new replies.

Advertisement