Download

Is it possible to "merge" different static meshes at runtime?

Hey everyone!
I’m developing a procedural city consisting of ‘HouseActors’ that generate diffent static meshes (floors, ceiling, doors and etc) for each house.
Righ now, everything is working. My problem is that, it gets too laggy. Since I have a lot of houses in the map.
So I’m trying to merge all those static meshes into an instance. And I think is possible, because foliage in UE4 can support differents meshes into ONE hierarchical instanced mesh.
I’m wrong about that?
Can someone help me? How can I do something similar to this?

You’re right. For each part, you only need to make one HISM mesh, from then on, you just add an instance of it. It would make sense to have a kind of manger actor that creates the HISMs, then your spawning actors never actually need to make ( or include ) a mesh, they can just get the HISM ref from the manger, add an instance, and set it’s transform in world space.

1 Like

Hey! Thanks for the fast answer.
So would I need to create a HISM for each part of the house? Wouldn’t it be possible to merge the whole house in one?
My doubt is that in foliage, for example, you can join several types of trees and plants in a gigantic instance.
Is there any way to take all these different static meshes and merge them into one big static mesh?

What I’m describing is how the foliage system works.

You can only instance one mesh for each HISM, when you want to instance another, you need another HISM.

Let me be a bit clearer. You need one HISM for all the floors ( for example ), together. In other words, you make one HISM, and then all the actors can use that to instance their floor.

Oh! Ok. I got it! I’ll try that right now!
Thank you very much @ClockworkOcean!

1 Like

Strangely enough, I’m doing this right now. This cliff face is in fact ONE rock:

and the plants on the front, are just one, other mesh.

1 Like

I put the rock on a spline I wrote:

and then

spline

For each mesh, you make the HISM ( and set the mesh ) - ( only ONCE for each different mesh )

then make the instance and set it’s position:

image

image

You might wonder why I don’t just set the transform when I add the instance? Answer: it doesn’t work, but correcting it afterwards does, so ok…

3 Likes

Oh! That’s a really nice use of the feature! :grinning:

1 Like