I’m relatively new to UE and currently working on a mobile racing game. I chose using spline actors for building the track and its environment (fence, pillars, rocks on the roadside etc.). For the most part I used the methods described in this live training video.
Recently I started thinking about optimizations and pulled up some stats to check current state of one of my levels. What I’m trying to understand is:
Why stats window and “stat rhi” cmmand shows different values (screenshot)? Triangles count and Primitives draw calls differs too much.
The other question is instancing. I see that the stat window shows how many instances of a certain mesh is drawn. But the thing is that I’m using “Add Spline Mesh Component” in my BP, not “Add Instanced Static Mesh Component”, because it’s impossible to use for my needs. Does that still mean that the Spline Mesh Component is still being instanced even if it’s not described anywhere? I will be very happy if that’s so, I’m using Occlusion Culing and it works perfectly with the modular built track.
Hi, thanks for reply. Besides using further method of optimizations, like LODs, I’m trying to understand how the things work in UE, more specifically I’m exploring how the static meshes, which I add to my spline mesh component are beign drawn by the engine.
Here’s the thing. I’ve created a simple scene with my spline actor and added a fence mesh in it. Now I’m trying to measure draw calls which doesn’t differ so much whether there are hundreds of meshes or just a single one.
The thing which confuses me is that there is an Instanced mesh component exists, which I don’t use in my blueprint, instead of it I use this piece of code:
You’re completely right, didn’t notice how I missed that
I see a significant improvement in draw time. Thanks for the hint!
Now I need to understand how to bring back mesh randomizer through the spline for my BP, because currently it picks just a single random mesh from the array and instantiates it.
It’s basically the same concept for mesh randomization. You only need one ISM for each random mesh, the rest are instances.
If you put the meshes in an array, then you can make the ISMs in another array, and refer to that as you place the instances. The only random thing you need then is an integer.
good example thanks, but how to make the whole list of added meshes cyclically repeated, and not randomized? Do I need to somehow add or multiply the index of the spline and the array? sorry i’m a noob
Friend, I am very grateful to you, I haven’t slept for the third day because I was very annoyed that I couldn’t think of it and find at least 1 example of what I need, you’re just a master, thank you so much, it works!
I decided to apply this method of arranging meshes for the spline mesh component, everything works, but only if the length of the meshes is approximately the same, and if they differ greatly, then the mesh is either strongly compressed relative to the previous one or strongly stretched forward along the axis, is it possible to somehow specify the length for a particular mesh by index from array? Thanks, sorry if I’m distracting you
The method I outlined above, will not stretch or squash. But you can have two array, one of meshes, and the other of how far to move on after placing each mesh.
the method you suggested is very good for arranging simple meshes or instances along a spline without deforming the meshes themselves. And I’m trying to apply it with spline deformation through the “spline mesh component”, as I understand that the principle of placement is different there. It seems to me that for each mesh from the array there should be a separate “spline mesh component” so that each one can specify a specific length along the axis, otherwise all meshes from the array added to one component are divided by the same number from the total length of the entire spline and since in my If they have physically different lengths, then one is stretched and the other is compressed. I need to somehow add the beginning of the next one to the end position of the first component of the spline mesh, and so on, and assign a mesh from the array and a length to each component … I guess so, maybe I don’t understand correctly
i tried using points as one of the ways that can work, but editing the spline itself becomes kind of hell, it becomes almost impossible to give the spline the correct geometric shape