iluminatting my engine

i’ve been working in a 3d engine, and i want to start working on illumination effects, wich i want to be as dynamic as possible (somehow like doom3), but i’ve a few questions regarding this:

bump mapping: using normal maps with pixel shaders is the right way to do this?

shadows: i’m thinking about using shadow volumes, they’re just to artificial but look just fine for what i want to do. does anyone have a better solution?

ilumination: what do you suggest to create dynamic ilumination for, let’s say a room, with textures, doing specular reflections, bump mapping and all that stuff?..

please help me, guys…

bump mapping: using normal maps with pixel shaders is the right way to do this?

I wouldn’t call any technique the “right way” because it just depends on what you are doing. But this is basically the method Doom 3 uses.

shadows: i’m thinking about using shadow volumes, they’re just to artificial but look just fine for what i want to do. does anyone have a better solution?

If they are good for what you are looking for, then what’s the problem? You can try shadow mapping, it can be done in hardware on GeForce 3 level hardware and up. Of course they have their own issues to deal with, like the jaggies that show up on the edges when the shadow is in a certain orientation and stuff.

ilumination: what do you suggest to create dynamic ilumination for, let’s say a room, with textures, doing specular reflections, bump mapping and all that stuff?..

Sure why not. I think it’s best to use the dynamic illumination stuff for dynamic lights. For lights that are static you can precompute the lighting. I don’t mean you have to use something like radiosity, you can if you want. But you could even use the same perpixel light shaders you use for dynamic lights but use them for precomputing the lighting and saving the results in a texture and then use this that same way you would apply a lightmap. How the light looks would be the same as the dynamic light but for these you wouldn’t be computing all the light calcs for each pixel every time since all of this was precomputed.

-SirKnight

when using per pixel lighting, no matter which method of doing this (except for precomputed lighting), you need one complete rendering pass for each light, am I right? and if you have two passes for one light (one diffuse, one specular) and have five lights, you have to render the scene 10 times. or am I getting something wrong?

Originally posted by JanHH:
when using per pixel lighting, no matter which method of doing this (except for precomputed lighting), you need one complete rendering pass for each light, am I right? and if you have two passes for one light (one diffuse, one specular) and have five lights, you have to render the scene 10 times. or am I getting something wrong?

You’re correct. However, you only render the objects that the light “touches” for each light, not the entire scene.

This is the Doom3 lighting model. Others use a hybrid approach, per-pixel on the strongest light, and vertex lighting on the others, but then you need a lot of tweaking to avoid artifacts and popping.

jcabeleira:

If you go with the completely dynamic lighting model with shadow volumes. You should make heavy use of OpenGL’s scissor. Put a scissor that is equal to the screen space bounding box of the light, and you’ll save enormous amount of stencil fillrate.

That’s the easiest and most effective optimization when it comes to shadow volumes, since fillrate is what most impact performance when it comes to shadow volumes.

Also, look at Kilgard’s et al GDC2003 paper on Stencil shadow volumes.

Chris

when using per pixel lighting, no matter which method of doing this (except for precomputed lighting), you need one complete rendering pass for each light, am I right?

Absolutely not. Even a lowly GeForce 3 can get away with 3 per-pixel bumped diffuse lights. If they aren’t bumped, then it’s even better. Of course, renormalization of the light vector is an issue, but if your polys are small enough, it shouldn’t matter. If you want to renormalize per-pixel, then you’re limitted to 3. Of course, that assumes that the 4th texture is the diffuse image map. If you don’t have one, you can use 4.

If you want to do the tangent-space transform per-pixel (the right way), then you have an issue to deal with. A GeForce 3/4 can only pull off 1 of these per pass. An 8500 series can get 2, maybe even 3 with tricks. More modern hardware has more flexible limits.

Originally posted by Korval:
If you want to do the tangent-space transform per-pixel (the right way), then you have an issue to deal with. A GeForce 3/4 can only pull off 1 of these per pass. An 8500 series can get 2, maybe even 3 with tricks. More modern hardware has more flexible limits.

can you explain me how tangent-space transform works? i’ve no ideia of what it is.

Originally posted by Korval:
Absolutely not. Even a lowly GeForce 3 can get away with 3 per-pixel bumped diffuse lights. If they aren’t bumped, then it’s even better. Of course, renormalization of the light vector is an issue, but if your polys are small enough, it shouldn’t matter. If you want to renormalize per-pixel, then you’re limitted to 3. Of course, that assumes that the 4th texture is the diffuse image map. If you don’t have one, you can use 4.

In my post, I was assuming the use of:

  • Per-pixel attenuation
  • Light filter cube map
  • bump map
  • Per-pixel normalization cube map
  • diffuse/specular texture

I do this with two passes on geforce3/4.

I’m curious, when you say that you get 3 lights per pass on a Geforce3 card (with 4 texture units), which of the above did you include/remove?

I’ve often tried to optimize the light passes, but everytime I have a go at it, I run into something I have to sacrifice…