Hi BJS Community !
As you can see in the BJS playground below, I instanciated panels, trying to get only 2 drawcalls like in the forest example[BJS documentation]. I have done evething like this. But as you can see in the screenshot, at list 40 drawcalls remains for my instances
Actually, there are exactly 1000 draw calls in your PG.
The reason is that instances with a world matrix where determinant is different than root mesh world matrix will be rendered separately (like a regular mesh). This mostly happens when the sign of the scaling vector is different between an instance and the root - as in your case.
To overcome this just set null parent to the mesh - https://playground.babylonjs.com/#4I8BA5#5
Catch 20. Diving into the document and better still, diving into code allows a developer understand the engine in the best way. This is why code commenting is important. It becomes a requirement for quality and complex projects. The more documentation we have, the more an average user reads through so there’s a balance to be made.
I have to disagree with you. … or better said extend your comment, saying
…that’s precisely why we have this forum (and this community packed with very skilled members (not me ) willing to answer for free 24/24 and 7/7). If we would put everything in the doc, would you read it? (I wouldn’t). If the inspector or the scene would check on everything, wouldn’t it just become a mess, you would all disable in the first place? Just asking…
Come to think of it. This is the code in question:
//scene.meshes = [gltfRoot, myActualMesh];
myActualMesh.parent === gltfRoot
gltfRoot.scaling.x === -1
myActualMesh.scaling.equalsAll(1)
//^^^created as is by Babylon
myActualMesh.createInstance("i2"); //<- fails
An imported gltf/glb file always comes with a root node by default. This root node has negative scaling.
Even if you have a perfectly normalized mesh/mesh hierarchy, the gltf node, that Babylon automatically prepends by default, will cause instancing to fail.
Differently and directly put, Babylon screws you over without you doing anything. So maybe add a warning in the loader - if it is the gltf root node that causes the determinant difference?
The problem is the perf here. Any warning needs us to check beforehand and thus perf is impacted.
This case is complex because if you create your instance and give it the same parent then no problem.
Initially I was for not breaking the instances and let them render. Most of the time that would be enough but in some cases the culling would be inverted.
no please don’t! I’m sure this is CLEARLY a misunderstanding.
Your question totally makes sense and I know the documentation is not enough here (Hence why I’m thinking about a new solution).
Do not take answer too directly, it is tough on a forum to communicate feelings but I know everyone here and I can assure you that no one is insulting you (if this is the case please tell me and I will take care of that)
Also remember: we are all from different cultures and the way some people talk could be offensive for others whereas the intention is CLEARLY to only help
Insults, really? Now where was that? I hope it wasn’t me With my bad english, short messages always have a chance to lead to a misunderstanding
This is a friendly place to share questions and advice (and sometimes our mood ) but what it is NOT, is a place to insult people or post inappropriate content of any type
If you see some of these (and I’d rather think they’re not many), what you should do is, eventually try to clarify with the poster (could be a misunderstanding) or else FLAG IT as inappropriate. I’m pretty sure the Team would want to be aware of such behavior because I believe this is a NO GO The last thing you should do is take it for yourself and quit. If one has to quit this forum, it’s certainly not the victim of such misbehavior. My opinion only
Well I do hope that despite this experience, you are actually enjoying your time with BJS and I hope to see you soon in this Forum again. Meanwhile, have a great day