Disable rendering of object, but keep shadows

Enable Hidden Shadow under Lighting settings of the mesh.

2 Likes

Hey!

I would like to create shadows on my buildings by using certain objects. I don’t want these shadow casting objects to be visible though. I only want the shadowing.

How do I do this?

Thankful for an answer!

Hi Slemnils -

There are two ways to achieve this effect. One is under the objects rendering options disable Render in Main Pass. This will keep the shadow but remove the object from the rendering pass.

The second method would be to Check Hidden Shadow to true under lighting and check Actor Hidden in Game under rendering. This will leave the actor visible in the Editor but only the shadow will remain when you play the game.

Thank You

Eric Ketchum

2 Likes

This is not working on 5.1

3 Likes

Tried on 5.1 and it works.
Try enabling the “bHiddenShadow” and use the function “SetVisibility” to make appear/disappear the object runtime.

1 Like

This is the exact effect I’m trying to create.
I’m really green on UE5. Can you point me in the right direction for exactly what “enabling” a parameter like “bHiddenShadow” is and how to use functions on an object?
Thanks!

Sure @boboman42 !
The concept is pretty simple and it’s fundamental for any programming language out there.
You have PROPERTIES and FUNCTIONS.

Properties are pieces of data used by your game. For example, your health can be a float parameter, a float is a decimal number like 0.0 .
There are other types of parameters, one of them is called boolean, or bool, and it can be true or false (1 or 0).

In this case “bHiddenShadow” is a property of the class UStaticMeshComponent, that means when you select your static mesh actor and go to the “Details” pannel, you’ll find that variable there. Enable it by clicking the checkbox!

Now, the actor knows it must keep its shadow on when the cube is hidden, but you have to hide it!

You have two options to achieve this:

  1. You can just modify another property called “bActorHiddenInGame”, and the actor will automatically be hidden when your game starts


  2. Script your event by using blueprint nodes (which are FUNCTIONS)
    image

Here’s a great tutorial you can watch to begin with: Begin Play | Blueprints | Tutorial

And here’s a little tip for the future: when you see a variable starting with “b”, that’s a C++ convention to indicate a boolean parameter, but most of the time, due to engine customizations, that initial “b” is removed, so you’ll need to look for “Hidden Shadow” on the editor if you read “bHiddenShadow” around.

I hope this will be helpful and welcome to the community!


This node (Shadow Pass Switch) could also work depending on the purpose of what you’re trying to do. It helps mainly if the object will need to be visible sometimes because you can change parameters for the Shadow Pass independently but still hava control over the Object’s Opacity in Real time!

This node allows you treat object and shadow independently.

1 Like

how about receive shadow only from other objects…

1 Like

By using the ShadowPass Switch you could use the Opacity of the Shadow as 0 and the remaning of the Mesh would still receive shadows but would not cast any until you change the value. But at this point you would get better results if you only deactivate the “Cast Shadow” option in the Mesh Detail panel.


How can I insivible background and keep the shadow of the tank?

1 Like

I need to do the same: Cast shadows on an invisible object.

Should i use composure?

I need it for render pourpouse, not for realtime…

non of that works in 5.3.2.

Actor hidden in game with with hidden shadow option, just hides without casting shadows.

disabling ‘render in main pass’ makes it a mask, but still visible.

Does anyone managed to find a solution in 5.3.2?

Can use the shadow pass switch with opacity mask in the material.

Make actor invisible. Turn on Affect Indirect Lighting While Hidden (5.4 feature).

Default settings:

With settings applied:


image