He renders the occulter (the ceiling) as viewed from the light to a texture then projects that as a texture from the light source over the illuminated scene to modulate the scene.
What zed has proposed he do next is combine this with a stencil shadow effect on the character. When this is done he’ll have something approximating the lighting effect in Doom3 for a single light.
The stencil shadow will require that he modulates the shadow texture to black and starts with a black scene since the stencil test will cull fragments entirely from the illumination pass. If he wants ambient & other effects like emissive material he could add it in the depth pass for the stencil test then accumulate the lights, from there multiple light sources is a simple progression.
He renders the occulter (the ceiling) as viewed from the light to a texture then projects that as a texture from the light source over the illuminated scene to modulate the scene.
Omg, after i posted my question i thought about it for a bit and that is exactly what i came up with, i just wasnt sure if that would work, guess so. Thanks for verifying that.
>>How about some semi-transparent occultation? I tried to email the image to you but it bounced. daveperemen posted it 6 posts above, you can see it has a mix of glass and building structure in it. Just draw glass before everything else as light grey to the shadow texture with the zbuffer writes off (if you have them on, there’s no need) instead of black. If you’re really bold you could use a color texture and draw a stained glass window to the texture, it’ll be inkeeping with your chosen theme :-).<<
the third screenshot ‘d3.jpg’ does that, doesnt it? the red is meant to be the clouds of mars
>>What zed has proposed he do next is combine this with a stencil shadow effect on the character<<
im gonna try out one thing beforehand ( ive just been preparing the groundwork for the last 4 hours )
>>One suggestion (and it’s not intended as a criticism). You need to modulate the direct illumination to zero (black) with the shadow texture for the illumination pass and THEN optionally add ambient modulated by a diffuse map. The bump mapped area in shadow looks strange because it has a strong directional component to the ambient term even though it is in shadow.<<
thanks for the idea angus, ill stick it on my TODO list
Oh, awesome! I never noticed the color gradient in the light, it’s too low frequency to make it obvious, but now that you point it out I see it clearly. Color translucent shadow textures!
I have one other minor suggestion. The occulter is a soft edged alpha texture, this kind of cheats when it comes to soft shadows. For evaluation you may want to try some hard edged geometry. Then you can see if you need to jitter the light, antialias the rendering or convolve the texture (or all of the above) when generating the shadow texture for a given texture resolution. It will address an inevitable criticism before it’s made, or did I just do that :-).
[This message has been edited by dorbie (edited 06-03-2002).]
for dorbi. about the raytracing topic we had… its running at 15fps on my p3 500 sometimes… (the demo1.zip, the one with the bumpmaps it is) and its even quite smooth on 800x600. would love to test this on a p4 or athlonXP…
i was gonna say this after ild finished the doom3 demo but i suppose now is a good a time as any,
IMHO direct lighting methods eg stencil, shadowmap, raytracing (standard), projected textures are all dying eg what did carmack say with doom3 something along the lines of ‘doom3 level makers have to be careful with the number of lights they use’
indirect lighting methods are the future (maybe theyre not practical today) not only do they look better but WRT lighting using 1 or 1000 lights is gonna run practically at the same speed
Few days ago jwatte said something about possibility of alpha buffer usage in Doom3.
I tried to figure out how to perform diffuse lighting computations by using no more than FOUR texture operations (on GF3). (Specular computations can be performed in other pass, so I ignore them yet).
Results (good quality rendering only): without alpha buffer - FIVE texture operations. with alpha buffer - FOUR texture operations.
So, if we need to obtain good quality result on GF3, then we need to use alpha buffer.
So, questions are:
Any ideas about FOUR-texture diffuse ligthing (may be I overlooked a good method)?
Can we use alpha buffer (destination alpha)? Is it works on GF/Radeon?
Originally posted by AndersO:
[b]So… Everyone agrees on that its something more than stencil shadowing going on in doom3?
Then what happened with the unified approach?[/b]
Why has the unification process to be at OpenGL level ? What Carmack said simply means everything passes thru the same pipeline, not thru the same OpenGL pipeline.
My guess is he simply abstracted the whole thing (I’ve heard he somewhat recently discovered OO-programming )
on the need for destination alpha, I think I have a reasonable theory. I was thinking about the accumulation of multiple light sources when you need more texture units than you have in a single pass and must modulate the final contribution from a SINGLE light using two passes without affecting the contributions of other lights.
It seems to me that to get the modulation correct you must write some of the lightsource modulating values to destination alpha, (probably shadow texture and attenuation [range attenuation may also be required remember]). This then leaves you the illumination term to apply on the second pass modulated by destination alpha and stencil tested.
So I think that the destination alpha is required on platforms which must multipass because they support fewer that the total texture fetches required by each light in a single pass. Basically destination alpha is used to allow a multiplication of the results from two passes because the color buffer must hold the results of other lighting contributions.
It would also mean that platforms with fewer textures would be stuck with monochrome light modulation effects for certain terms where an ATI could have color modulation. In particular I’m wondering if the blue tint on the translucent shadow texture (through glass) on the hallway floor will be possible on an NVIDIA card. I suspect not unless it can be shifted to the second pass. I don’t see how you could do that without applying the same modulation to both passes, and add them independently to destination color and that would waste texture fetches and very probably take extra passes too. So destination alpha would be the sensible choice. You can do color modulation on the first light drawn I think, but that’s nixed if you do anything special like add emission & ambient in the initial depth buffer write pass.
The need to have hardware support for multiple alpha buffers which support color is clear (secondary color buffer?).
[This message has been edited by dorbie (edited 06-04-2002).]
Originally posted by dorbie:
[b]Dave, that’s a software ray tracer. It won’t alter the fact that the hardware to make the earlier papers interesting doesn’t exist.
You only raised this topic to try to say I don’t understand current hardware & you do.
Let it go.
…impress me with something you’ve written.
[This message has been edited by dorbie (edited 06-04-2002).][/b]
i just wanted to show it to you, thought you like it. doesn’t have to do anything to blame you or something. impressing you… well… i’ll check if i have something that could impress you, but i guess no. its only the normal stuff, implementing stencil shadow volumes like in the nvidia paper, implementing fft-water like in some other paper, implementing perpixellighting with help of some papers with an own equation for one pass on gf2mx (you know the link i’m sure )
i’m working on some skyroads revival and i hope this will work, cause i guess you’ll all like it
It seems to me that to get the modulation correct you must write some of the lightsource modulating values to destination alpha, (probably shadow texture and attenuation [range attenuation may also be required remember]). This then leaves you the illumination term to apply on the second pass modulated by destination alpha and stencil tested.
[/b]
I think, alpha buffer can contain [range] attenuation factor only. It allows us to use FOUR (instead of FIVE) textures to compute diffuse (or specular) color. It’s good for GF3+ cards which have 4 textures only.
So, as Carmack said, we have 2 or 3 (depending on “number of color components” as he said) passess per light on GF3 cards. First pass: alpha, second pass: diffuse, third pass: specular. If an object have no specular, then third pass is not required.
Comments?
Possibly a method exists allowing to render in 2 passes (instead of 3) on GF3, but I can’t figure it out. Any ideas?
Originally posted by dorbie:
[b]The need to have hardware support for multiple alpha buffers which support color is clear (secondary color buffer?).
[This message has been edited by dorbie (edited 06-04-2002).][/b]
well… i thought about this myself yet and thought its quite a cool idea. but as long as we dont have it, a secondary color buffer is simply a WGL_RENDER_TEXTURE_RECTANGLE… first do the whole diffuse term into a texture, then the whole specular one in another and done.
Originally posted by davepermen: well… i thought about this myself yet and thought its quite a cool idea. but as long as we dont have it, a secondary color buffer is simply a WGL_RENDER_TEXTURE_RECTANGLE… first do the whole diffuse term into a texture, then the whole specular one in another and done.
Do you think we MUST render to textures? Why? I don’t understand. (I mean GF3, not GF2).
Originally posted by peterpan: Possibly a method exists allowing to render in 2 passes (instead of 3) on GF3, but I can’t figure it out. Any ideas?
well… if i think about it: say you have a glass wall, wich is fully transparent. the specular is independend of this transparency, it only cares about the glossiness/specularity how ever called so this means:
final = ambient + diffuse*transparency + specular
and as ambient is taken out (at least in doom3 i think it is really all black )
final = blend(transparency,diffuse,destcolor) + specular
thats two simple passes…
diffuse pass needs: normalmap,colormap+transpacency,normalisationcubemap,lightcolormap (cube or projected) => 1 pass possible
specular pass needs:
normalmap,glossmap (can be normalmap-alpha),normalisationcubemaps 2 times (i’m thinking about phong, not blinn) => 1 pass possible
It would work for sure. I’m not sure you need to break it down the way you did, I suppose any which way would do, as long as the arithmetic worked out.
If you were doing that I suspect you wouldn’t need to render to texture for all passes. I might try to render to texture for one pass and possibly project that back into the scene from the eye on another pass. It depends on available texture units. I’m not sure it’s worth trying to beat the full lighting equation out of a 2 texture card. I think on older cards the shading quality will be reduced. They don’t have the memory or functionality required for fast render to texture anyway.
Peterpan,
could you elabourate? Do you understand the issue of combining passes without modulating the existing lights in the destination color buffer? All terms, both specular and diffuse must be modulated by shadows & attenuation, so you can’t get by with modulating just some of the results in one pass and adding another.
rendertotexture buys you color modulation across passes without trampling over your destination color buffer.
[This message has been edited by dorbie (edited 06-04-2002).]
Originally posted by davepermen:
[b]final = blend(transparency,diffuse,destcolor) + specular
thats two simple passes…
diffuse pass needs: normalmap,colormap+transpacency,normalisationcubemap,lightcolormap (cube or projected) => 1 pass possible
specular pass needs:
normalmap,glossmap (can be normalmap-alpha),normalisationcubemaps 2 times (i’m thinking about phong, not blinn) => 1 pass possible
could be done i guess…[/b]
Let’s talk about diffuse component.
You forget attenuation map in your list of textures. So, there is FIVE textures, not FOUR.
You must also worth considering that the render to texture is an additional overhead and texture ultimately used on each fragment. You’d weigh that against modulation of all passes if it was a viable option and you insisted on color. Destination alpha looks attractive, at least as an option.