Olgo Posted November 14, 2016 Share Posted November 14, 2016 Hi everybody, I noticed a bug when I was playing with ExtrudeShape function. When you make a concave shape, some artefacts are visible on caps -> http://www.babylonjs-playground.com/#102TBD#36 This is due to a bad triangulation. Is anyone has an idea to correct that ? Quote Link to comment Share on other sites More sharing options...
jerome Posted November 14, 2016 Share Posted November 14, 2016 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 Pryme8 1 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted November 14, 2016 Share Posted November 14, 2016 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. Quote Link to comment Share on other sites More sharing options...
jerome Posted November 15, 2016 Share Posted November 15, 2016 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. Pryme8 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.