Jump to content

Optimization of identical objects


photo

Recommended Posts

Hi all, 

I am trying to optimize my project for better performance. Currently I have a lot of draw calls (up to 4000+) which I know is not ideal, but this is mainly down to two things.

1. Many skinned mesh flags. I am only using one identical mesh and animation file for all flags and I have copied many times in my scene (about 1000 draw calls).

2. Small fire node from the vfx add on to simulate multiple candle lights (about 500 draw calls)

 

Is there a way to combine or 'cluster' these objects so they can batch together, reducing the number of draw calls? Attached are some screenshots for reference. I know I have a lot of rendered triangles too, I need to optimize shadow distances etc etc.

image.thumb.png.d33016d18ea5917662fbeeaf808a3af2.png

image.thumb.png.02c350e7ae154c9c669659b7f67342cc.png

 

Thanks for any help!

 

Ben

Link to comment

Hi there, 

I always thought objectcluster is only for static meshes or can you use for these other objects? These objects are particle nodes and skinned bone meshes.

 

Link to comment

Hi, Ben. As I understand, you've used separate particle systems for each candle. It's pretty unoptimized. I suggest you to put a simple plane instead of particle system and use some flipbook texture with animated fire. But this requires you some knowledge of the material graph. You can find a lot of tutorials on how to create flipbook animation via material graph. It's actually not that difficult. This way  you get rid of a lot of particle systems.
As for the flags, what you can do is to use vegetation approach. You can see some example of vertex color animation in our demos and samples. The second way (if you really want to use this skinned animation) is to bake this animation into a texture and then use it with some custom material. Again, you can find the example in our vertex_animation sample.

btw I've just realized that you can actually try to avoid the part with the candles. You can use a mesh as an emitter for one single particle system. I would try to create a single mesh (for example little planes just the same size as candles) which represents all of the candles and use it as an emitter.

Link to comment

Hi @sareth

 

Thanks for getting back to me! Can you explain a bit about the last point for the candles? This sounds like the most simple solution for me. Can you explain in detail about using a mesh as an emitter for one single particle system?

For the flags, I will have a look at the vertex animation samples and get back to you if I need any further assistance. You mentioned baking an animation into a texture - do you have any learning materials about how to do that?

 

Many thanks, 

Ben

 

Link to comment

It's pretty easy. You just choose "random" as emitter type inside particle system settings and put the system as a child of your custom mesh. 
For example, on the attached screenshot you can see the mesh (three blue planes) and all of these red particles are from a single particle system. The only problem you might face is a probable similarity of each candle. but that can be fixed via using, for example, 3 particle systems with randomly positioned meshes. But I'm not sure, maybe you won't even face this problem, you need to try it first.

Unfortunately we don't have any specific tutorial about preparing textures for animations because it's the matter of content creation. But I think you can find it out there. For example, check first result on google for  "Vertex Animation Script for Blender 3D Users"

As for the easiest approach to flag animations - just use vertex colors to animate them. You can watch the video and learn how it works here:

 

image.png

  • Like 2
Link to comment

@sareth Brilliant, thanks for the advice - enough to go on for now. What is the best way to make the flags for the least amount of draw calls? If I make one flag using vertex colour animation and copy say 200 times. Will that still require a lot of draw calls? Or if they are an identical state mesh they can be clustered together to reduce the draw calls?

 

Many thanks, 

Ben

Link to comment

Well I can't predict it for sure but I'm confident that you'll gain some performance. And yes, considering your meshes will be static, they can be clustered together.
Please let us know if it helps

  • Like 1
Link to comment

Hi @Ben_93

 

in case you need help with baking skinned meshes to a texture and use it as a vertex shader, you can ping me if interested. I experimented with instanced animations a couple while ago with some pleasant results. My custom shader was optimized for bone animations but we can make sure to help you with that as well.

Best

Christian

  • Like 1
Link to comment
×
×
  • Create New...