Dynamic shadows processing

I’ve added 144 humans with LODs to my scene.

http://puu.sh/jeQuV/75f12251da.jpg

http://puu.sh/jeQzz/99f448ac70.jpg

All work fine on the first look.

http://puu.sh/jeQAb/7c3b7fd6ec.jpg

But when I look nearly the same direction as my movable directional light and have meshes behind me fps drops down. Problem goes away after setting light to stationary. Decreasing shadow distance also gives some effect, turning shadows off kill the problem too. So I think that it’s culling / shadow / lighting bug because it appears only in one case of looking the same direction as the light.

I’ve also tried it on 4.8 and blank projects. It seems to be a common issue.

UP00

Also appears when shadow doesn’t reach the “ground” with stationary light.

Noticed that fps drops by ~1-3 in case only my character and movable light in the scene.

So now I think it’s not culling problem.

UP01

Also occurs in development and shipping packaged game.

UP02

I’ve recognized that my problem caused not by movable directional light. It caused by dynamic shadows.

Example project: http://puu.sh/jfdIp/305ca25d01.rar

Better example: http://puu.sh/jg4nR/aeb14755d4.rar

Hey Bailey.

You’ve got me wrong. It’s not an optimization problem unless of course movable lights must have this issue.

I’ll describe in other way.

I hope it will be helpful.

Hey Whiz652.

It appears that you are on the right track.

So if you are casting dynamic shadows on 100 different objects that will certainly increase your fps.

There are several things you can do to optimize.

1.) Changing your near fields and far fields when viewing your humans will optimize.

2.) Only having one light in your scene, so your directional light and your sky light. Only having the directional set to cast dynamic shadows will improve your FPS

Optimization sounds like your biggest issue at this point. You are already using the r.stat unitgraph
Another command is profilegpu

This will take a capture of what you have in your scene thus far and show you where most of your issues occur.

Let me know what you find out,

Hey Whiz,

So then perhaps the problem lies within your culling. So without certain settings turned on/off the engine will attempt to calculate what is off of the camera. HBZOcclusion 1 that is entered into the command prompt inside of the UE4 that will change the state of occlusion to better handle peripheral areas as well as areas that the camera does not see.

If that does not work then send me a link to your project and I will look at how exactly you are handling your meshes in relation to your lighting and rendering settings.

Thanks,

Hey Bailey.

r.HBZOcclusion 1 gave no results. But then I was working on example project for you I’ve recognized that my problem caused not by movable directional light. It caused by dynamic shadows. If you set dynamic shadows distance for stationary light it have the same effect that I described.

Here is my example project: http://puu.sh/jfdIp/305ca25d01.rar

Hey Whiz652,

I have opened your project and optimized the lighting substantially and I’ve lowered the ms by about 15.

However, and here is your biggest issue, it’s your LOD’s. At your highest LOD you have about 5000 polygons you are trying to calculate across 144 models. That should be around half.

Your tongue, eyes, and teeth are all separate pieces at that distance. Unless you need a close up of the character talking you don’t even need those at a zoomed out position. LOD 0 and 1 are about all you need for any kind of mouth movement or eyes moving because at a distance you won’t see it and there is no point.

Whenever you move the camera from LOD range to LOD range it will call four times for each each mesh. Essentially UE4 will need to calculate 4 LODs to make the previous level disappear and then call four more to appear for the new LOD range.

In short within your model you will need to optimize you LOD’s and then look into optimizing your culling distance so that you won’t try and calculate high detail and movement across zoomed out distances on your mesh.

Thanks,

Hey Bailey.

It looks like you almost did not understand my issue.

I set up another example.

64 meshes stand in line with sun shining on their back.

I look at all scene and FPS is fine

http://puu.sh/jg2Fp/ec9e7c7857.jpg

Look at meshes around and FPS is fine

http://puu.sh/jg2Hb/3498bef36a.jpg

And when I turn back to the sun FPS cuts twice

http://puu.sh/jg2J6/3fe391eb7f.jpg

In other way then I look from the tail FPS is bigger than from the head

http://puu.sh/jg3sW/74d6678929.jpg

But anyway thanks for reminding me about mouth parts. I completely forgot about them.

Hey Whiz652,

I will link you to some documentation on optimization. There is a really good tutorial on youtube and then documentation has some really nice stuff as well.

At this point this is a workflow/optimization issue and not a bug. I will be moving this out of bug reports.

Links:

Thanks,

Hey Bailey.

I saw these links before and looked through them now. But I totally don’t understand why looking the same direction as the light makes dynamic shadows processing time so much longer.

Thanks,

I noticed that shadow processed for all meshes that behind me in case i look the same way as the directional light. It’s made to shadows of behind meshes not disappear when you look the light direction.

I was quite puzzled about this because I saw such effect of disappearing shadows in many games before and thought in another way about this issue.

Hey Bailey.

Big thanks for replying me.

At the end of my question here. Is there some way to set shadow culling for object without touching whole shadow render distance? Something like having different shadow render distance depends on it relative location for groups of meshes. Like characters have 6000 render distance if they are in front of me, 3000 if they are behind, architecture have 10000 in all cases like this…

Thanks,

Hey Whiz,

Not a per instance basis on directional lighting. Essentially what you are asking for are lighting channels which breaks PBR. Therefore, unless you were willing to touch code there is no way with Directional/Area/Sky Light.

On a point or spot then you can change the fall off fields which give you slight control but that is the work around at this point.

Thanks,