Fastest Unlit Material, shared geometry


I’m using a StandardMaterial with disableLighting=true, but I was wondering if that is officially the best way to use materials for 2D games (where performance is key, and no shading, shadowing, etc will be used)?

Also, if I have multiple Planes created with the MeshBuilder (updatable defaulting to false), will the engine take care of only creating the buffer for the plane once (as opposed to a 1000 buffers if I have a 1000 planes)?

Thank you!

1 Like

hey and welcome!

For unlit: Yes, StdMaterial with no lighting is the fastest
For geometry sharing, you have to clone the initial planes (plane.clone()) or even better use instances if you can: Use Instances - Babylon.js Documentation

1 Like

Thank you! In my use case, I have multiple planes with different materials (each having a different diffuseTexture). Is there some kind of instancing even in this scenario, maybe via texture atlases?
Out of curiosity, what’s the effect of the updatable flag, how does the engine use it?

Maybe in your case (texture atlas with a single material), this could help : Solid Particle System - Babylon.js Documentation

1 Like

It indicates that data must be store in the AGP section of the memory (where both CPU and GPU can access it)

It’s getting a bit offtopic but I’m still curious.:slight_smile: How do you have control over that via WebGL(1)? Is it just about the “usage” parameter of the bufferData method or something more involved?

nope only through usage, it is a hint for the system