jerome Posted January 19, 2017 Share Posted January 19, 2017 Hi Folks, I'm proud to introduce a brand new feature already integrated in the BJS core : FacetData This feature provides some methods to access and to play with mesh facets. Facets are the elementary triangles drawn by WebGL. We call them "facets" here in order to be not confused with the term "faces" : a box has 6 squared planar faces but each face is drawn with 2 facets (triangles). In bulk, you've got : mesh.updateFacetData(); // enables the feature or recompute things mesh.disableFacetData(); // disables it mesh.isFacetDataEnabled; // boolean, as it says ... mesh.facetNb; // number of facets mesh.getFacetPosition(i); // gives the world position of the i-th facet mesh.getFacetNormal(i); // gives the world normal values of the i-th facet mesh.getClosestFacetAtCoordinates(x,y,z); // gives the index of the closest facet to (x,y,z) in the world // etc ... and plenty of other fun tools to play with ! Please have a read at the doc (it should be in the section "Advanced Tutorials" of the doc site as soon as Monday the 23rd of January... if @RaananW accepts my bribes) and at the provided PG examples. For those who cares, all the facet indexes here are the same than the ones used by the object PickingInfo or the pickable SPS, called there faceId. So you can easily mix all these different features. Example : to get the normal of the facet from a picked point on a mesh. Have fun JCPalmer, Nabroski, JohnK and 2 others 5 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 19, 2017 Share Posted January 19, 2017 FYI, like I did for compressed textures, you can use the github version of the doc in the meantime. Also, wouldn't getFacetNormal(i) only work when using flat shading? jerome 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted January 19, 2017 Author Share Posted January 19, 2017 this works for any mesh, flat shaded or not Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 23, 2017 Share Posted January 23, 2017 Demo is live on website jerome 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted January 23, 2017 Author Share Posted January 23, 2017 yessitizzzzzzz :-) Quote Link to comment Share on other sites More sharing options...
jerome Posted January 24, 2017 Author Share Posted January 24, 2017 online documentation : http://doc.babylonjs.com/tutorials/How_to_use_FacetData 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.