Jump to content

Pre-import of meshes into memory


Recommended Posts


If there is an existing scene - is it possible to pre-import meshes without starting rendering them (something like isEnabled = false from the beginning)? For example, I would like to be able to load mesh from a *.babylon file into memory. So later, when/if I need it, I just call mesh.setEnabled(true) to make it visible.

If I do normal importMesh() - drawing a mesh first and then erasing it feels a little hacky, so I'm interested whether there is a cleaner way?!



Link to comment
Share on other sites

Hi Kurhlaa.  https://www.babylonjs-playground.com/#199WQ0#7

When you use scene.beforeRender or scene.beforeCameraRender  (see lines 63-67) to loop thru all mesh and setEnabled(false), I don't think the mesh get rendered at all.

So you are doing no back-walking that way, right?

I'm not sure that this is correct, but it makes sense, and I think I saw Deltakosh answer a similar question in a similar way.

Perhaps others will comment soon.

Link to comment
Share on other sites

1 hour ago, JCPalmer said:

I do not know which exporter you use.  For Blender you can indicate to load the mesh already disabled.  This the same as @Wingnut's post, but no code as it is stored directly into the JSON file.

I use Blender. How this works internally? importMesh() will also create normal visible mesh first, which then will be disabled automatically (hacky way)? Or it will create disabled mesh directly (fastest way)?

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.

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.


  • Recently Browsing   0 members

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