Jump to content

GPU Instances vs merging


mightymarcus
 Share

Recommended Posts

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. 

tiles.png

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...