Mesh rendering micro-optimization question

Hi guys

A quick question! Regarding setting up character skirt mesh in Blender:

From the micro-optimization perspective which one of these options will be more performant? And curious to know which one would you select in your case?

(Suppose that the whole character has a single diffuse texture)

1- Make the skirt a separate geometry, then only in the skirt material settings, disable the backface culling so it will be visible from both sides.

2- Duplicate skirt mesh and flip the normals then join them all into the character body mesh so you have only a single geometry then enable the backface culling on the material.

I guess option 2 will be slightly faster but I am not sure. I’m interested to know your opinion about this.

Regards

My guess is that it’s a time versus space trade off. The yin and yang of programming.

If it were me, and I were really that concerned… then I would test it with 500 characters on screen… or whatever number starts to make things sweat.

But from experience, whatever makes the asset pipeline easier is probably the better bet in the end.

2 Likes

Thanks

I do have one more question!

On character models, is it a good idea to join the transparent parts of the mesh (that needs alpha discarding) with the opaque parts when possible (i.e when they use the same texture) to reduce draw calls, or I better keep transparent and opaque parts separate?

One draw call versus two… but depending on the amount of transparency it still could be an even trade, I guess.

I would tend to split them out but that’s because I often find the need to tweak shaders that use transparency to not do dumb things when farther away. But I have also experienced cases where transparent rendering on some cards was a real pig… but this was 8+ years ago now.

1 Like

but do this skirt gonna be animated or have physics? (when close to your character)

if it gonna use Minie cloth physics for example, it cant be dupplicated.

1 Like

No cloth physics, only bone animation.

Didn’t know this. Thanks for the hint.

Also, on some level it’s good to have some of these “maybe” optimizations in your back pocket for later. The swapping is easy enough later if it turns out to be worth it.

It’s nice to have this list of things that might be performance wins down the road. Keep development easy now and then look forward to being able to boost performance a bit when things are feeling like they are dragging and then get a nice win.

…though on this topic, I really doubt it will sway things significantly one way or the other.

Anyway, by leaving these potentially easy wins for later, I usually figure I have at least a 10% and sometimes 20% improvement waiting for me when I have time to go and implement all of them. In the mean time, I get closer to a working game and keep things simpler.

2 Likes

Yeah, I am listing them down for later. I am still on the hardware from 10 years ago so there is a chance that I might need them :slightly_smiling_face:

Thanks for the help.

1 Like

Is alpha blending cheaper than alpha discarding(alpha test)?

Like many things, I think “it depends”.

My understanding is that “discard” prevents certain types of optimizations but I don’t know how significant that really is. And if you discard early and your fragment shader is otherwise doing a ton of work after then to me discard could be better.

…but even then, it’s hard to say if the ‘discard’ would be immediate in terms of calculations or would be on a parallel branch.

And older cards will behave different than newer ones, blah blah, etc.

1 Like