fenomas Posted July 4, 2015 Share Posted July 4, 2015 Hi, Regarding "StandardMaterial.isReady()" - does the composition of a scene affect how often this is called, or is there a way to optimize against it? For JS-bound scenes with lots of meshes I often find that the profiler spends most of its time in this function, and the big arrays it generates also seem to thrash the GC somewhat. So I'm wondering if something about my scene is causing it to get called unnecessarily often. Thanks! Quote Link to comment Share on other sites More sharing options...
Temechon Posted July 4, 2015 Share Posted July 4, 2015 Hello, If your material never changes, you can use material.checkReadyOnlyOnce : https://github.com/BabylonJS/Babylon.js/blob/master/src/Materials/babylon.material.ts#L21It seems to improve performances. About your scene, hard to tell without any code or demo Quote Link to comment Share on other sites More sharing options...
fenomas Posted July 6, 2015 Author Share Posted July 6, 2015 Hmm. Setting that flag seems to cut down on the time spent in isReady but the allocations look unchanged. Is it really the case that one can set that flag any time the material won't change, or are there other caveats? If so, presumably it would be best to set the flag on all materials, and toggle it off for a frame if you need to change a material, right? adam 1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted July 6, 2015 Share Posted July 6, 2015 DK commented on another thread that if checkOnlyOnce = true & the material was shared by meshes & one changed it, the behavior would not be right. Think that is the reason for the default. That said, in the next version of the Blender exporters, when a material is not shared, then checkOnlyOnce will be set to true. Also there is a new checkbox in the mesh custom properties for freezeWorldMatrix. The developer should know at design time whether the mesh is ever going to move, rotate, or scale. A good place to put this optimization. Have added those attributes to the .babylon format (not PMed yet), as well as 3D camera rig, so presumably other exporters can use them as well. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 6, 2015 Share Posted July 6, 2015 Allocations part of isReady should be stopped as well by setting checkOnlyOnce to true Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 6, 2015 Share Posted July 6, 2015 I finally found time to finish my revamping of the isReady function. I would like some feedbacks from you guys to see if this is better now performance and memory wise adam and jahow 2 Quote Link to comment Share on other sites More sharing options...
fenomas Posted July 8, 2015 Author Share Posted July 8, 2015 I finally found time to finish my revamping of the isReady function. I would like some feedbacks from you guys to see if this is better now performance and memory wise Looks cool! I haven't done deep testing but it's not slower, and I think it's faster. Nice to not see those massive string arrays getting built. GameMonetize 1 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.