r/GraphicsProgramming • u/Zestyclose_End3101 • 42m ago
I added depth occlusion to my GPU particles system
Recently I wanted to make my GPU particle system more dynamic and easier to develop with and given how vital heavy rain is to the tone and visuals of the game, I wanted to make rain be dynamically occluded based on the meshes.
First I flag the meshes which should be occluders, which is shown in the second photo. These occluders are rendered from an orthographic camera. The third photo is the depth texture from this render pass.
Particle emitters can then have a flag for height occlusion and height snap. In the particles compute pass, the depth texture is sampled and remapped to view space to get the distance. For emitters with height occlusion enabled, their lifetime is set to zero if they're greater than this distance. For emitters with height snap, the particles are set to this sampled height.
A limitation of this approach is that wind doesn't really work since the particles aren't actually colliding with anything. If there are any ideas of how to rectify this I'd love to hear them.
Overall, I'm pretty happy with this approach, and it has made iterating on the level much faster.



•
u/AutoModerator 42m ago
Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/TreyDogg72 21m ago
Very cool! Perhaps you can get that wind support you’re looking for by just passing a wind speed vector into the shader where you compute the particle effects?