Blueprint procedural generation and LODs

I’m generating different stuff procedurally using Blueprint system. I’ve set up random mesh and material picking from the array variables. Everything works correct until I implemented LODs of my meshes. The material early applied randomly, gets replaced by the material from the mesh LOD.

How to handle that correctly?

Thnx!

You probably need to reapply the materials for all LODs. So if you mesh has 3 materials and 3 LODs, you need to do a nested forloop. The first outer loop should be from 0 to numMaterials-1, and the second, inner loop, should be from 0 to numberofLODs-1.

Then when you assign material using the loopbody of the 2nd forloop, the index needs to be the result of loop2 index plus (loop1 index * numMaterials)

That is untested but should be fairly close. Probably a wrong 1 offset somewhere in there…

What should I set material to? The SetMaterial node doesn’t have any LOD pin.

To the choice from your list of random materials.

LOD index works like this. If your mesh has 3 material IDs and 3 LODs (same as above example), it will have 9 total material IDs. It just multiplies the material IDs by the number of LODs.

To the method above is simply a way for you to pick 3 random materials and repeat their assignment as many times as there are LODs. You may want to first pick the random indicies and store them out beforehand to make sure the random choice doesn’t keep changing.

Oh, I get it. Thanks, that was a very useful tip!