GPU Particles have issues when shading.

Is there a way to properly render shadowing of particles on each other with large amounts of particles.

I’m actually facing several issues that come and go depending on the settings used and where they are used. Some of the issues result from the type of lighting used, others just don’t work right under certain settings.

I know this is all a game of smoke and mirrors and that there will be limitations, but I’ll pose the big question. Am I missing something? Or, am I fighting the the limits of this system? Or heck, is this broken?

here is the video followed by a quick break down of what I am experiencing:

Youtube link

0:00 - The original cloud from the content demo was used as baseline. I used this in my other map as well to determine how settings are actually affecting things since i know what its supposed to look like. the only noticeable artifact I get with this system is from moving along the relative path of the directional light. Very forgivable IMO.

0:23 - Cloud with velocity to mimic smoke is basically the same thing. just shows how movement affects it for a baseline comparison. I circle around it to show that it works fine from any angle. keep that in mind…

0:45 - the above modified to be a GPU emitter instead. behaves roughly the same way so I don’t spend much time on it. proof of concept. it works fine.

1:00 - GPU cloud with tiny particles. I shrunk the particles quite a bit and made it so this system has roughly 1k particles at all times. whats noticable about this system is that all particles in the spotlight beam react the same way to the light. so even the ones in the back light up so to speak. This is one of the issues I’ve kept noticing and thinking was an issue with normals or something. turns out as soon as I flip over to directional lighting that goes away, but then we have other issues. As I turn my camera view roughly 90 degrees back and forth, the color of the particles gets altered. I figure it’s expected behavior considering these are billboards, but there seems to be a fairly big difference between observing it with spotlights vs directional. I guess its just the way the textures blend with directional light.

1:53 - 10k GPU Particles with spherical normals (and a sharp circle texture). Everything looks nice at first, you can see that all of the particles within the cone of light are illuminating properly. the only downside is that with spotlights they each sample the light and dont occlude each other from it. I switch over to directional light and this is where things get really… interesting? So while I understand that there may be some loss of precision as the systems get bigger and more complex, what I’m seeing is just not right. First, there are shadows in the front where there should be none. This is a short video, but I’ve looked at individual particles before and the shadow positions are wrong. second, you can see here that the shadows are moving up on the particles themselves. The colors are wrong. it’s no longer spherical, but flat! It also seems like there is some issue with depth, though that is not quite apparent in this one… Also just to add an extra note. I had velocity on these at uniform 80 - 100… i just made it 100 even while writing this and the shadow moving issue is still there.

2:45 - 100k GPU particles. the same as above, just more of it. (The only tiny difference is that I accidentally left the translucent multiple sscattering extinction color at white instead of default, but that only changes the color of the shadow, not the issue) Because everything is tightly packed, you can see the errors clearly standing out now. mostly the same as above. stuff pops in and out at places. One thing I do want to point out while looking at the back of the system (time index 3:28 is a good spot) I notice that the shadows on the shadowed particles … are on top?

3:35 - Mesh particles. I wasnt going to do this one originally, but I remembered seeing something very odd… you can see it right at the start. with this new minimalist setup, the shadows appear to be rendered right over the particle system. I think there might also be a depth problem, but whatever is happening is messing with my brain and I cant stare at this for long enough to figure it out. its apparent when I rotate the camera. I just triple checked this and PSORTMODE is “Distance to view”. My instinct tells me the shadow issue shown here is related to the other particles since they seem to show the same behavior for directional and spot lighting changes.

4:17 - I finally found the cause of one of my headaches!! read the note… watch the issue.


PS. I posted this on Trying to get particle shadows to apply to other particles. - Rendering - Unreal Engine Forums and have not been able to get a real answer.

Hey xdbxdbx -

There is an important tool tip that often gets overlooked when using Cast Volumentric Translucent Shadow (VTS, from now on) since it is only shown when hovering over the option, it reads, “[VTS]s are useful for primatives with smoothly changing opacity like particles representing a volume, But have artifacts when used with highly opaque surfaces.” So a lot of what you are experiencing in your video are these artifacts in your particles.

