Jump to content

Bug with ExtrudeShape


Recommended Posts

yep, the CAP is computed from the model shape barycenter in order to the fastest possible when the mesh is morphed

This may lead to some artefacts with concave shapes ... well, this is a question of choice : fast computation for morphing or triangulation (what could be more complex in the case of morphing) to get something more like you could expect

As a workaround exists : put a plane mesh on to the extruded shape with the right triangulated mesh and merge it with the extruded one if needed, for now, I chose to let the barycenter way of computing.

But if someone wants the triangulation, maybe he could change this behavior

Link to comment
Share on other sites

In a situation like that, go ahead and build it up caped then add your caps later by updated the vertex data and set up the uv's on the caps the way you want that way.  It will give you more control and will give you he ability to define how the indices are connected so that you can avoid that.

Its all on how the extrude algorithm handles the points and a its designed for convex shapes i believe.  If at any point you can cross into whitespace at any point on the objects shape while drawing a line between two points then it really tosses a stick in the whole process.  Its like AABB testing convex vs concave they are different but the same process.

I may be off on this though, but yeah Id give constructing your caps manually a shot, on a shape like that.

@jeromepointed out a good approach too, and he knows what he is talking about for sure.

Link to comment
Share on other sites

in brief, you can build your own cap with this : http://doc.babylonjs.com/classes/2.4/PolygonMeshBuilder

demo : http://babylonjs.com/Demos/Polygon/

Why does the capping process to be computed fast ? well, when you dynamically morph an extruded shape : http://www.babylonjs-playground.com/#20IBWW#3

doc here : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh

We are a game engine, aren't we ? ;) .. so let's keep tools to animate or morph things by computation and let's build static things with BJS static builders (polygon builder) or external softwares (blender, etc).

All the BJS parametric shapes ( http://doc.babylonjs.com/tutorials/Parametric_Shapes ) are designed to be easily animated or morphed the fastest possible way with no memory reallocation. Sometimes, they may not fit the need to build some static shapes with specific constraints. In this case, working with a 3D editor or merging your own needed meshes can be the solution to achieve your goal.




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