Deferred Rendering and Transparent Objects

Started by
6 comments, last by Krypt0n 12 years, 2 months ago
Hello everybody,

I am researching about deferred rendering and especially the handling of transparent objects. I know the "easy" way to do it by rendering them in a separate pass using forward lighting, however could it be possible to integrate them in the deferred pass using an order independent transparency technique such as depth peeling or stochastic transparency?

I would like your views on this :)
Cheers
Advertisement
I wouldn't say it was the "easy" way, but rather the only way. At least the only way that makes any practical sense.

There is inferred rendering and plain old screen door transparency (filtering optional), but those techniques obviously have many problems. Namely quality and the number of transparent layers. Then there is the deep gbuffer approach, which suffers from a limited number of transparent layers and also a high memory consumption and bandwidth usage.

Stochastic transparency is a nice concept, but I don't think its close to being practical. If my understanding is correct, it would require a lot of memory and most likely several render passes for noiseless images. My guess is that you would never see playable frame rates on current hardware.
but if you use order independent transparency, why not shade them forward? then you just store the color (and sometimes depth) per layer, if you want to shade transparent objects the deferred way, you have to write out a gbuffer for every layer, this could be quite expensive.

In my opinion, for transparent passes, one of the techs described here is the way to go :)
Light indexing is probably the most interesting.
Rendering using OIT could be possible in forward rendering, but that defeats the purpose of the OIT, doesn't it? I wanted to use it to integrate it in the deferred pass somehow.
I put together a hybrid method, rendering transparent/alpha blended materials in a separate pass(es) using deferred shading. It's a bit more flexible than a using forward rendering and has the bonus of unifying the lighting between the opaque and transparent steps. As for order-independance...ShaderX7 describes an interlacing method for deferred rendering transparency; it could be used to do OIT but is very limiting on the number of per-pixel transparent layers.

Rendering using OIT could be possible in forward rendering, but that defeats the purpose of the OIT, doesn't it?


Not really. OIT has nothing to do with deferred shading. They are completely orthogonal concepts.
In my implementation (seen in my journals) I was able to implement very simple transparency accidentily though basic alpha channels. But i have multiple layer draws due to having to draw a tilemap and overlaying sprites. Shading doesnt apply fully (i.e., the underlying material will not be shaded) since the material is overwritten with the transparent sprite and thus its material now defines the area of the color/normal buffer. Though, if adding the two color channels when the alpha channel is detected to be "transparent" when defining the normal buffer, the shading buffer should still be correctly applied for the "occluded" material since the normal buffer took transparency into account. That would require per-pixel rasterization when defining the normal buffer, but i think it would be doable. (there is probably a technique name for this, i just dont know it)

Rendering using OIT could be possible in forward rendering, but that defeats the purpose of the OIT, doesn't it?.
not really, OIT solves the problem of the proper order of alpha fragments/pixels. it's needed for proper transparency even without any lighting. check out

I think the only shading comes from a fresnel term for the blend intensity.

the solution you want to choose is very dependant on what you're actually rendering. having just one layer of glass (e.g. window) might work with simple MSAA and a custom sample mask where you writ every second pixel in case of transparency. it's simple to implement, fits naturally into the deferred shading pipeline with all the other effects. particles on the other side won't work with satisfying results with this solution. but particles can be shaded per vertex (or at least you can select like the 4 most contributing light sources per particle/vertex and use those in the usually forward rendering fashion (but that won't work for big windows that might be affected by several tiny lightsources. For tiny objects (e.g. a bottle), you might get away with cubemaps only that have lighting backed in etc.

And lighting + transparent objects are not the only issues you might have, you also want fog (even fog areas?) to work fine, mirrors (e.g. a water plane)? you might want to have shadows + projectors, decals?

and on top, you need to be very careful regarding performance, while you have an exact limit of solid pixels on the screen (-> your resolution), transparent objects can easily add 10x the cost. you might become limited to e.g. the fillrate, which isn't that common in solid deferred rendering. you might also process a lot of fully transparent or overwritten pixel. that's the main reason why most games nowadays have very few transparent objects.

This topic is closed to new replies.

Advertisement