Sign in to follow this  

[SOLVED][DX10] Point sprites and the z-buffer

This topic is 2343 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

I am implementing the ParticlesGS sample in my engine and i came up with a problem... the rendering order is screwed, the only good situation is when i have additive blending, but in my case i have some smoke particles that doen't look nice. So is there a workaround with z-buffering and blend states or i need to hardcode a sorting on the CPU? Because if i had to implement a CPU solution then the whole idea of using GS is worthless, right?

Share this post


Link to post
Share on other sites
[quote name='Key_46' timestamp='1310433360' post='4834081']
I am implementing the ParticlesGS sample in my engine and i came up with a problem... the rendering order is screwed, the only good situation is when i have additive blending, but in my case i have some smoke particles that doen't look nice. So is there a workaround with z-buffering and blend states or i need to hardcode a sorting on the CPU?
[/quote]

Your basic alpha-blended transparency is order-dependent, and there's no good way around it. Methods for order-independent transparency exist, but they are generally way to slow to be of practical use (especially for particles). I'm pretty sure that sample you're using sorted the particles on the CPU.

[quote name='Key_46' timestamp='1310433360' post='4834081']

Because if i had to implement a CPU solution then the whole idea of using GS is worthless, right?
[/quote]

No, why would you say that? The point of using the GS for point sprite expansion is so that you only have to feed the GPU a single point per particle, rather than a list of 4 vertices per particle + an index buffer. You still get that benefit if you sort your point list on the CPU.

Share this post


Link to post
Share on other sites
Thanks for the response MJP, the problem is that i am also redirecting the stream output so i can do all particle computations on the GPU side without sending data through the bus. But i don't know how better this is in comparison with normal CPU calculations. I am implementing the sorting on the CPU and i'm still getting pretty neat results [img]http://public.gamedev.net/public/style_emoticons/default/smile.gif[/img]

I am also questioning the use of Geometry Shader, it makes the coding simplier but I've read (in 2007) that Geometry Shader produces a noticeable overhead, and since i'm creating a simple quad, isn't better to use instancing instead?

Share this post


Link to post
Share on other sites
[quote name='Key_46' timestamp='1310499945' post='4834462']
Thanks for the response MJP, the problem is that i am also redirecting the stream output so i can do all particle computations on the GPU side without sending data through the bus. But i don't know how better this is in comparison with normal CPU calculations. I am implementing the sorting on the CPU and i'm still getting pretty neat results [img]http://public.gamedev.net/public/style_emoticons/default/smile.gif[/img]

I am also questioning the use of Geometry Shader, it makes the coding simplier but I've read (in 2007) that Geometry Shader produces a noticeable overhead, and since i'm creating a simple quad, isn't better to use instancing instead?
[/quote]

Ahh I see. Yeah in that case sorting is a little tricky. It is possible to sort on the GPU, however it's probably not practical unless you use a compute shader. If you do ever go down that route, Nvidia has whitepapers and tutorials for various sorting algorithms in their cuda developer zone.

As for the point expansion, the older DX10-era presentations from the IHV's used to say that geometry shaders were okay as long as you didn't emit more than 4 vertices and you kept your vertex structure pretty lightweight. So for particles that should be fine. But you can always profile if you need to know for sure for a particular GPU.

Share this post


Link to post
Share on other sites
[quote name='MJP' timestamp='1310507139' post='4834530']
Ahh I see. Yeah in that case sorting is a little tricky. It is possible to sort on the GPU, however it's probably not practical unless you use a compute shader. If you do ever go down that route, Nvidia has whitepapers and tutorials for various sorting algorithms in their cuda developer zone.

As for the point expansion, the older DX10-era presentations from the IHV's used to say that geometry shaders were okay as long as you didn't emit more than 4 vertices and you kept your vertex structure pretty lightweight. So for particles that should be fine. But you can always profile if you need to know for sure for a particular GPU.
[/quote]

Thanks again, i will leave the full GPU and the CPU sorting solutions then. I will compare the performance with the instancing when i finish these two.

Share this post


Link to post
Share on other sites

This topic is 2343 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this