First, I want to explain the “brown” color which you see in your systems (notably the screenshot just above). This color can be set in the material for your particle under the option in Translucency Self-Shadowing >> Translucent Multiple Scattering Extinction. This setting is meant to smooth the transitions and to help sell the volume nature of your particle system.

Now to the heart of the issue, you have translucent particles but the opacity in Cascade is set to 1 which the engine reads as opaque, but because you are still using the VTS that blending is attempting to happen and it generates the artifacts. Alpha setup in your particle system is very important in an effect like you are trying to achieve. With a large amount of particles (small or large) you are getting a lot of overdraw (particles rendering one on top of another) and ignoring the performance issue for now, you are having to add the opacity so at just .5 (50%) opacity which is just 2 particles you would create an opacity of 1 and start to generate artifacts from blending issues. Using some of the information above and in your video, I recreated your effect and had to go to an alpha value of 0.0125 (1.25%) before I removed a majority of the artifacts. You would have to adjust this value based on the size of the particles and the amount of overdraw. For this reason it may be better to go for a masked or an opaque effect without the use of VTS but still casting shadows. With a smooth spherical normal in your material you should get some very good shadowing and the gaps between your particles would still allow for a kind of transparency.

This gets rid of the artifact issue but we still have a light calculation issue to consider. We have to break this down a little more because the light from the level is actually being correctly calculated. You can see this in your video as the light always dims on the backside and is bright on the front side. This issue comes when the particles themselves wanting to be treated as individual camera facing elements, but in actuality that is not what you want them to be. They are a small part of a larger volume and while the screen alignment allows us to adjust as we pan around the effect the normal of the individual particle is not adjusting it is remaining calculated based on Camera Facing which causes issue as your camera pans around the effect and your light remains stationary. (This is why your moving spotlights look better than the directional light there is less obvious normal calculation errors between the camera and the light). So Solution right, here we go, In the Required Module way down at the bottom there is a Normal section. Adjust it to Cylinder and the emitter will now calculate the normal based on being a cylindrical volume and not based on being a Camers Facing sprite, even though your sprite is still camera facing. (For your original effect it would be best probably to use a Spherical calculation, also an option.)

In summary, adjust your alpha WAY down based on your size and spawn amount OR use opaque particles without VTS and adjust the Normals to better match the overall shape of your emitted effect.

Here is an example of the Opaque example, VTS with 25% Opacity and VTS with 1.25% opacity:

Here is my calculated normal for an opaque particle (it looks a little better than the texture based sphere normal, my opinion) the hardness of the normal’s sphere mask is set to 0:

Thank You

Eric Ketchum

(I also answered you on the forums, here: Trying to get particle shadows to apply to other particles. - Rendering - Unreal Engine Forums

Thank you so much for such a detailed reply. Truly appreciated. I’m going to digest all this and try out a few things in the next day or 2 and reply with my results.

Near the end of the video though, there is what looks like a glitch with the shadows disappearing as i move the camera when i set the particles to “facing camera.” (4:17 i believe). Is this related to lack of the normal setting you mentioned? Or is it a bug? I believe the issue goes away setting the particles to PSA square.

Hey xdbxdbx -

I am glad you mentioned that as I know I was going to forget to talk about the bounds. Shadowing and in particular the VTS is determined from the center of the bounds of the emitter to its extremes, so the fixed bounds of a particle can actually limit how and where your shadows appear. A really good example of this is to set you fixed bounds in Cascade to 100,100,100 and -100,-100,-100. This is obviously really smaller than your whole particle system and you will see in the level that VTS only happens in the confines of you bounds and as your camera moves around the bounds (possible having the bounds register as crossed) your shadows will disappear.

Thank You and if you have any questions let me know -

Eric Ketchum