Originally posted by jwatte:
[b]> you all saw the soft shadows in the old
> Macworld demo even
Nope. All I saw was projected light textures (a la “spot lights”). I could see no diffuse shadows, and nothing that has been made public about the engine indicates that there are soft shadows, so I think anyone claiming the game does soft shadows is on very shaky ground.
[/b]
It’s dictionary problem again . People say “you all saw the soft shadows”, but they saw “projected light textures”. It’s [projected] texture which is used in per-pixel lighting calculation. Of course, it’s not a “soft shadow”.
[b]
> [Draw scene using ambient light(s)] -
> optional if there is no ambient light(s)
> in scene
This is not optional. You need to draw this so that you get the Z buffer right, for the stencil test to actually have anything to work with. As you need to clear the color buffer, too, you might as well clear to ambient instead of clearing to black.
[/b]
Yes, I’m wrong (about word “optional”), and you’re right. It’s “must be” rendering pass.
The problem with doing diffuse color & specular per light is that if you need to multi-pass, your previous data will most probably get in the way, because the successive passes don’t know how much is contribution from the current light, and how much is contribution from previous passes. Thus, I’d think you’d want to paint bump mapped light first, assuming a diffuse white on everything, and only modulate color at the end. The problem THEN becomes one of how to apply specular without re-doing the stencil volumes.
Sorry, English is hard to me (i’m Russian), but I think something is wrong with your conclusions.
Hm… “…if you need to multi-pass, your previous data will most probably get in the way…”? No way.
Each pass ADDS values to framebuffer. No any ‘MODULATE’. Never. (By saying ‘modulation’ you mean fragment – colorbufer operation?). I don’t need to know what is stored in color buffer, bacause I use ADD operation only.
Below is a colorbuffer pixel’s changings history (I assume ambient is 0, for clarity):
- cbuffer = Zero (black)
- cbuffer += Light0Based.DiffuseLightValue * TexturePixelFromObject0
- cbuffer += Light0Based.SpecularLightValue
- cbuffer += Light0Based.DiffuseLightValue * TexturePixelFromObject1
- cbuffer += Light0Based.SpecularLightValue
- cbuffer += Light0Based.DiffuseLightValue * TexturePixelFromObject2
…
- cbuffer += Light5Based.DiffuseLightValue * TexturePixelFromObject0
- cbuffer += Light5Based.SpecularLightValue
- cbuffer += Light5Based.DiffuseLightValue * TexturePixelFromObject1
- cbuffer += Light5Based.SpecularLightValue
…
Note1: LightXBased.DiffuseLightValue is per-pixel diffuse value computed by using projected light texture, bump map, surface’s normal.
Note2: LightXBased.SpecularLightValue is per-pixel specular value computed by using projected light texture, bump map, surface’s normal.
Note3: If you have troubles with SINGLE pass computing LightXBased.DiffuseLightValue (or specular), then you can split it to two or more passes: no problem, because we use ‘+=’ operation only.
Note4: You can use ANY order of computings of diffuse, specular, objects while you use SAME light. No lost of stencil buffer, so, do drawings in any order. For example:
for(objects) {
draw diffuse
draw specular
}
or
for(objects) {
draw diffusePartOfComplexComputings
draw specular
draw diffuseOtherPartOfComplexComputings
}
or
for(objects) {
draw diffuse
}
for(objects) {
draw specular
}
or
for(objects) {
draw specular
}
for(objects) {
draw diffuse
}
As you wish.
Perhaps with destination alpha?
No.
Don’t invent complicated methods. Use simplest methods. Cramack always does so.
edit: added Note3, Note4
[This message has been edited by peterpan (edited 05-27-2002).]