Jump to content

Split large ground mesh into sections


MackeyK24
 Share

Recommended Posts

Yo @Deltakosh ... I am using CreateGroundFromHeightmap to create a ground terrain... But for my HIGH POLY terrains I would like to break them up into sections like a 3 x 3 grid of smaller meshes

or be able to modify the CreateGroundFromHeightMap VertexData and SOMEHOW split that up into sections...

How about splitting the Heightmap up into section BEFORE I call create ground from height map...

I dunno, what are your thoughts to splitting up a LARGE terrain mesh ???

Link to comment
Share on other sites

The subdivisions parameter in the constructor is here for this purpose:

http://doc.babylonjs.com/classes/3.1/mesh#static-creategroundfromheightmap-name-url-width-height-subdivisions-minheight-maxheight-scene-updatable-onready-rarr-groundmesh-classes-3-1-groundmesh-

with a value of 3 you will split your ground into 3x3 submeshes (which will be used for frustum clipping)

Link to comment
Share on other sites

But wait... subdivisions is controlling the density of the mesh.

the resolution is the from the height map image dimensions (this example 33)

Currently I am calling CreateGroundFromHeightmap("ground", url, 300, 300, resolution, 0, 100, scene )

this generates ONE SINGLE ground mesh object made from the vertex data generated in the onready function in CreateGroundFromHeightMap.

The mesh is a PERFECT representation of the Terrain from Unity. That mesh = 1089 verts... I really just wanted to SPLIT that resulting mesh into CHUNKS so that each mesh peice is smaller... I dont see how passing value of 3 instead of 33 will make 9 separate meshes... it just makes the DENSITY much smaller but still ONE SINGLE mesh.

I dont understand :(

Link to comment
Share on other sites

1 hour ago, Deltakosh said:

The subdivisions parameter in the constructor is here for this purpose:

http://doc.babylonjs.com/classes/3.1/mesh#static-creategroundfromheightmap-name-url-width-height-subdivisions-minheight-maxheight-scene-updatable-onready-rarr-groundmesh-classes-3-1-groundmesh-

with a value of 3 you will split your ground into 3x3 submeshes (which will be used for frustum clipping)

Yo @Deltakosh Since I am calling CreateGroundFromHeightmap with a value of 33 now are saying the somehow internally the GroundMesh contains 33 sub meshes ??? 

If so how do I use those sub meshes ... I want to treat each mesh CHUNK as a separate mesh so I can put checkCollisions or physics state. If I put check collision or physics state on the main ground mesh of 65535 verts it really kills the frame rate... My hope was to be able to SPLIT the 65535 vert ground mesh in sections ... still maintaining all the detail but just create SMALLER sections that I could put checkCollisions or physics state on... Not to mention then I can create LOD version simply calling CreateGroundFromHeightmap again But with a Percentage of the original resolution value to create a less detailed version of the same exact terrain height map data.

 

Link to comment
Share on other sites

Yep the subdivisions will generate subMeshes not meshes

You will have to manually go through the list of submeshes and generates meshes.

 

For collision, you can call mesh.createOrUpdateSelectionOctree() to organize the submeshes into an octree that will boost the collision engine

For physics no simple way other than manually creating meshes

Link to comment
Share on other sites

59 minutes ago, Deltakosh said:

Yep the subdivisions will generate subMeshes not meshes

You will have to manually go through the list of submeshes and generates meshes.

 

For collision, you can call mesh.createOrUpdateSelectionOctree() to organize the submeshes into an octree that will boost the collision engine

For physics no simple way other than manually creating meshes

Yo @Deltakosh I am using 32 subdivisions but still only has 1 sub mesh:

this is a snippet from the GroundMesh created with Create Ground From Heightmap

5a6b89b3b4b02_ScreenShot2018-01-26at10_02_36AM.png.ae197f7175147e844e20193f3b106eec.png

 

Am I supposed to somehow create these sub meshes my self from the vertex data... I just dont see how to get to what is supposed to be 32 submeshes

 

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