Advertisement Jump to content
Sign in to follow this  

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.

If you intended to correct an error in the post then please contact us.

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 this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!