I understand that to create Hierarchical Instanced Static Meshes within a blueprint you can just add a HISM component and select your mesh, then just add more array elements or have them created procedurally within the blueprint. Say for example though I add just one HISM component to the BP and one array element (e.g a wall piece), if I then add 30 copies of my BP into my world, do all 30 meshes just count as one mesh? I imagine the answer would be no, and that I would have to add 30 array elements of the mesh within my BP. The reason I ask is that I’m working on walls and bushes and want to be able to place them manually as there will be many occurrences of the same element throughout the town I’m making, but spread out in patches. Similar question for my street lights, as I can’t really have them generated procedurally, I need to place them.
You’ll have to clarify the question further. You can manually place HISMs all you want in the Blueprint view-port. A HISM component has a single mesh object, any instances are copies on the GPU. Each instance can be moved individually, or as a whole by moving the blueprint object in your level. If you build something with those instances, you could export those to a mesh, then instance that mesh. This is general information that may not be applicable to what you’re asking, but I hope is useful. Here’s an introductory tutorial; UE4 Optimization: Instancing - YouTube
I’ve already watched that video a few times and it doesn’t answer my question or help.
I’ll try to clarify.
I want to make a city.
I want my city to have street lights.
I want the street lights to turn off at night.
My city is not grid like so I cannot procedurally layout the street lights within a BP.
I made a BP with a HISM of a street light mesh and a light source that turns on at night time.
I need to place the street lights manualy into my world to put them where I need.
If I drag 10’000 copies of my StreetLampBP into my world and place them where I want, will it keep 1 street lamp mesh in GPU or will it keep 10’000 copies in GPU?
a) 1 x BP with 10’000 HISM street lamps
vs
b) 10000 x single blueprint with 1 x HISM street lamp mesh in it?
a = no good because I can’t procedurally place the street lamps, a have to manually place them in my world because my city is not grid like.
b = no good if it’s going to bring the average GPU to it’s knees because it effectively not seeing the benefit of HISM by only having one mesh in the BP as HISM?
Does HISM only work if you have more than one HISM instance within a single BP, or will a single HISM instance within a single blueprint with the BP placed many times in the world work as effectively?
I’ve already answered your question, as does the video, but I’ll try to clarify further. This is the mega-short-non-technical-explination;
A normal mesh is rendered by having the CPU copy the mesh to the GPU, then it requests the GPU to draw the mesh. If you have 10k of these, it’s 10k copies and requests.
An instanced mesh is copied to the GPU once. The CPU requests all instances be drawn once. So it’s one copy, one request. The GPU draws internal copies as needed.
So if you add a single lamp post to a blueprint as an instanced mesh; the blueprint contains a single copy of the mesh. The GPU is drawing copies internally as requested without the back and forth requests from the CPU.
If all the lamps are identical, and non-interactive, this is the most optimal way to add them to your scene. As shown in the video. Attaching a light source to the mesh is another story, as it’s not a mesh.
No modern GPU should have any issue with 10k instanced meshes of a lamp post. If you follow the tutorial in the video; You’d already know this. You can test this on your own with the project files in the video description. It sounds to me like you’re asking questions without attempting to go through the tutorials.
"It sounds to me like you’re asking questions without attempting to go through the tutorials. "
No, I think you misunderstand, I’ll use the asteroid example from the video to try and give some context to my question, as you appear to have misunderstood what I am asking.
Take the asteroid example in the video, download it, fire it up in the engine, open the instancing folder and load up the Level_Instancing. There we go, we have a nice asteroid field in front of us. Looks lovely.
In the main editor viewport (not blueprint viewport) we can see all of the asteroids made up of 5 blueprints, each have hundreds of array elements. Lets take BP_Instancing_AsteroidRing5 and highlight it in the Main Editor Viewport (not the blueprint viewport). It highlights all of the members of the array. Well that’s no good if I need to rotate or move a single one them within the main editor viewport (not the blueprint viewport), because the location and rotation of each HISM will be based upon objects only visible from within the main editor viewport (not the blueprint viewport). If you try to select an individual asteroid within the main editor viewport (not blueprint viewport) it just selects the entire array.
Yes, you can select the HierarchicalInstanceSpawner, expand instances, and access the transforms that way, but when you have 10’000 array elements, and you see in your viewport that one of those elements needs moving, how on earth would you know which out of the 10’000 is the right one being selected?
The main editor viewport (not the blueprint viewport) shows all of the buildings, roads and pavements which are needed to visually determine where to move the lampposts to so they placed in the right position.
The blueprint is rotatable within the main editor viewport (not blueprint viewport), but that is only of any use if you want to rotate all 10’000 lapposts or 300 asteroids at once etc…
This was where my thoughts strayed onto whether or not you could have 1 BP with one HISM array element, and drag that one BP into the main editor viewport (not the blueprint viewport) many times, so that you would have the capability to rotate and move them all, but still maintain the HISM benefit.
You’re right of course, this is something that I can test with the project file by deleting all but one of the asteroids from BP_Instancing_AsteroidRing5 and dragging 10’000 copied of it into the main edit viewport (not blueprint viewport).
Maybe an easier more example friendly way to phrase the question would be…
I’m not misunderstanding anything. The answer to your question has been answered multiple times. It’s answered in the video, it’s answered by following the tutorial in the video, and it’s answered by the project file. Again; you can use the blueprint viewport to select and transform individual instances. You have to use a blueprint or C++ to add the component. This is covered in the video that you are clearly not watching. I’m not going to respond further.
So, if I can repeat what I think you are asking:
You have a lot of objects that you can use HISM to represent. These objects can have transformations you want to be able to manipulate in the main editor window, individually. On top of that, you’re mixing in the asteroid example.
Let’s see if I can clarify it all in one fell swoop. It all comes down to a single mesh. The HISM is a set of transforms for that mesh. You can have 1,000 of them, 1 of them, or 1 million and it’s still one mesh that’s draw that many times. The beauty of the HISM is that it’s the same single mesh’s data that is draw multiple times. That’s one HISM object with however many copies of it you want to draw. To further clarify, if I have that mesh used in 5 blueprints, it’s still one mesh.
With that said, to answer the first - I believe the answer is no, you can’t edit out-of-box the individual instances without a bit of magic. If you need massive tweaking of them, I would recomend building a system that takes placeholder objects and converts them into transformations for your HISM. I believe RAMA has a plug in that does this for you as well, and 4.22 is coming with it, or something similar to it.
" if I have that mesh used in 5 blueprints, it’s still one mesh."
I found this a bit misleading, because you don’t get the benefit of reduced draw calls if you have 5 instances of a BP, each with their own HISM component, with a single instance of the same static mesh. The instances need to be all elements of a single HISM component’s array. But if you want BP functionality you can add instances to a central HISM component in another BP, if you have the reference, using the AddInstanceWorldSpace node.