Jump to content
  • Advertisement
Sign in to follow this  
ThiEF_Jr

Decal and Per-Pixel Lighting

This topic is 4724 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

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 :)

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!