Jump to content
  • Advertisement
Sign in to follow this  
vicviper

doom 3 lightining

This topic is 5475 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been playing D3, and been wondering how implements dynamic lightning. as far as I know, all lights are dynamic, and does multipass rendering to lit the scene. I think the way to do things is: for every light, render the scene with appropiate light texture & UV transform, effectively lightning the scene, then render a final pass with textures. but, to render the complete scene per light is a huge task, I figure it uses some algos to render only the polygons affected by their respective lights, so, if a light only affects 20 polys, only these polys are rendered. someone knows more about this?

Share this post


Link to post
Share on other sites
Advertisement
id say use the over way around

1. render the static geometry into the z buffer so you only do the lighting operations for the visible pixels

2. your spatial partition with e.g. quadtrees/octrees devides the scene into volumes of e.g. 512*512*512 units, a player is 72 units tall in most ID software engines

now imagine how many lights there might be 8 lights in 512*512*512 is pretty much, and shouldn t require more then 3 passes

so do perpixel lighting for each light and take the attenuation into consideration


you don t have to perform per pixel operations on lights that are to far away

so in the vertex shader you store the distance vertex->light in a tex coordinate which has the nice by side effect that the distance is interpolated across the triangle

in the pixelshader you make use of conditionals (e.g.: if) to skip pixels which are to far away

then do some lighting calculations and store it in the framebuffer

now with multipass lighting you just modulate the resulting color of each pass with the framebuffer

the texture pass is somewhere at the beginning in order to render the stenciled shadowed regions with textures before doing all the illumination

p.s.: doom3 uses stencil shadow volumes for models and maybe even static geometry although i believe they use shadowmaps for static geometry

p.p.s: i didn t finish my own renderer yet *hence still waiting for ge6800 ultra pcie* i have to wait until i get this card since my gf4 ti 4800 doesn t support the required shader profiles

so please correct me with my theory if there are mistakes in it


Share this post


Link to post
Share on other sites
Quote:
although i believe they use shadowmaps for static geometry


I'm almost (99.9%) positive that Doom3 uses shadow volumes for everything, including static polies, probably for visual consistency.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Doom 3 used this method:

1. Start with all black, or mostly black textures.
2. Now apply them to a model, making sure all of the verticies are black.
3. Now lower the gamma ramp to almost zero.
4. Now draw a black quad over the screen at 50% alpha.
5. Finally, anything that's still visible gets filled in black.

Share this post


Link to post
Share on other sites
Quote:
I'm almost (99.9%) positive that Doom3 uses shadow volumes for everything, including static polies, probably for visual consistency.

I'm almost 99.9% sure that you can make it 100% ;)
and if they happen to use shadow maps, it's certainly not for shadowing :)
EDIT: typo

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Doom 3 used this method:

1. Start with all black, or mostly black textures.
2. Now apply them to a model, making sure all of the verticies are black.
3. Now lower the gamma ramp to almost zero.
4. Now draw a black quad over the screen at 50% alpha.
5. Finally, anything that's still visible gets filled in black.

Wrong.

Render a depth-only pass
[For each light]
Render Shadow Volumes to discard shadowed fragments using the stencil buffer
Render a pass (or more if needed) that adds the light contribution (diffuse*texture + specular) to the framebuffer.

Share this post


Link to post
Share on other sites
i haven t played it yet so i can t say if they use shadowmaps

but they definitely use stencil shadow volumes for models

but lighting static geometry out of brush based polygons can t be shaded with stencil shadow volumes since you have no closed mesh

they ways of making everything black and then shade light up the rest with lights is really intelligent but i guess you need BSPs to avoid lighting geometry that shouldn t be lit at all

otherwise you need shadowmaps or you do the worldbrush lighting in a precomputition process but they said its 100% dynamic

any mappers here?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Sunray
Quote:
Original post by Anonymous Poster
Doom 3 used this method:

1. Start with all black, or mostly black textures.
2. Now apply them to a model, making sure all of the verticies are black.
3. Now lower the gamma ramp to almost zero.
4. Now draw a black quad over the screen at 50% alpha.
5. Finally, anything that's still visible gets filled in black.

Wrong.

Render a depth-only pass
[For each light]
Render Shadow Volumes to discard shadowed fragments using the stencil buffer
Render a pass (or more if needed) that adds the light contribution (diffuse*texture + specular) to the framebuffer.


The AP was joking, smart guy...

Share this post


Link to post
Share on other sites
Quote:
The AP was joking, smart guy...

Ahh, didn't read anything other than "Now draw a black quad over the screen at 50% alpha." :-)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!