Jump to content

StandardMaterial.isReady


fenomas
 Share

Recommended Posts

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!

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

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