Kesshi Posted October 21, 2015 Author Share Posted October 21, 2015 I tested it again (v2.3) it is much better now. Good job. obj loading: 4.9 secondscreate instances: 0.5 seconds -> 19 FPScreate 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#L336Here 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=0B1FKnpnB3KKIWUI0Rm9ENDZOZ0UThat also happens with babylon.js 2.2 Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 21, 2015 Share Posted October 21, 2015 well, that's an improvement :-)I'll look into the sub meshes, maybe there is a way to avoid recalculating the bounding boxes. But I am happy this performance issue is gone. Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted October 21, 2015 Share Posted October 21, 2015 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 RaananW 1 Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted October 21, 2015 Share Posted October 21, 2015 obj loading: 4.9 secondscreate instances: 0.5 seconds -> 19 FPScreate clones: 14.3 seconds -> 4 FPS So it's seems that's better than Three.js perfs now, isn't ? Quote Link to comment Share on other sites More sharing options...
Kesshi Posted October 21, 2015 Author Share Posted October 21, 2015 So it's seems that's better than Three.js perfs now, isn't ?The obj loading is faster now yes.But creating copies of my objects and the resulting FPS is only faster if i use instances and i'm not sure yet if i can use them. Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 21, 2015 Share Posted October 21, 2015 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#L336Here 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. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 21, 2015 Share Posted October 21, 2015 So only remaining question: why wouldn't you be able to use instances? Quote Link to comment Share on other sites More sharing options...
adam Posted October 21, 2015 Share Posted October 21, 2015 So only remaining question: why wouldn't you be able to use instances? Sounds like it is due to the Firefox bug. Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted October 21, 2015 Share Posted October 21, 2015 The Firefox bug. I think we can make things change if we all go voting for this bug to increase its priority (no need to create a bugzilla account, one can sign in with GitHub account) :https://bugzilla.mozilla.org/show_bug.cgi?id=1155986 Jaskar 1 Quote Link to comment Share on other sites More sharing options...
Kesshi Posted October 21, 2015 Author Share Posted October 21, 2015 @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. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted October 21, 2015 Share Posted October 21, 2015 You must then use clones and not instances. Quote Link to comment Share on other sites More sharing options...
reddozen Posted October 21, 2015 Share Posted October 21, 2015 I think we can make things change if we all go voting for this bug to increase its priority (no need to create a bugzilla account, one can sign in with GitHub account) :https://bugzilla.mozilla.org/show_bug.cgi?id=1155986 I voted Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 21, 2015 Share Posted October 21, 2015 The parent system works wonderfully with instances. small example : http://www.babylonjs-playground.com/#1PKKNVJust 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. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 21, 2015 Share Posted October 21, 2015 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 Quote Link to comment Share on other sites More sharing options...
Kesshi Posted October 22, 2015 Author Share Posted October 22, 2015 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 The parent system works wonderfully with instances. small example : http://www.babylonjs-playground.com/#1PKKNVJust 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. Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 22, 2015 Share Posted October 22, 2015 I guess the clipping is due to the camera definitions, but I can't check it on my mobile right now... You can also clone an instance. Its clone function does have the new patent variable, but setting the parent will work as well. Quote Link to comment Share on other sites More sharing options...
iiceman Posted October 22, 2015 Share Posted October 22, 2015 @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. Quote Link to comment Share on other sites More sharing options...
Kesshi Posted October 22, 2015 Author Share Posted October 22, 2015 @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. Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 22, 2015 Share Posted October 22, 2015 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 :-) Quote Link to comment Share on other sites More sharing options...
Kesshi Posted October 22, 2015 Author Share Posted October 22, 2015 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. gaelbeltran, adam, Temechon and 4 others 7 Quote Link to comment Share on other sites More sharing options...
Temechon Posted October 22, 2015 Share Posted October 22, 2015 And you shall receive more support from all of us ! RaananW 1 Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted October 22, 2015 Share Posted October 22, 2015 That's a great news, I'm sure you won't be disappointed at all. Quote Link to comment Share on other sites More sharing options...
davrous Posted October 22, 2015 Share Posted October 22, 2015 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 Dad72 and adam 2 Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 22, 2015 Share Posted October 22, 2015 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? Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted October 22, 2015 Share Posted October 22, 2015 Yep strange bug... I'm often using instances on my projects, if I remember well some of them have new parents assigned dynamically and I never had such disappearing problems... 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.