Hello forum!
First post here, and I'm starting off with -probably- a newbie question:
I'm trying to optimize an experiment that uses a lot of textured planes, cloned with createInstance, but I'm getting weird z-sorting issues - as you can see here:
http://rocketclowns.com/canvas/babylon2/
The leaves are created with createInstance, like this:
var leavesMaterial = new BABYLON.StandardMaterial("leavesTexture", scene);
leavesMaterial.diffuseTexture = new BABYLON.Texture("textures/viny_leaves.png", scene);
leavesMaterial.diffuseTexture.hasAlpha = true;
leavesMaterial.useAlphaFromDiffuseTexture = true;
var leaves = BABYLON.Mesh.CreatePlane("plane", 75.0, scene);
leaves.scaling.y = 0.71;
leaves.material = leavesMaterial;
for (var l = 0; l < 128; l++) {
var newLeavesInstance = leaves.createInstance("iLeaves" + l);
newLeavesInstance.position.x = 32 + Math.random() * 96;
newLeavesInstance.position.z = Math.random() * 256;
}
Am I overlooking something that causes the weird z-sorting behaviour?
Many thanks in advance