Shadow and Light maps

Started by
7 comments, last by FlyFire 23 years, 9 months ago
Hi !!

Well, you only need one lightmap to produce shadows and lights !!! The lightmap is just added to the texels in the texture-map which is "pasted" on the face. If the point in the lightmap has R:255,G:255,B:255 the simply the full texel-color is painted, if the lightmap is R:0,G:0,B:0 the texel's brightness is 0 and therefor the texel is drawn in full black which is a shadow !!!
In Direct3D this is TEXTURE MODULATE RenderMethod.

For Dynamic Lightmaps, use 2 Lightmaps. The second lightmap (Dynamic) is copied into the first (Static) and this "final" Lightmap is then used as the Lightmap rendered by the renderer !!

Phillip

Phillip Schuster
Advertisement
Yes, but this way i can't get fully lighted texture (white). So i need to add lightmap to texture map with saturation.
I'f i'll add lightmap with r:0,g:0,b:0, i'll get texture as is. If i'll add r:255,g:255,b:255 i'll get fully lighted texture (white).
So i need shadow maps to produce shadows.

I've read an article about Quake 3 rendering pipline, and it uses 4 stage rendering: first, applying texture, then shadow and light maps, and then bump map.

------------------
FlyFire/CodeX
http://codexorg.webjump.com

Hi !!

Well, that all sounds a bit "curious". Do you want fully lighted aspects in your scene, so do you mean specular lightmaps (Metal surfaces, that have a pure white point reflecting the light and then fading out into the normal texture) the mothod I described is not working.
But if you only want simple Lightmaps my method works.
If you have DirectX 6.1 SDK try the following:
Start->Programs->Microsoft Direct X SDK->D3DIM Samples->MFC Texture !!
This program shows a small room with a moving lightmap. Now, check out the lightmap.bmp which is in the programs path. This is a bitmap showing lights (white) and shadows (black). This is then modulated with the normal texture. Play around with this program and you will see that it works !!

I cannot imagine why Quake3 uses a shadow map and a lightmap ????? Carmack must have a very good reason to do so, because Quake2 just used ONE lightmap ?????

Phillip

Phillip Schuster
I'm making my own rendering engine for DOS, so i don't deal with windowse.

Do you know where i can found a doc about calculation part of surface materials (specular, metal etc...)?

------------------
FlyFire/CodeX
http://codexorg.webjump.com

As i know, each polygon must have shadow map (which is multiplyed with current texture to produce shadows) and light map (which is added to texture)
How i must deal with both these maps on lighting and shadows computing stage?
Must polygon have both this maps or it needs only one (since when i have shadows, i don't have lights there, and if i want to apply (dynamic) light, i must first update shadowmap and if it will overflow go to lightmap?)

------------------
FlyFire/CodeX
http://codexorg.webjump.com

Hi !!

Well, for DOS ????????????????? Ok, I was just shocked a bit. Not bad, not bad

Ok, well, but it's the same. You have one Lightmap. Now you just need to find the texel in the texture map and the pixel in the lightmap. Then combine the pixel in the lightmap with the pixel in the texture map (if pixel in lightmap is black, the resulting pixel is black, if the pixel in the lightmap is white, then the pixel is drawn in full texture-map texel color) and draw the resulting pixel on the screen. So, you just need one map.

Phillip

Phillip Schuster
I don''t know where you got your information from, but every Quake game (1-3A) only uses Lightmaps, since lightmaps act as both the lights and the shadows.

You have to merge the lightmap to the texture using multiply (you can preview this in Photoshop). Below are the images of some photoshop picts I made, one normal, 2 with multiplied light maps (mono and colored), and 2 with saturated lightmaps (mono and colored).



The orange blobs in the "saturated" colored texture was 3 different colors. Red, blue, and green. As you can see in the mono saturated image, gray, black, and white had no effect on the texture (not sure if OpenGL saturate works the same). The multiply textures, on the other hand, look great and how it should look.

Medium, normal light in a lightmap is neutral gray remember. In the quake series, the brightest light was drawn as black in the lightmap, and the darkest shadows were drawn as white in the lightmap. (maybe Q1 inverts the lightmap, don''t really know). For you, you would just concider black as darkness and white as brightness, and gray as the middle ground.

You don''t need a shadow map, since a lightmap acts as both. Using 2 different maps just to make lights and shadows is a waste of space and processing power in my opinion.
Some see the glass as half full, some see it as half empty. To me, the glass it too damn big.
IIRC quake3 uses 10 rendering passses though this is all dependant on the speed of your machine

this is an old quote but i know they settled finally on 10 passes

"The rendering will require somewhere on the order of 8+ passes, with massively subject to change of course, but the order goes something like this: 4 or so passes to construct and apply a bumpmap, 2 passes to apply the lightmap together with a texture based specular highlight (for nice shiny effects on metal), another pass for per-vertex fog, another pass for halo effects, and yet another final pass to allow for effects like the screen turning red when get hurt and so forth. "

Maybe you can add the two lightmaps {shade and specular} together first, multiply the resulting lightmap with the texture map, then bit-shift the result up one bit. This might provide oversaturation {"whiteness"} at a minimal computing expense and minimal graphical artifacting.

This topic is closed to new replies.

Advertisement