Niagara particles don't display correctly with a material that hides objects far away

Hi,

I have a material used as a post-process to make everything farther than X distance turn black, while nearby objects are rendered correctly (attached is an image showing how the material is set up).

The issue is that when I add a Niagara effect, the black area also overwrites the Niagara effects (attached are two images, one with the post-process and one without, to better explain the problem).

this is the niagara particle that is placed in front of the player

and this is what happens when I put the post process material

I don’t understand what could be causing this, and I would really appreciate any help.

Thanks in advance!

1 Like

little up to see if someone can help me :folded_hands:

another up, didn’t figure it out yet

well, it seems to me that the niagara effect is not writing to the depth buffer i think.
mostly because it’s transparent, but maybe because it’s a particle system.

maybe because it’s translucent. those tiny dots seems to be visible ok.

try changing the material on the bluish flare and the circle at the bottom to be masked opaque.
then use “DitherTemporalAA” to connect to the OpacityMask.
that will allow you to fake translucency while being opaque.
it’s a trick but maybe it helps.

hi first of all, thanks for the answer.

I tried what you said and it works partially. the effect is now visible but it has “noise”?

I put the random parameter to 0, 0.5, 1, it changes the form of the effect, but the noisy thing persists.

I made a copy of dither material into my project to customize and changed the texture used but doesn’t work

what should I do?

again thank you!

yes dither is noisy.
dithertemporalaa works in tandem with temporalaa to hide some of that noise. but it is still noisy.

unfortunately i don’t really know how to fix that issue.
i don’t think you can make translucent materials write to the depth buffer.
i think you might want to rework your post process. since you’re going to encounter that issue with all translucent materials. (that means you can’t have anything translucent in the game).

ok, no problem in do a rework for the post process, but is there another way to achieve what I want?

edit: i’ll try to remove all lights and attach one to the player to make it simple

now that’s a good question. and a good mindset.
i’m not sure, but it comes to mind try using a volumetric fog (or other fogs) with a dark color.
a simple one might do.
but also you can make a complex one with a material. i’d recommend starting with a simple one.

i would hope that unreal has solved this issue in their implementation.

another alternatives which would require your exploration are:
check the stage at which the postprocess and your materials are processed.

you might be able to set the particles to be applied after the postprocess.

well, I tried in a different way using volumetric fog and it works perfect, and I learned how volumetric fogs works (very interesting)

followed this video https://www.youtube.com/watch?v=IWGujvx6sSg and tweaking the extincion node to make it works this way

BUT my game is for VR standalone for quest and for android volumetric fogs doesn’t work… what should I do?

1 Like

thanks for sharing the code.
instead of using an If you could use a step or smooth step. since you’re only thresholding. and could be faster than an if. and simpler.
also i personally recommend using a different arithmetic. there’s something like an offset and division that gives you a fade instead of a hard cut.
the smoothstep will give you a small fade.

you can do something like
((AWP - CamPos) + Offset )/ Distance > saturate or smooth step

this guy uses that patter a ton, i think he uses it in the video. check it out (it for a different thing but at some point he usses that patterns and explains it (i think, iirc)) https://www.youtube.com/watch?v=-ynkbsCT2Ic

i’m not sure.
there’s a fog that it’s a simple fog based on distance. you’ll have to do some research. it might help.
i think it should work on vr because it’s a trivial fog, but i cant remember if ue exposes it directly.

also check my alternative solution about configuring the stage for the post process and the particles materials.

that’s only for post process i think.

OOOOOotherwise i just thought of a random approach you can use that might work (please check the postprocess first)
You can set the cull distance to a lower value, then make all materials have a DistanceCullFade or PerInstanceFadeamount to drive a fade out.
and have a solid black bg where things fade into.
also use a cull distance volume.
also i’d recomend on the material to use Opaque/Masked and drive the opacity (mask) through a ditherTemporalAA.
making your materials translucents will make your game much less performant on VR. and also will not write to depth buffer.

it’s a round about way but might work. the problem is that those nodes i think are per mesh, not per vertex. so it will fade kinda like that sonic in saturn (iirc).

the 3rd approach is another roundabout way.
modify your materials to read the depth buffer. or use a node that gets the pixel world position *1
then lerp the mesh color (and maybe other params like specular) to black. so it will “look” as if they’re fading, but they’re just tinting (which is what the post process does).
the problem will be the light, which might or not reflect. (you can also use a very negative color to see if it absorvs light).
you might have to try this one.

you will need some sort of master material, since the parameters on each material should map almost exactly.

another option would be to use an overlay material and tint there. but the overlay material will incur in another drawcall (afaik) and you don’t want that on vr. (but if you’re desperate…)
the overlay material will allow you to avoid modifying the base material.

*1 you can use the same logic you used PixelPos-CamPos+offset/distance>saturate