Shader-defined lightmap resolution?


(G0-Gerbil) #1

Is it possible?
I’d love to be able to have lightmap resolution on a per-shader basis rather than making groups etc which means (in my case) having more geometry (when geometry will be at a premium).


(ydnar) #2

q3map_lightmapSampleSize N


(G0-Gerbil) #3

How cool is that? Cheers :smiley:


(WolfWings) #4

And if you actually meant lightmap size (I.E. getting a 1024x1024 lightmap somewhere for terrain, for example) that’s available as well.

q3map_lightmapSize


(G0-Gerbil) #5

Nah, this is for Minas Tirith - certain things I’ll want to use ultra-low res lightmaps for to keep it’s lightmap count down as much as possible.
Of course, the minute I read Ydnar’s comment I slapped myself, because it was in the terrain shaders that I’d seen that thing, just hadn’t remembered it at the time.

Are there any benefits from using larger lightmap graphics?
EG if I specify absolutely everything to use a 512x512 lightmap, will it make my map run a bit quicker because it’s paging between less shader / lightmap combos than using 256x256 lightmaps?

On another (but related) note, if you specify a shader to use a specific size, can any shader plonk it’s generated lightmaps into it, or is it just reserved for the shader that specified it? IE instead of ending up with fewer more used bigger lightmap images, I’d actually end up with more, with each image only accounting for a single shader?
I don’t recall terrain lightmaps having bits of other brush lightmaps on 'em?


(WolfWings) #6

Unknown if ‘larger’ lightmaps can have leftover space used by other lightmap bits from ‘smaller’ lightmaps. Never looked close enough to notice. ydnar?

The q3map_lightmapSize statement is generally useful for making sure a single terrain gets a single lightmap, to prevent seams between brushwork, without needing to have absolutely huge _lightmapscales which end up being little better than simple vertex lighting a lot of the time. That’s the advantage. No FPS gain, no, just helps provide a technique to prevent splitting the lightmap up for large areas, which helps prevent possible seams on what should be ‘seamless’ areas.

And if you’re really planning to use ultra-low res lightmaps, test to make sure it’s not better to just use actual vertex lighting on those areas, if you’re planning to have the equivilant of q3map_lightmapSampleSize 256 or so. Remember, the ‘default’ is 16, unless you’re setting a worldspawn _lightmapscale or using a q3map2 command-line option (-samplesize IIRC in the BSP phase) to change the base lightmap resolution. :slight_smile:


(ydnar) #7

The terrain would need q3map_lightmapMergable as well, which merges all lightmaps from a single entity.

A good way to use this would be to func_group terrain into sections with this shader to use large lightmaps.

Using -lightmapsize 512 -external on the commandline is a good way to set all lightmaps to be 512.

y