Jump to content

Manually assembling submeshes


Recommended Posts



I'm manually assembling a mesh with submeshes, and I find that the end result renders correctly, except for the fact that it often gets culled when it should be visible. That is, it renders correctly if the camera is pointed in certain directions, but in other directions various submeshes get hidden even though they are fully within the camera frustum.


So I imagine there is some kind of "recalculateTheSomething()" function that I'm supposed to be calling, but I can't find any sample code to reference.


In pseudocode, I am basically doing this:

vdat = new VertexDatavdat.positions = concat( submeshPositions )vdat.indices = concat( submeshIndices )// ...colors, normals, etc.mesh = new Meshmesh.position = someVec3vdat.applyToMesh( mesh )mesh.subMeshes = []for (i in submeshData) {  var sub = new SubMesh(matID, vertStart, verts, indStart, inds, mesh)}

Is something obvious missing from that pseudocode? Again, apart from frustum culling everything seems to render correctly.

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