Spawn / Destroy actor with lighmaps and apply material from menu

Hello every one

I am currently working on a virtual Exhibition room that mainly focuses on washbasins

In this application I have created a menu were the user can change the material of a washbasin model, the problem is that I also want the user to be able to change model and preview them with different materials from the menu list.

The Ideal solution would be if I could build lightmap for each separate model and then simply destroy and spawn them but as far as I know this is option dose not exist. I tried creating different levels so I can toggle visibility but I cant find a way to apply materials to a model I just spawned from my menu. Hopefully all this makes sense.

Any help would be much appreciated.

Hi!

Lightmaps, Shadowmaps and Lightcaches not stored in objects.

UE4 merges all of lightmaps and creates atlases. These atlases are stored inside the file of level.

Probably you need to adjust lighting parameters and create Lighting Cache with properly density.

This is a simple example. We have two static meshes and one movable object. All objects have the same material. As you can see, they are very similar. Even if we rotate this movable object.

If you enable in viewport Show->Visualize->Volume Lighting Samples, then you will see samples of the light cache after build lighting.

If you need more detailed lighting for some objects, you can use Lightmass Character Indirect Detail Volume.

I mean, that there is no need to created the lightmap for each object. UE4 lighting system is very powerful and flexible.

Thank you so much for your reply and I want to apologize for my delay.

I spend the couple of days trying everything you showed me and to be honest the results were quite good but still in my perspective I was not satisfied, I also use a couple of IES files and having them cast Dynamic shadows made the hole scene run slower.

Finally I did find a solution to my problem, I just created several levels each one containing a washbasin model and I also created a Static Mesh Actor Array, in each level blueprint I used an Insert array command and populate the array with the models. Finally in the UI I linked level visibility to the model buttons and it works just fine!! :smiley:

It was a bit troublesome but at the end I managed to do it, if any one needs more details just let me know I am more than happy το post more info. :smiley: