Jump to content

Babylon.js very slow


Kesshi
 Share

Recommended Posts

I tested it again (v2.3) it is much better now. Good job. :)

 

obj loading: 4.9 seconds

create instances: 0.5 seconds -> 19 FPS

create clones: 14.3 seconds  -> 4 FPS

 

Unsing clone is still a bit slow. I profiled it again. There is still one place where the bounding box is recalculated.

https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.geometry.ts#L336

Here a new SubMesh is created and in the constructor of the submesh refreshBoundingInfo() is called.

 

By the way, i just saw a problem with instances in Firefox (41.0.2 win 32bit).

Many parts of my object are not visible:

https://drive.google.com/open?id=0B1FKnpnB3KKIWUI0Rm9ENDZOZ0U

That also happens with babylon.js 2.2

Link to comment
Share on other sites

Yep, for the Firefox bug, we already know it, it's a particular bad behavior in ANGLE implementation.

( http://www.html5gamedevs.com/topic/12319-strange-bug-instanced-submeshes-doesnt-render-on-chrome/ )

 

I've reported the problem on Chrome and Firefox's issues boards.

Chrome team had corrected the bug in few weeks, but I'm still waiting (for months now...) for Firefox team to (at least) assign someone to this bug, they consider it not so high priority I think, but maybe if lots of us vote for this bug we'll have some impact to move the thing forward...

https://bugzilla.mozilla.org/show_bug.cgi?id=1155986

Link to comment
Share on other sites

Unsing clone is still a bit slow. I profiled it again. There is still one place where the bounding box is recalculated.

https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.geometry.ts#L336

Here a new SubMesh is created and in the constructor of the submesh refreshBoundingInfo() is called.

Should be better now, just committed an optimization an hour ago.

Link to comment
Share on other sites

@RaananW: thank you for the fast fix again. I will test it tomorrow.

 

Regarding the use of instances. Firefox is not the main issue here.

Please correct me if i'm wrong but if i understand the instances correctly then all instances created from a mesh will use the same parent as the source mesh. It is not possible to move a created instance to another parent.

 

In my project all objects have parent / child relationships and are also positioned/rotated accordingly.

The same geometry will be used in different places under different parents and with different materials.

Implementing this with instances seems to be complicated.

Link to comment
Share on other sites

 

 

Please correct me if i'm wrong but if i understand the instances correctly then all instances created from a mesh will use the same parent as the source mesh. It is not possible to move a created instance to another parent.

So i correct you :) instances are regular mesh except they are forced to use the same material as source.

As Raanan mentioned they can have their own parent and hierarchy.

 

What does lead you to think you cannot change the parent? I would like to fix doc or whatever gave you this wrong impression :)

Link to comment
Share on other sites

Should be better now, just committed an optimization an hour ago.

 

Yes it is again much faster now. It takes 3.4 seconds to create the clones. :)

If i do this (instead of calling clone()):

tClone = new BABYLON.Mesh("mesh_clone_" + tIndex, scene);             tClone.material = tMesh.material;tMesh.geometry.applyToMesh(tClone);

It takes only 0.6 seconds :D

 

 

The parent system works wonderfully with instances. small example : http://www.babylonjs-playground.com/#1PKKNV

Just create a parent per group of meshes and use it to rotate and translate. you can set it to be invisible and this way you won't even notice it is there.

 

Are you sure it works correclty? I tested your example on two systems with different browsers. While navigating around geometries are disappearing/reappearing all the time. It seems like they are clipped away to early.

 

 

What does lead you to think you cannot change the parent? I would like to fix doc or whatever gave you this wrong impression :)

 

Mesh.clone() has a newParent parameter. createInstance() doesn't have it.

I didn't know that i can just set a new parent directly.

And i know how instances work in ThreeJs so i expected the same limitation here. :rolleyes:

Link to comment
Share on other sites

@RaananW, I can confirm that the playground with the instances does weird stuff. Besides the mentioned disappearing/reappearing I also get some kind of flickering like seen in the image below. With cloning instead everything works fine.

 

On my laptop at home (intel graphic) i also had similar artifacts. Here at work (nvidia graphic) i don't have that problem.

Link to comment
Share on other sites

Yeah, I see that on my android as well. I wonder if it's the result of instances, or of it has something to do with the shapes themselves. Won't be able to check this till the evening thou...

Actually, all I wanted to show was that the parent child relationship fits instances :-)

Link to comment
Share on other sites

Actually, all I wanted to show was that the parent child relationship fits instances :-)

 

Sorry for finding the problem ;)

 

I have good and bad news for you.

The good news is, because of the nice support here in the forum and the features of Babylon.js we decided to use babylon for our project.

The bad news is, you will see me here more often now posting some problems. :D

Link to comment
Share on other sites

Yes, great news. The core babylon.js team and its awesome community will be there to help you fixing bugs & improving performance if needed.

 

2.3 is definitely an interesting milestone as we've been able to fix a lot of bugs & performance issues that were hidden. This is mainly thanks to all of you and current big internal secret projects we're working on. ;-)

 

David

Link to comment
Share on other sites

On my laptop at home (intel graphic) i also had similar artifacts. Here at work (nvidia graphic) i don't have that problem.

Yep, just checked it here as well on my intel-graphics laptop- http://www.babylonjs-playground.com/#1PKKNV#1 , instances disappear for some reason when they have a new parent. clones don't (lines 74 and 75, either this or that). @DK - any idea?

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...