How to increase the lightmap resolution further


(Wakey) #1

Hi,

i’m currently working on a little map Q3A, but i have the probelm that the lightmap has a too low resolution, even with _lightmapscale .1
I would love to have some shadows lik in the map Estatica from Cardigan.

here are screenshots of the lightmap:

The Floor, the wall, and the ceiling are each a func_group with_lightmapscale .1, compiled is the whole thing with Q3map2 2.5.16 and the settings -light -fast -patchshadows -super 2.
The ceiling would be already acceptable, but the Floor and the wall are too blurry and pixelated.
Decreasing the lightmapscale dont change anything.

So how can I make the Lightmap sharper / increase the resolution?

Thx
Wakey


(Shaderman) #2

You could play with -lightmapsize.


(carnage) #3

i think you floor and walls are too blury not because of your lightmap size but because of there distance from the surface your projecting onto them using light.

at the celling there is very little distance between the celling and the light so when the texture is projected onto the lightmap it isn’t stretched that much and looks fine. but at the floor the distance is much greater and the texture has to stretch across the lightmaps more and i think thats whats causing the pixilated effect

one thing you might try is increasing the size of the image used on the light so when this is applied to the lightmaps its big enough to avoid having massive stretches

though your shader you may even be able to specify the images used to project the light differently to the one displayed so you don’t have to load a massive image into the game when playing


(Loffy) #4

Would it be possible to import the tga into photoshop and sharpen the shadow-edges there? I am just thinking out loud here - no idea if it will work.

For the compile, I would use:
-external -lightmapsize 512 (or 1024)

And _lightmapscale 1.25 (or 0.0625) on the func-grouped room (or the entire worldspawn).


(obsidian) #5

Resolution looks fine. Looks like you need some filtering to smooth out aliased edges.


(EB) #6

http://www.spyjuice.com/images/mapcraft/lightmap1.jpg


(obsidian) #7

Now that I have time for a proper post…

First of all, don’t use -super. It has been deprecated in favour of -samples. Give -samples 3 a try.

I would try to stay away from obscenely high lightmap resolutions if possible, due to the high amount of texture memory and performance loss. In a situation like this, you will probably gain from lightmap filtering rather than brute force lightmap scaling.

Lightmap scaling comes in handy when you have fine-line details that aren’t showing up in the lightmap - that’s not the case here, since I can clearly see the thinner texture alpha lines in the lightmap. The problem you have is the stair-step pattern appearing on diagonal shadow edges, caused by aliasing. That’s why I suggested anti-alias the lightmap using _filter.

On your pointlight entity, add _filter 1 to toggle lightmap filtering and optionally, _filterradius with a distance value in game units. _filterradius determines the radius within which lightmaps will get filtered.

As an example of how filtering can improve lightmap quality, see this thread:
http://www.quake3world.com/ubb/Archives/Archive-000004/HTML/20040311-6-027331.html?

Filtering was done on a shader level since this was a skylight experiment. Compiled with only -light -fast. Lightmap resolution was scaled up, but regardless, you can still see the stair-stepping pattern in the first screenshot. In the subsequent screenshots, you can see the difference that filtering makes.


(Wakey) #8

With a trick from another level-editing forum i brute force scaled the lightmap further, and i used -samples 3 and _filter 1 and this is the result:

Now this is a real beautiful lightmap :smiley:
Thanks guys :wink:

But i have another little question,
often i get this artefacts (white lines) in my lightmap:


has anybody an idea how to remove them?


(obsidian) #9

Those look like lightmap page seams. Lightmaps are stored on image files, 128x128 pixels by default. When you have high resolution lightmaps, or very large surface areas, a single lightmap page may not be large enough to cover the entire surface. What you are looking at are the edges between lightmap pages - another reason why I caution against very high resolution lightmaps.

You can either try lowering the resolution a bit (filtering should still help prevent aliasing) and/or increasing the lightmap page size using -lightmapsize (ET only).


(Wakey) #10

I had this problem already before i increased the lightmap resolution,
so i exported the lightmaps and viewed them.
Seems that those artifacts are not only at the page seams, but also in the middle of thee pages.
Dunno whats the problem :?


(Wakey) #11

The final version of the map is now available, if anybodys interested.
Thanks to your help and Ydnar’s Q3map2 the lightmaps now look incredible beautiful :wink:

theres also a daylight version:

Downloads are available here and here

Note: this are quake 3 maps!


(Loffy) #12

Hi
Looks really nice. What settings did you use when you compiled?
//Loffy


(carnage) #13

very nice. since your running lightmaps at such a high resolution did you consider using bumpmaps to ad another layer of realism

the daytime version is ok but the very bland lighting because its an overcast scene doesn’t seem to be as interesting as the night


(ACROBAT) #14

On your pointlight entity, add _filter 1 to toggle lightmap filtering and optionally, _filterradius with a distance value in game units. _filterradius determines the radius within which lightmaps will get filtered.

Is this filter you’re talking about here the same type of filtering that goes on in the compile if you add in -filter?

Resolution looks fine. Looks like you need some filtering to smooth out aliased edges

I looked at these two sites to understand


When you say aliased edges, that is the same as saying edges with artifact right from sort of sample? That stairstep effect is some sort of artifact? So the game samples something to make those shadows. What is it sampling?