mightymarcus Posted August 13, 2016 Share Posted August 13, 2016 Hey 3D Gurus! Just a technical question. I'm making a tile editor, but the tiles are cubes. What would be the best practice regarding the performance? Every tile is a mesh (setEnabled(false)) that acts as a reference, and I can place instances from them to the level. Something like that (my english is horrible, sorry): [ ][ ][ ][ ] Let's say this is somethink like a bridge or a floor or a castle wall made of the same referencing mesh. So that are instances, the cubes share the same geometry and the same material, that's clear for me. If I would merge (with a custom function or the babylonjs function) them, then it would be more vertices. That's clear too. Now the question: Since BabylonJS doesn't have occlusion culling, the concealed sides from the cubes will be rendered too. Now what is better: Lots of single instances with probably a higher fill rate (hidden sides in between) vs. merging the instances to a single mesh (and apply uvs again) with much more vertices? I upload a picture to make it more clear. That walls or whatever is made of single cube instances. When I would make one mesh out of it, would that be better? Thanks in advance. Cheers. Quote Link to comment Share on other sites More sharing options...
JohnK Posted August 13, 2016 Share Posted August 13, 2016 Have you considered the Solid Particle System http://doc.babylonjs.com/overviews/Solid_Particle_System ? Here is a playground with moving boxes and I understand that your will not move http://www.babylonjs-playground.com/#16SA9C#3 Quote Link to comment Share on other sites More sharing options...
mightymarcus Posted August 13, 2016 Author Share Posted August 13, 2016 Yes, thanks for the reply. I'm using BabylonHx, the haxe port, and there it is broken. But I tried it in the playground already. I don't need that many meshes. And the performance will be sufficient with instances or merging anyway. Just wanted to know from a technical point. The yellow and cherry boxes will move UPDATE: But that leads me to another question: if SPS is so superior fast, why this can't be achieved with instances? Anyway, I will try that again, maybe it's fixed now. Quote Link to comment Share on other sites More sharing options...
JohnK Posted August 13, 2016 Share Posted August 13, 2016 1 hour ago, mightymarcus said: But that leads me to another question: if SPS is so superior fast, why this can't be achieved with instances? Anyway, I will try that again, maybe it's fixed now. One for @jerome Quote Link to comment Share on other sites More sharing options...
jerome Posted August 13, 2016 Share Posted August 13, 2016 The SPS is just a mesh. A single mesh. If you set it as not updatable, it's like a standard mesh so quite fast to be rendered. Instances aren't faster or slower... just a different approach. Quote Link to comment Share on other sites More sharing options...
mightymarcus Posted August 14, 2016 Author Share Posted August 14, 2016 Ok. So can you tell me what is better: less fillrate vs. less vertices? Quote Link to comment Share on other sites More sharing options...
mightymarcus Posted August 14, 2016 Author Share Posted August 14, 2016 I did a quick test with a ground mesh subdivided by 64 + repeated texture and 64*64 instances with the same texture. The instances have far less vertices, but cpu load is much higher because it's 4096 Objects. The subdivided ground is much faster. Thanks mightymarcus. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted August 14, 2016 Share Posted August 14, 2016 On 8/13/2016 at 11:38 AM, mightymarcus said: But that leads me to another question: if SPS is so superior fast, why this can't be achieved with instances? Anyway, I will try that again, maybe it's fixed now. Instances only help on the GPU and some call reduction. With WebGL being single threaded on the CPU side, instances cannot compete with a single mesh whether a merge or SPS. Each mesh has to have its world matrix created (unless frozen) as well as other overhead. Steffen, GameMonetize and mightymarcus 3 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.