Search the Community
Showing results for tags 'facetdata'.
Found 3 results
Terrain - RayCast - Facet Data - MixMap?
JackFalcon posted a topic in Questions & AnswersHello, Raycast TerrainMap and get MixMap %'s? CONTEXT: Raycast over a Terrain Map... and determine the type of terrain (floor, rock, grass, etc) where the Ray Intersects mesh. Looking at Mixed-Map-Materials and Facet-Data... QUESTION: is there a way, to get the MixMap through a Raycast Intersection? Or any suggestions on detecting floor, rock, grass... thx. Kind regards, UPDATE: using this playground, stepping into raycast... http://www.babylonjs-playground.com/#7CPS7 Found: results.pickedMesh, pickedPoint, collisionGroup, looking around... : ) .subMeshes.materialIndex?... DEMO-TEST: fork Multi-Map playground and add the touch raycast. : ) Worked perfectly - Clickable Multi Map playground (debugger on cast): https://www.babylonjs-playground.com/#E6OZX#7 looking around... AbstactMesh.collisionGroup? faceId? UPDATE: idea of how to do this, need to get the mixmap.png rgb at the location of the getTextureCoordinates()...greatest intensity wins. And... looks like Context2D can do that... (perhaps) https://www.babylonjs-playground.com/#1UCP5L#5
Partitions and projected used in facetData
JohnK posted a topic in Questions & AnswersIn this PG http://www.babylonjs-playground.com/#N4TFF I get lots of things I do not expect. Probably because I do not fully understand what I am doing or what I should expect, or maybe not! The little boxes indicate the points at which I am trying to find the closest facet. My expectations. Using show partitions would show partitions that would match the shape of the mesh. Using the values for (x, y, z) given they would all return an index as they are all close to the mesh. (See console results for box2 and box4) Different positions of (x, y, z) would return different index numbers. (see console results for box1 and box3) The projected variable would be non zero. Sorry @jerome but I think this is just for you. Am I missing the point somewhere and doing something wrong (most likely)? Is it because I am using an extruded mesh with a few large facets?
jerome posted a topic in AnnouncementsHi 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