Skip to main content
GameDev.net gamedev.net
🔒 Locked

Depth Testing in Deferred Rendering

Started by hondrion Aug 16, 2012 at 1:35 AM 0 replies 1.5k views
Original Post
hondrion
hondrion
Final edit: Managed to resolve the issue, apparently my depth calculation for the particles were wrong

Hello,

I am working on a deferred rendering engine on XNA, and I'm stuck on how to perform depth testing when it comes to combining transparent objects and particles on the final render target.

Right now, I render my opaque geometry on the GBuffer, whilst packing the linear depth into a ARGB surface.

What would be the ideal way to draw the transparent geometry on the scene? I thought of sampling the opaque depth, calculating the depth of the particle, and drawing or clipping depending on the sampled depth, but I couldn't make it work so far.

Thanks in advance!
Edit: what I'm trying to prevent (particles are behind the curtain in here)
vsibT.png

spawner is in the center
ow8O3.png
Seabolt
Seabolt
So the standard approach is to perform a standard forward rendering pass with transparent geometry.

This is because even if you were to perform your own depth testing on the pixels, (which would be slow), the geometry behind it wouldn't be lit properly, causing your color to not be accurate. Even if you were to do a separate G-Buffer for transparent data and blend the two, you'd have the same issue with transparency overlaying each other.

The best way so far is to render out your deferred opaque scene, blit it into the back-buffer (or equivalent), then render your transparent geometry on top of it. This usually means that lighting will be a little off for transparent data, but that's the price we pay.

You could also look into Inferred Rendering, which allows transparency (sort of) in a deferred-like structure.
Perception is when one imagination clashes with another

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.