Lightmaps and bilinear filtering problem

Started by
5 comments, last by raydog 20 years, 2 months ago
I''m creating a lightmap for a model and I''m using raytracing for triangle collision detection: http://www.gamedev.net/community/forums/topic.asp?topic_id=202886 Each triangle has its own lightmap. I am keeping it simple for now. Everything seems to be working ok, except when I turn on bilinear filtering, which messes up the edges. I tried to be sneaky by adding a 1-pixel border around each lightmap, but this causes headaches in raytracing. How does one solve this bilinear filtering problem, either during or after the raytracing process? I tried duplicating the outer lightmap edges, but this doesn''t work.
Advertisement
I found what I''m looking for, well sorta of. This tutorial calls the function:
FillAllIllegalPixelsForThisLightMap

http://www.flipcode.com/articles/article_lightmapping.shtml

But, they give no code for this function.

How do you fill in illegal pixels for a lightmap?
If you''re using OpenGL, might want to look into GL_CLAMP_TO_EDGE which prevents textures from ''bleeding'' across edges.
No, these are lightmaps written to one texture. Like textures within a texture. Can't use edge or border clamping.

Has anyone created their own FillAllIllegalPixelsForThisLightMap function? How did you fill in the missing pixel?

[edited by - raydog on January 26, 2004 1:14:24 AM]
I had -exact- same problem. If I added that 1-pixel border I got that raytracing error with shadows. Unfortunately I didn''t came up with a solution, I bought a Radeon 9700 Pro and instead (Real-Time Per-Pixel lighting). :-)

Maybe you should generate a lightmap for each surface rather than for each triangle.
[size="1"]Perl - Made by Idiots, Java - Made for Idiots, C++ - Envied by Idiots | http://sunray.cplusplus.se
I''ve gone over that tutorial several times, and it offers no clues as to how to fill in these
"invalid pixels" with the "closest color".

These pixels are usually outside the triangle, or straddle alone the triangle edge.

Blurring or taking the average of all surrounding pixels does not work with
bilinear filtering.
Ok, I read the tutorial again, and I think all this function does is fill in a invalid
pixel with a valid pixel. Very simple, but still not perfect.

I initially thought it ''computed'' this pixel somehow using some bilinear filtering/triangle
equation knowledge, but now I think otherwise.

This topic is closed to new replies.

Advertisement