Archived

This topic is now archived and is closed to further replies.

raydog

Lightmaps and bilinear filtering problem

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites