PDA

View Full Version : map $lightmap questions


Fracman
8th October 2003, 23:04
Just a few questions related to the $lightmap keyword:

a) The good old Shader Manual says "use $lightmap always together with rgbGen identity". Why? And also have "rgbGen identity" with the next stage that uses the actual texture map?

b) In most shaders, you'll find the map $lightmap stage first.
But some shaders have the lightmap stage in second or third place, or even as last stage, e.g. E.T. textures/liquids/water_calm2 and textures/liquids/water_dam.

Why?

Example for both questions:


textures/misc/test1
{
qer_editorimage textures/misc/test1
{
map $lightmap
rgbGen identity
}
{
map textures/misc/test1
blendfunc GL_DST_COLOR GL_ZERO
rgbGen identity
}
{
map textures/misc/test1_glow
blendfunc GL_ONE GL_ONE
rgbGen identity
}
}

G0-Gerbil
9th October 2003, 01:15
Depends what you want to do with your lightmap really.

Most shaders are 2 passes - lightmap and texture itself.

However, for something a bit more interesting you might want to vary it.
EG I have a water shader that is two scrolling water textures on top of each other, and I wanted it lightmapped.
If lightmapping had been the first stage, it would only have properly worked on my second stage - the final one with 50% transparency would have halved the effectiveness of the lightmap.
So I did the first layer as solid water texture, the next layer as water at 50% transparency, then the lightmap stage last so it affected the blended layers.