Add COLLIDER_CULL_MASK to Process built-ins for particle shaders #7362
Replies: 2 comments 1 reply
-
I took a look at the engine source code (even though I'm essentially poking around in the dark) and it seems the place to start is in the particles.glsl shader. From my limited understanding, it appears that particle collision objects are stored in a buffer called |
Beta Was this translation helpful? Give feedback.
-
So it looks like there is a confirmed bug related to GPU particle collisions and the cull mask. There is a pull request that may have fixed the issue. But it appears the review team does not intend to merge the changes made by @MightiestGoat, so it's somewhat dead in the water at the moment. That, coupled with the fact that particles are undergoing an internal overhaul, probably means this feature should wait until existing work/issues are resolved. That's assuming engine contributors even think this proposal is possible and/or worth it to implement. Would welcome some input! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the project you are working on
A strategy game with the need to render thousands of zombies simultaneously in dynamic hordes. I intend to drive these hordes with particle systems and shaders.
Describe the problem or limitation you are having in your project
Currently the only collision data we have access to in particle shaders are whether something collided, the collision normal, and the collision depth.
But we have no way of knowing what the particle collided with.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
I propose that the cull mask value of a GPUParticlesCollision3D be passed to the particle shader as a Process built-in. This would allow users to program unique scenarios for particle collisions based on the type of object collided with.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I'm not capable of engine programming so I can't offer any insight there. But perhaps whoever decides to work on this issue might be able to implement this feature while they're at it.
But here's an example use case for this proposal. Let's say I'm using particles to simulate rain, and I'm using Layer 1 of my cull mask for objects made of concrete, Layer 2 for sand, and Layer 3 for glass. By having access to the cull mask in the shader, I could have my raindrops create splashes on concrete with subemitters, soak down into the sand by disappearing, and create droplets with trails on glass.
For my own project, I plan to animate zombie hordes with animation textures in a mesh shader. Knowing what type of object a particle collided with will allow me to program unique collision animations (eg. if it collides with a door it will start banging on the door, or with a bullet it will play its death animation).
If this enhancement will not be used often, can it be worked around with a few lines of script?
No
Is there a reason why this should be core and not an add-on in the asset library?
It changes a class of the engine.
Beta Was this translation helpful? Give feedback.
All reactions