# Lighting translucent surfaces correctly

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

## Recommended Posts

Hi, I am thinking about how to handle lighting of translucent surfaces. For example, a stained glass light by a nearby lamp. To process this correctly, rendering should go like this: 1) Render all opaque stuff (including lighting etc.) With zwriting enabled. 2) Sort all translucent objects by z-depth, back-to-front 3) For each translucent object, render it with correct blending and lighting Point (3) is the one that confuses me. If the translucent object is not lit, then it should not be visible if blended over a black background, but if for example there is something lit way behind the surface, it should be visible & blended by the surface. That is, if the glass isn't lit, the glass itself should only be visible if something lit is behind it. Sounds to me like I have to split (3) into: a) One pass with multiply as blending op (no lighting involved here) b) Additional additive passes per light lighting the surface itself But this method is inpractical for most pipelines, since most pipelines do objects-per-light, and this method resembles lights-per-object, which is especially bad for shadowmapping. For clarification, objects-per-light:
for l in lights {
for o in objects_in_light(l) {
... render ...
}
}

Lights-per-object is the same, just with the for loops swapped. Come to think of it, this is a classic case where raytracing is MUCH easier. All power to real-time raytracing cards! :) Now, I am quite confused. Anyone has some ideas about this?

##### Share on other sites
I'm pretty sure humus' ati related site had a demo of what you're looking for.

You might check it out (to get ideas)

-Michael g.

p.s. ah.. there it is

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 9
• 13
• 9
• 9
• 15
• ### Forum Statistics

• Total Topics
634076
• Total Posts
3015355
×