Archived

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

Lightmap packing - avoiding bilinear filter artifacts

This topic is 6660 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I''ve coded a lightmap generator, which combines smaller lightmaps into a bigger lightmap. Since I used a naive strategy when packing the lightmaps I get bilinear filtering artifacts when rendering from the packed lightmap (the adjacent lightmap blends into the one being rendered on the edges). Now, I''m trying to evaluate the options I''m having: 1. Surround each smaller lightmap with a rectangle of pixels duplicating the edges, hereby wasting texture space. 2. Scale the texture coordinates inward (will 0.5 pixels be enough here?), so that only the actual lightmap will be sampled during bilinear filtering. What do you guys think? Are there other (better) methods or are these the only alternatives? Mucho thanks, MadCoder

Share on other sites
I''m wondering how you generate your texture coordinates ? Anyway, maybe you could try to make 2 adjacent polygons also have 2 adjacent lightmaps in your bigger lightmap ? I don''t know how to do that, though..

Y.

Share on other sites
I just thought of this, so maybe, maybe not:

You have two square polygons next to each other, each the same size. One needs a light map about twice the res of another. So A has a res of 16x16 and B a res 32x32.

How do we align these?

A | B
0,0 1,0 | 0,0 1,0
0,1 1,1 | 0,.5 1,1

In other words, where B aligns to A, it is using only 16 of the 32 texels. Wasteful, yes, but it could enable you to align textures of different res, and save in the end.

It would be up to you to generate the texture properly.

Share on other sites
Mmmh, I think I have to restate the question a bit...

The problem is, I have a lightmap with a bunch of smaller lightmaps (I''ll call them sublightmaps for clarity). Now, when I render a polygon with a sublightmap, I can see part of the adjacent sublightmap ''blend'' into the edge of the polygon. This is caused by the bilinear filtering at the edges, I think. So, if I render a polygon with a dark sublightmap, and a bright sublightmap is right next to it in the packed lightmap, the bright color can be seen at the edge. The texture coordinates are correct. This problem generally occurs when doing this kind of thing naively (like I am). I can only modify texture coordinates (scale them, so that even with the error bilinear filtering introduces the texture unit samples within the sublightmap at all times), or duplicate the edge pixels for each sublightmap (along the edges).

Ysaneya: I don''t think this can be done without wasting way too much texture space. Nonetheless, it would solve the problem. The algorithm for this would be quite tricky I bet...

bishop_pass: First of all, if the square polygons are the same size, their lightmaps will also have the same resolution (at least in my engine). I assume, that what you posted there are texture coordinates, but don''t see how it will solve my problem (maybe I''m just too stupid to understand). I think, you mean a different effect ... the sharing of an edge between polygons which have different resolution lightmaps.

Share on other sites
quote:

I think, you mean a different effect ... the sharing of an edge between polygons which have different resolution lightmaps.

That''s what I meant, yes.

Share on other sites
Creating a redundant border is the appropriate way, you should not be concerned about a few texels more. The rescaling of the lightmap could cause artefacts, because then you´re displacing your sample points.

Check out the paper by Zhukov about lightmaps : www.creatstudio.com/papers.htm

1. 1
Rutin
31
2. 2
3. 3
4. 4
5. 5

• 13
• 14
• 11
• 10
• 14
• Forum Statistics

• Total Topics
632961
• Total Posts
3009496
• Who's Online (See full list)

There are no registered users currently online

×