LaBasX2

02-08-2002, 11:23 PM

Hi!

I was thinking about how to implement specular ligthing on a perpixel basis in my engine but I have found a serious problem.

Here is how my geometry is rendered without specular:

1. Draw geometry with ambient lighting

2. Loop through all light sources

2.1. Draw shadow volumes

2.2. Add diffuse result

2.3. Add attenuation result

3. Multiply result from (1) and (2) with texture map

This is working really good. But what if I want to add specular now? The problem is that I can't just insert specular into (2) because the specular result needs to be added to the result of (1),(2) and (3); it needs to be applied after the decal pass (3)

So I would have to loop throgh all lights angain in a fourth step; the problem here are the shadow volumes; to get correct results, I would have to draw all the shadow volumes in my step (4) again.

4. Loop through all lights

4.1. Draw shadow volumes

4.2. Add specular result

Drawing all shadow volumes twice would of course cost damn much performance since they eat so much fillrate.

Am I missing something here? Does someone know a better solution?

Thanks in advance

LaBasX2

[This message has been edited by LaBasX2 (edited 02-09-2002).]

I was thinking about how to implement specular ligthing on a perpixel basis in my engine but I have found a serious problem.

Here is how my geometry is rendered without specular:

1. Draw geometry with ambient lighting

2. Loop through all light sources

2.1. Draw shadow volumes

2.2. Add diffuse result

2.3. Add attenuation result

3. Multiply result from (1) and (2) with texture map

This is working really good. But what if I want to add specular now? The problem is that I can't just insert specular into (2) because the specular result needs to be added to the result of (1),(2) and (3); it needs to be applied after the decal pass (3)

So I would have to loop throgh all lights angain in a fourth step; the problem here are the shadow volumes; to get correct results, I would have to draw all the shadow volumes in my step (4) again.

4. Loop through all lights

4.1. Draw shadow volumes

4.2. Add specular result

Drawing all shadow volumes twice would of course cost damn much performance since they eat so much fillrate.

Am I missing something here? Does someone know a better solution?

Thanks in advance

LaBasX2

[This message has been edited by LaBasX2 (edited 02-09-2002).]