Download

ProceduralMeshComponent and lighting computation

I’m new to UE4 and I’m messing around with the ProceduralMeshComponent.

I managed to load an obj file using Assimp library, loading any textures associated to it and displaying it in the game; all of this at runtime. It works and looks nice. In the image below I’m loading an obj found on the test meshes of Assimp library.

a49874cd76cc8de14733cd2033a991586e3b97bb.jpeg

Now, I was wondering, how does loading a previously unknown mesh at runtime affect the lighting and shadowing of the object and the objects around it? In the editor there is a “Build” button to build lighting, but it needs to have all the components already in the editor to make a proper build. So, what happens when loading a mesh at runtime? Will it “break” the lighting, will it look inconsistent?

If so, is there a way to build the lighting at runtime via C++? I don’t care much about loading times at runtime, I would need to do it one time only at the beginning.

Sorry, I’m bringing this up again because I still can’t find the anwser.

To me it appears that the objects look nice in the environment, but I’m worried that something might come up later in development disrupting the flow. If someone with more experience come along I would love to know more!

Generating a mesh at runtime will produce a dynamic mesh (similar to the “Movable” setting on an Mesh actor). Dynamic meshes don’t require lighting rebuilding. Instead they rely on the existing lighting to get lighted properly (shadow and GI). Skeletal meshes work the same way for example. I suggest to take a look at the documentation : https://docs.unrealengine.com/latest/INT/Engine/Actors/Mobility/ and https://docs.unrealengine.com/latest/INT/Engine/Rendering/LightingAndShadows/IndirectLightingCache/index.html

Thanks a lot, it’s exactly what I was looking for! :smiley: