Capsule Shadows Intensity

Hey guys,
quick question:
Is there a way to controll the capsule in/direct shadows i’ve created with the physical asset? Like playing around with the intensity stuff like that.

Thanks for help!

You can use r.CapsuleIndirectShadowMinVisibility to control the visibility of the capsule shadows. The default value of 0.1 will be darker than a higher value like 0.55.

There are some other settings you can use to adjust the look of the capsule shadows as well that you can find if you open the output log and put in r.Capsule you will see the others listed. If you’re not sure what they do you can put in, as an example, r.CapsuleIndirectShadowMinVisibility ? and you’ll be given the tooltip description to help you know what it’s supposed to do.

If you’re unsure or have questions feel free to post back. I’ve used them quite a bit and can offer some help. :slight_smile:

Great!! Thanks so much it works! :slight_smile:

but quick question again :slight_smile: i changed the values in the output log. but when i started the standalone game the values got reset to default :confused:
how can i fix that?
thanks!!

Setup a device profile with the variables or add them to the consolevariables.ini file specifically for your project.

Tim, is there a solution to the problem capsule shadows have where they behave very erratically in buildings with multiple windows? I think it’s because they can only cast one shadow at a time, so it moves around depending on where the brightest light/window is. Any chance they could be set up to cast multiple shadows, or something like that?

Caspsule Shadows use volume lighting samples (indirect lighting cache) to interpolate the directionality of the capsule shadows based on light intensity. The shadowing takes the lighting sample and casts a cone in the direction of the capsule to generate these shadows. This can sometimes cause an issue like you’re seeing based on the placement of that sample when you bake the scenes lighting.

Here’s an example using just a stationary skylight with two light sources evently spaced out for the room. The chracter is centered to the room.

Top Image: here the lighting sample is offset from the center of the room. So this leads the dominant opening to be the right opening so the shadowing casts to the left.

Bottom Image: The lighting sample placement has been adjusted via the world settings and aligns more to the center of the room in this example. You can see that the shadowing is now more evenly centered for the capsule shadows.

Here’s the documentation on the indirect lighting cache if you’re not familiar with it: Indirect Lighting Cache in Unreal Engine | Unreal Engine 5.1 Documentation

So that there isn’t any confusion with volume lighting samples. These are generated when you build lighting. The samples are placed via this process. These samples cannot be manually placed and when I did the example above the Top image is using the default Volume Sample Placement (world settings > Lightmass) of 1.0. I tweaked this setting for the bottom to be 1.25. All this does is adjust how dense the placement is (low values) to how spread out the placement is (higher values). If you use lower values to get more samples the interpolation between these samples can cause the capsule shadows to flicker and be irratic. You may need to adjust this and try various values to see how this will work for you. Also, adjusting this value will affect how any movable object is lit in your scene by indirect lighting samples regardless of them using capsule shadows or not.

Thanks for the explanation, Tim. Is it likely that we’ll ever be able to place samples manually?

Also, would it be possible to lower the visibility or hardness of capsule shadows for characters in a volume (like inside a building), while keeping the settings the same outside that volume? That way I could “soften” the capsule shadows of characters indoors to the point that it’s not noticeable when they flicker around, but shadows outside the building would remain unaffected. Or do all capsule shadows have to use the same settings at the same time?

I don’t see anything changing with the way the indirect lighting cache is placed or doing this manually. The BaseLightmass.ini file controls the grid placement for these and spacing, but that’s nothing that can’t already be changed via the editor’s World Settings > Lightmass > Volume Samples Placement setting.

All the console variables for Capsule Shadows can be changed during runtime. If you need different settings for indoor and outdoor environments you can use a trigger to set new values when entering/exiting areas via blueprints and an execute command node.

thank you so much! that helps!
One more question is. How can i optimize all that for mobile?!?

Capsule shadows are only supported for SM5 so this particular feature isn’t supported on mobile.

shadows

and capsule shadows in general? i thought they are supported in 4.13 :confused:

They were supported starting with 4.11 but have only ever been SM5. As of 4.13 they are now support for VR, but that’s only for SM5 supported VR.

ok thank you :slight_smile:

4.14 will have a CapsuleIndirectShadowMinVisibility setting on skeletal mesh components so you don’t have to set a cvar.