Jump to content

More efficient to make mesh invisible or dispose mesh?


ozRocker
 Share

Recommended Posts

Just say you have a whole bunch of meshes in the scene and you want them to disappear out of view temporarily.  Is it better to set the mesh to invisible or dispose the mesh then recreate it later?  Which one is better for the frame rate?

Link to comment
Share on other sites

@ozRocker: there is another option oz :

mesh.setEnabled(false);

Which I tend to use as I have never been sure about what setting the visibility had on scene efficiency. And disposing of a mesh - if you need it again (ie. it is temporary state ) it has to be reloaded ?

cheers, gryff :)

 

Link to comment
Share on other sites

ok cool, I did some tests on disposing and setEnabled(false).  I'm walking through a scene that's split up like a grid which is 8,2,8 in size with 64 cubes in each tile.  That's 8192 shapes in total  As the player walks around new cubes will appear around them and the faraway cubes will disappear from view.  When I dispose of the cubes then re-create them when the user walks through the same tiles then returns to the starting point of 0,0,0  the frame rate stays at mostly 60, with minimum of 58.  If I keep the mesh in memory and use setEnabled(false) the framerate is mostly 60 but can flicker down to 55.

The reason I'm doing these tests is because I'm lazy-loading objects from the server.  I don't want to load massive a JSON packet of 8192 objects from the server then create all those meshes at once.  I just want to load the objects in the tiles surrounding the player.

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