Build lighting dynamically when switching mesh

I have a project where the player is able to switch the mesh for an object during runtime (the player selects the object and changes it’s mesh and texture). When the mesh is changed, the lighting for the new mesh is not built, so the new mesh doesn’t appear as it should. Here’s an example of the object with lighting built (left) and with lighting not built (right):

Is there a way to rebuild lighting for the new mesh during runtime?
If not, is there some other way to do what I want? (maybe setting the object’s and light’s properties so that the lighting for this objects is always calculated dynamically)

The level has one directional light and around 10 point lights.

As your chair is a dynamic object I believe it has to be set as dynamically lit. What you could do (if was me) is to make the other objects that can be modified in real time also dynamic. This will mean they all look the same when switched. What you can then also do is adjust some point lights near by to remove the blue tones and make them appear like the chair to the left.

Try and also find out what is giving that chair a blue tone? Could it be your skylight?

Thank you for the answer.

How do I make set the objects to be dynamically lit?

Select all the objects that can be edited at real time and set their lighting to movable - you will then need to adjust point lights to get them the colour you like. They no longer will need to be built and the colours will all be the same :slight_smile:

How do I change the lighting to movable? Do I just change the Mobility to Movable, or something else?

Do I also have to set all the lights to Movable?

I have made some progress…

I have set Mobility of both the Skylight and the editable object (the one that allows switching meshes) to Movable.

Now when switching meshes in runtime the lighting for the new mesh gets calculated dynamically - so this works.

But I have another problem. After I set the Mobility of the Skylight from Stationary to Movable, the overall lighting changed. The colors on every object are in a little bit more cold tone. See sshots…

With Skylight Stationary:

With Skylight Movable:

Why is that so, and how can I fix it?

Also when I changed the Skylight to Movable, the reflections on some object got lost.

With Skylight Stationary:

With Skylight Movable:

Is there a way to fix this?

Hi there glad you managed to sort the dynamic furniture sorry for the late reply.

Hmm can I ask why does the skylight have to be movable? I think the only things that need to be movable is the dynamic furniture. Things like skylight and other lighting that is going to be baked can be left as stationary. Only reason we have changed the furniture to movable is because we don’t want the lighting to be baked and they are dynamic.

Also if you found one of my comments helped you please mark it as answered :slight_smile:

Hi.

It seems like the Skylight doesn’t have to be movable in order for this to work. When I first tried setting the objects to movable it didn’t work, that’s why I thought I have to change the mobility of the Skylight. But at that time it didn’t work form some other reason (I did something wrong with building lihghting), and now it works even with Skylight stationary.

So to sum it up, changing the object’s Mobility to Movable makes it have the lighting recalculated dynamically in runtime. In some cases rebuilding the lighting is necessary for this to work.

Also, I found out that the lighting quality makes a huge difference in this project, and only when building lighting with production quality it looks as it should.

@ergoproxy Thank you very much for your help.