Jump to content

  • Log In with Google      Sign In   
  • Create Account


Deferred rendering with transparency and particles


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 Wh0p   Members   -  Reputation: 276

Like
0Likes
Like

Posted 23 September 2013 - 02:41 AM

Hi,

I am using a deferred renderer for some time now however I think the way my pipeline is set up could be optimized here and there...

This is a general overview over what I am doing:

1. G-Buffer for solid geometry only
2. Light calculation on the solid geometry

For each transparent layer (here the transparent objects should be sorted from far to close up):
  3. G-Buffer for transparent geometry
  4. Lights for the transparent geometry

5. Render all my particles without depth testing from d3d but find out what to draw and where to blend through the several position buffers

6. Finally compose the image all together.

I know myself this method has some drawbacks, but I kind of come up with this layout by myself with only little inspiration from some articles.

As far as I am concerned the image looks good to me, but this method obviously consumes a lot of resources. Especially deciding how many layers of transparent geometry you want to render is hard to answer for me.

 

My question is now how do you encounter this problem to handle transparency in a deferred renderer. Do you have ideas, suggestions, improvements or a totally different approach to render transparent objects?



Sponsor:

#2 Hodgman   Moderators   -  Reputation: 26958

Like
4Likes
Like

Posted 23 September 2013 - 02:51 AM

I started a thread about an approach I'm trying out recently here: http://www.gamedev.net/topic/647731-stippled-deferred-translucency/

 

It's also very common to simply not use deferred shading on particles, and instead use traditional forward shading, or some kind of approximate lighting trick, such as computing the lighting for each cell in a 3D volume covering the visible area, and then light the particles using those cells.

 

There's also Forward+, Clustered Forward, etc, which are in-between forward and deferred shading. I think the new Just Cause game (IIRC...) uses clustered deferred on most objects, and clustered forward on translucent objects.


Edited by Hodgman, 23 September 2013 - 02:53 AM.


#3 Wh0p   Members   -  Reputation: 276

Like
0Likes
Like

Posted 23 September 2013 - 09:24 AM

There's also Forward+, Clustered Forward, etc,..

 

That's a nice hint. Your post was informative as well.

I've found this regarding these methods: http://www.cse.chalmers.se/~uffe/clustered_shading_preprint.pdf

Looks like I have to do a deep dive into this topic :)

 

Thank you so far, if you have some more information on this up your sleeve it's always welcome!



#4 Hodgman   Moderators   -  Reputation: 26958

Like
0Likes
Like

Posted 23 September 2013 - 04:26 PM


I've found this regarding these methods: http://www.cse.chalmers.se/~uffe/clustered_shading_preprint.pdf
Check this one out too; http://www.humus.name/Articles/PracticalClusteredShading.pdf

#5 CDProp   Members   -  Reputation: 879

Like
0Likes
Like

Posted 23 September 2013 - 07:12 PM

Hodgman, at this point it sounds like you're pretty deep into the implementation of a deferred renderer. If you were starting over again, would you change to Forward+?



#6 Hodgman   Moderators   -  Reputation: 26958

Like
0Likes
Like

Posted 23 September 2013 - 08:30 PM

I'm using clustered shading at the moment (as described by the 'practical' pdf above), and I have it working in both forward and deferred modes biggrin.png

 

My engine supports shaders with multiple 'techniques'/'passes' (like D3DX Effects), so my shaders can have an entry-point/pass/technique that writes attributes to a G-Buffer, and also have one that performs forward lighting and writes final colours to a HDR buffer.

The forward lighting function, and the deferred lighting shader both include the same common header file, which contains the clustered shading code.

 

So, I can either set the current pass to be "forward", and then render all objects to a HDR buffer.

Or, I can set the current pass to "gbuffer", and then render all objects to MRT G-Buffer, and then draw the lighting geometry to a HDR buffer.

An if conditional can switch between the above two pipelines at runtime, which is great for validating that the deferred renderer is working properly wink.png

 

I'm not firmly committed to using one or the other yet... but yeah, clustered forward (pretty much the same thing as Forward+) is a very nice pipeline. It's faster than the deferred pipeline in a lot of cases.



#7 kalle_h   Members   -  Reputation: 1259

Like
0Likes
Like

Posted 24 September 2013 - 02:58 AM

I'm using clustered shading at the moment (as described by the 'practical' pdf above), and I have it working in both forward and deferred modes biggrin.png

 

My engine supports shaders with multiple 'techniques'/'passes' (like D3DX Effects), so my shaders can have an entry-point/pass/technique that writes attributes to a G-Buffer, and also have one that performs forward lighting and writes final colours to a HDR buffer.

The forward lighting function, and the deferred lighting shader both include the same common header file, which contains the clustered shading code.

 

So, I can either set the current pass to be "forward", and then render all objects to a HDR buffer.

Or, I can set the current pass to "gbuffer", and then render all objects to MRT G-Buffer, and then draw the lighting geometry to a HDR buffer.

An if conditional can switch between the above two pipelines at runtime, which is great for validating that the deferred renderer is working properly wink.png

 

I'm not firmly committed to using one or the other yet... but yeah, clustered forward (pretty much the same thing as Forward+) is a very nice pipeline. It's faster than the deferred pipeline in a lot of cases.

 

At that presentation they are making light list at cpu. How you are doing light culling for deferred clustered?



#8 Hodgman   Moderators   -  Reputation: 26958

Like
0Likes
Like

Posted 24 September 2013 - 05:54 AM


At that presentation they are making light list at cpu. How you are doing light culling for deferred clustered?
At the moment, on the CPU.

 

I'll look into doing it on the GPU for the DX11 code-path later, but don't have a need to do so yet (the GPU is the bottleneck in my game; plenty of CPU time to burn).

 

I was also experimenting with a method for generating the light lists for tiled-shading, where the CPU would generate initial lists with no min/max depth info per tile, but then the GPU would further cull these lists after per-tile min/max depth was known, and then compact the culled lists before using them for shading.



#9 Wh0p   Members   -  Reputation: 276

Like
0Likes
Like

Posted 26 September 2013 - 05:37 AM

I have started to implement the clustered deferred renderer now but there is one thing I dont know how to deal with.

 

I pretty much use the data structure from the presentation Hodgman suggested to represent the lights and clusters.

 

But I can't think of a good way, to compute the index list texture, with all the lights indices. Best case would be highly parallel on the GPU.

Problem is if I choose to make the texture smaller than the absloute worst case the only thing I can come up with is to compute this texture sequentially on the CPU...

And I dont want to make the texture that big to hold the worst case szenario either.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS