Placing Instanced Static Meshes manually not randomly

Hi All!

I’m trying to manual place instanced Static Meshes in my scene. I see a lot of information on randomly doing this through spawning, but I want to be able to have control of where each mesh is placed. Am I over thinking this or is this complicated. I’m placing rocks around a scene and want them to be instances but I’m going to rotate them in different ways so they look more random. Please help with any information possible.

This seems like it would be pretty easy…no takers on a simple setup?

3 Steps.

Add StaticMesh (with selected mesh).
Create an InstancedStaticMeshComponent variable and Set it using the Return Value on the Add StaticMesh node.
Add Instance, with a Target Input of your InstancedStaticMeshComponent variable and a transform of wherever you want the instance to spawn.

You add the static mesh to get it in the level so it can be copied(not sure why this is needed but it is).

Can anyone show what this blueprint would look like? I tried it but can’t get it to work. thanks

I’m interested in this as well. I have levels that consist primarily of lots of copies of the same the same two meshes. I want to get the performance as good as I can and I think something like this would be a good step in that direction.

yea, no one has responded so I’m not sure how to do this either. It would be great to find out!:slight_smile:

Hey walkinginspace

I think you may be over thinking it, unless there is some aspect of the question that I’m not getting. Make an actor BP that has the static mesh as a component and then add that to the scene manually.

When i do that, it doesn’t see any of the copies of the BP as instances…because the Instancer isn’t being called. I tried just making the BP and dragging in. I talked with another user and he said all the copies are still getting a draw call, because they aren’t instances.

Here’s what he said

"

Ok, for each copy of that blueprint you are getting a draw call on the static mesh it is spawning.

The reason instancing saves performance is because draw calls are limited by only have 1 mesh that is then copied without the same overhead.

So if you have an instanced mesh, say a Tree, you want all of those trees coming from the same blueprint. You could put other instances in other blueprints, but that really depends on what you are doing.
"

I see what you mean. Definitely an aspect of your question that I wasnt getting… :wink:

:slight_smile: There must be some way to do this. But as of yet, it has eluded me.

Make a variable of type Transform Array. Check “Editable” & “Show 3D Widget” in the Details. Add this to your construction Script.

Place the BP in your level and Select it. In the Details Panel you can Add Transforms to the Array by clicking the “+” sign. Select the Diamond shaped Widget and rotate/scale/move as you like.

1 Like

An alternative method might be placing the rocks via foliage tool. They will all be instanced and using LODs. Then using the “foliage single select” (that one that looks like an arrow) you can select individual rocks and move/rotate/scale them. I just tried it with some rocks and it works pretty well, probably not as useful for building parts and such though as I think you have to “paint” them out to start with.

What you could do is create a actor that converts all your static mesh actors into instanced meshes(and vise versa). To do this you need two custom events that can be called in editor(one for converting to instances and one for converting back to editable static mesh actors). To convert static mesh actors into instances you have to “get all actors of class” you could use static mesh actor as the class but I recommend making a new one so It doesn’t convert meshes that you don’t want to be converted. You need to get the mesh objects of all your static mesh actors and see if you have a mesh instance component with the same mesh. You know what, I’ll just post some pictures of my BP… Imgur: The magic of the Internet Sorry, I’m lazy but this seems to work so far. Only downside being that you have to click “convert to static” before editing the locations of existing meshes. Let me know if this works or not.

1 Like

Thanks for this. I didn’t know that one can enable 3D widgets for transform arrays. This is very convenient.