Jump to content

Modify dinamically ground Mesh size , subdivisions


Recommended Posts

Hello all.

Does anyone know if i can modify the ground mesh dynamically (modify the number of subdivisions, maybe even the ground size)?


At this time i have a scene where i put a quality selector.

Among other things this selector updates the ground mesh (i simply recreate the ground mesh using the CreateGroundFromHeightMap function).

For a lower quality, i specify a lower number of subdivisions(to reduce ground geometry) and for a higher quality setting i increase the number of subdivisions.

Can i do this without actually disposing of the old ground and recreating the new one with the new settings?


I saw there is an updatable parameter of the function but i don't know how i can make use of it.

Also, does this parameter have anything to do with how the ComputeWordMatrix() function runs? (if is set to false, it somehow skips the reassessment of the ground) ? 


Thank you in advance  :D

Link to comment
Share on other sites

A mesh is built with vertices and relations between vertices (indices array) to define faces.


When a mesh is set as updatable, this means you can modifies the vertex coordinate values or the indices array value.

AFAIK, it doesn't change the vertex number or the indices element number. Only their values.


So If you want to dynamically change the number of subdivisions, you will have to change the vertex number. I guess in this case, a new mesh should be built with new settings.


ComputeWorldMatrix() is used only to handle mesh translation, scaling or rotation from its local space to the world space.

If your mesh is set to its definitive position/orientation in the world and won't move after, you could then use mesh.freezeWorldMatrix() to tell to BJS engine not to compute anymore the matrix for this mesh and thus to save micro-seconds.

It has nothing to do with updating the geometry of a mesh.

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