Exclude static mesh from lightmap or reflection probe

If we have objects that we want to show up in reflection probe builds, we have to set them as static. But this also means the objects will cast and receive lightmap shadows. How can we separate the two features?

If it’s possible, it would be great if we had two new options on meshes: “Generate lightmap” and “Visible in reflections”.

Well, I found the “Visible in Reflection Captures” checkbox under the rendering tab, so that’s one less item to worry about. Still, I still can’t find any way to turn off lightmapping for static objects.

Hi Simon,

To control whether a static mesh component casts shadows, use Lighting → Cast Shadow ( UPrimitiveComponent::CastShadow ). If this is unchecked, the primitive will cast neither dynamic nor static shadows. To enable dynamic shadows without static shadows, check Cast Shadow and uncheck Static Shadow.

To control whether a static mesh receives shadows, the simplest way is to make the material Shading Model Unlit. UE4 doesn’t currently support casting shadows without receiving shadows. We have an open feature request to support this, but it is not scheduled to be implemented:

UE-18048 - Disable Receive Shadows while Still Casting Shadows

Does this answer your question?

Best,

Josh @ Epic

Hi,

Yeah, the thing I wanted to control was if the mesh should receive shadows. Here are some examples where this would be useful:

  • If we have decal textures applied on plane primitives in our level. We want the decals to be shaded normally, and we want them to show in reflection captures, but we don’t neccesarily want them to receive lightmapping.
  • If we have a bunch of spotlight models in the roof, we want the emissive material to show in reflection probes, and the chrome material to be shaded normally, but we don’t want lightmaps to be generated for every single spotlight.

For the decals, we solve it by first setting them to movable, then building lighting. When it’s done, we set the decals to static, and recapture the reflection probes.
For the spotlights, we have to set them to static and just set the resolution to the minimum of 4. This isn’t optimal, since we can easily get blotchy shadows. Also, since we have 250 spotlights in our scene, we still calculate 4000 pixels (4^2*250) even though we don’t need to.

I’d love to see this feature implemented, since it allows for much more customizable lighting setups. Thanks for taking the time to go through this :slight_smile:
/Simon

Hi Simon,

Thanks for the use case examples. I’ve logged them along with the existing feature request.

In the meantime, There are a few other approaches to achieve the behavior that may be worth exploring.

You could put the objects you don’t want receiving shadows into a different lighting channel (this can be set on a mesh instance from the details panel under Lighting). You may then need to adjust the emissive value on the mesh’s material to make it look right.

Alternatively, you could create a sublevel for the un-shadowed objects, and hide that sublevel when building lighting.

Please let me know if there is anything else I can answer.

Best,
Josh @ Epic

Okay, perfect. We’ll try those and see where we end up.
/Simon