Decal and Per-Pixel Lighting

Started by
3 comments, last by TfpSly 18 years, 5 months ago
Hi all Im writing engine for render with Per-Pixel Lighting technique. But i have some proble. How can i draw decal in my engine. I render decal by draw a quad lie on target surface and adjust Z-Bias for eliminate z-fighting problem. It work on scene without lighting. If i want draw decal with lighting i must - Render Scene with ambient - Render Decal with ambient For all lights - Draw Shadow Volume - Draw Scene with light End For all light - Draw Shadow Volume - Draw Decal with light End. ....... It's mean i must draw shadow volume 2 time !?!?! Have any better solution for my problem ? Thx for reply :)
Advertisement
Um... I'm not sure why decals would justify their own entirely different pass. Is there any resons why you can't simply do it like this?

- Render Scene with ambient
- Render Decal with ambient

For all lights
- Draw Shadow Volume
- Draw Scene with light
- Adjust Z-Bias + other Decal specific settings
- Draw Decals with light
End

Although, now that I think about it, Shouldn't the shadow volume rendering come LAST? The shadow volume has no visible geometry by itself, it only exists to shade the geometry that's already been rendered. That MAY be why you felt you had to draw it twice: because the first pass was having no effect?

So in the end I think it SHOULD be:

- Render Scene with ambient
- Render Decal with ambient

For all lights
- Draw Scene with light
- Adjust Z-Bias + other Decal specific settings
- Draw Decals with light
- Undo Z-Bias, etc...
- Draw Shadow Volumes
End
// The user formerly known as Tojiro67445, formerly known as Toji [smile]
Thx for reply Toji :)

I cant draw scene and decal in same pass because my decal require alpha blending.
Decals are tricky to get lit, shadowed and fogged correctly. There are some details of how I do it in my dev journal linked below.
Quote:Original post by Toji
Although, now that I think about it, Shouldn't the shadow volume rendering come LAST? The shadow volume has no visible geometry by itself, it only exists to shade the geometry that's already been rendered. That MAY be why you felt you had to draw it twice: because the first pass was having no effect?

That's how it was done 3 years before when shadows were darkening the scene, instead of lights lighting the scene ;)
Now we want to hilight only what the light can see, which means everything that is out of the shadow volumes. That's why the shadow volume must be rendered first.

This topic is closed to new replies.

Advertisement