Niagara Phantom Colliders

Hi, I have a GPU sim going akin to the reproduction sprite content example on a static mesh, spawning on the surface of a mesh aligned to a tri normal.
Two things…

  1. using the mesh in the world as a collider gives some nicer results, but I don’t want the mesh to actually be visible in the render… when I turn off the visibility of the source mesh it disappears from the Scene Depth Buffer… per chance is there a way to leave the mesh in the depth buffer for collisions but not have it render in scene?
  2. I set Facing Mode = Custom and set SpriteFacing to the mesh normal initially… after some sim time id like to switch back to the default Facing Mode = Face Camera… where can i get a vector from the particle position to the camera in order to lerp the SpriteFacing vector from the mesh normal to the Camera normal over the life of the particle?

tia.

For 1 I can think of 2 methods

  • Use a transparent material, set masked cuttof at 0, set opacity to 0. The cutoff is important as it will still decide what pixels get drawn into the depth buffer.

  • In the render component, look for render in Main Pass, Render in Depth pass, etc… You can turn of Main pass seperately from depth. (I believe the downside here is that shadows will still be visible.)

For 2. Try Camera Interface. There is GetCameraDataGPU/CPU (or something similar, I can’t remember exactly) which outputs cameraWS. Now you can just do CameraWS - Particles.Position to get a facing vector.

Yes, for facing direction what @Niels suggested should work.

I am not sure if disabling mesh from MainPass and keeping in depth would be a good idea. Unreal relies on depth buffer to do a bunch of things and keeping mesh in depth but not in main pass will cause popping artefacts.

1 Like

Thanks for the suggs. I think I might be missing where to look exactly. I created a new material, set Blend Mode to Translucent but from there can’t locate anything that resembles ‘masked cutoff’ in Material Details. Simply applying this translucent material to half of my Static Mesh, and then visualizing the Scene Depth shows that part of the mesh to have no data… and nothing collides with that part of the SM.

If I turn of Render in Main Pass, the entire SM is no longer visible in the Scene Depth Buffer and I no longer get any collisions.

Is there a way to set a distance field or have one computed on a per Static Mesh scenario without enabling it globally for the entire project? I feel if I can somehow build my own static mesh or dial the resolution of a pin pointed static mesh that needs a collider (ideally not view dependent) I could use that as a GPU collider… any good fx reference for how to use SDFs in UE?

The SpriteFacing sugg worked great! thanks for that.
I’ve uploaded a screenshot to help be a bit more specific about the naming of things since I have it in front of me… but I scratched this off my particle update and it matches flipping the Sprite Renderer back to its default Face Camera Facing Mode. Now I can just work in a few controls for timing based on velocity or life and I’m g2g! cheers.

I don’t see how it’ll work tbh.
image

This is what you’ll get if you enable depth but not render it in main pass.
The floor mesh thinks that its occluded and does not render where the sphere was. And the sphere doesn’t render in main pass, ergo black void.

Material:

DEPTH_ONLY_PASS macro was a quick hack I added to test this. Its true for depth only pass and 0 otherwise.

Again, I might be missing something but I think there should be a better alternative for what you are trying to achieve.
Do you just want to enable particle collision with the static mesh? You can render custom sdf for the mesh in that case, I think Jonathan Lindquist was doing something similar for his particles demo?