I have a blueprint set up that has 2 sets of meshes. When the player clicks on a collider, these two meshes switch. So if meshA is visible - click mouse - meshA moves and meshB becomes visible and vice versa. The objects are just moving local positions.
I would like these meshes to have static lighting. Simple enough, I just enable static lighting. However, because the objects are overlapping technically before the game begins, they cast shadows on each other during light calculations.
How can I render lightmaps of these objects without the overlap?
If this is not possible, what other strategies can I try?
Thank you!
Okay, based on research, this is not entirely possible. I tried looking for alternative ways to do this, so here’s some food for thought:
- I thought about moving the objects to another level, baking them, and somehow having them stream on loading? Did not try this, but based on everything I read, this would not work. I would need to figure out how to switch specific parts of what loaded / what didn’t. Seemed like a lot of effort for something that may even not work.
- Literally copy everything off to the side, lights / objects / everything, build it, switch those two moveable objects. They would have the right lighting / look, but this seems like overkill. I would be duplicating all light calculations, but it would work in theory. I would also have it switch floor locations so the shadows would move appropriately as well.
But seriously, do I need to do this for something so simple?
So what I ended up doing to achieve an okay look with all the parts / pieces I had in place:
- Set all the moveable objects to “Light as if Static”
- Turn off “Cast Shadow” for these objects
-
“Use Ambient Occlusion” was left on in World Settings (some people said to turn this off, but I think it made it look worse)
This means the objects can overlap and sit on each other, be lit as a static object, but not cast shadows on each other. The two objects can switch places, look reasonable, and not cast weird shadows.
Unfortunately, they are still lighter than the static objects (but not as bad!). I wish I could have been able to unify everything cohesively and did this differently.
Being able to make an object invisible to light build would be an awesome tool to achieve these sorts of things. I could build an object, hide it, build the other object, and they would switch perfectly and look great even when occupying the same space.
Hope this helps someone else!