So what the point to use it? I am asking because I have a huge ship in Max and I want to find the right workflow to add it in game
The easier way to do it is straight from Max in one huge object, but this is probably wrong way in terms of performance but after this test I am not sure about it
Or maybe I am missing something?
I am guessing we’re talking about instanced static meshes here;
In terms of vertex processing (amount of polys / vertices) you won’t see any difference when looking at the entire scene. The biggest difference you should see (or actually not see) is Drawcalls. With mesh instancing, they should be equal to the drawcalls of one large mesh that has all polys combined. Without instancing, each of these assets create their own drawcalls. Subsequently each new assets drains your CPU. For some reason this does not seem to work in your setup, otherwise your performance would be equal.
There are stat tools that help you visualize this (stat units being one of the high level tools to track it down).
Now the reason why this is done: When you create the entire ship in one mesh, it will always be rendered entirely, unless you look away from it. Down in the cargo hold, you’d still have the engine room and bridge rendered. That is why you split the mesh up into chunks that make sense (cranes on top, bridge separately, etc). The renderer can then decide to skip objects that are outside of your view, they won’t be rendered. This does work for instanced meshes and separately added static meshes.
Bottomline: I’d check your setup and figure out why performance is not equal
You are right, I have spend some time, looking for the answer
It turn out that UE4 by default do not combine all instanced static meshes and it can only be done with an InstancedStaticMeshComponent.
That`s explain why I am getting worse performance with a lot of istanced meshes because they have more draw calls than one huge mesh
Another question about instancing and Draw calls
Here is the situation, you have 1 mesh with 10 mat ID`s and each id have their own material but this material is instantiated from the main mat
How much draw call we will have? All this Instanced mats will be treated like one in terms of Draw calls?
This is not true. Static meshes aren’t duplicated in memory. In both cases there is just single static mesh in object space at GPU memory. This mesh is then transformed at vertex shader to world space. Only difference is that without instancing each mesh is drawed with single draw call and transform is send to GPU(16floats). With instancing draw call command gpu to draw same mesh multiple times and current transform is indexed from array using InstancingID.
4.6 added allowing the changing of scalar or vector parameters in materials, but does that apply to a packaged game as well? That also doesn’t apply to Texture Parameters or Static Parameters.
The performance isn’t equal because Instanced Static Meshes are different from the editor-default instances of a static mesh.
To make use of Instanced Static Meshes, you’d have to make an actor blueprint and add the meshes as Instanced Static Mesh Actors and add the instances manually there.
So that’s why the framerate is poopy.