A first prototype in using Bezier surfaces to sculpt 3D shapes.
- create abstract data for the sculpture
- add the control net
- build mesh from abstract sculpture
move control spheres to sculpt the mesh
const sculpt = BABYLON.BezierSculpture.CreateFromCorners(corners, surfaces, scene); net = BABYLON.BezierTools.Sculpting(sculpt, scene); const sculpture = sculpt.buildMesh(nbPoints, scene); //nbPoints is to divide each side of a surface to create the sculpture mesh.
The positions parameter is an array of vector3s each of which is a corner of the overall shape
The surfaces parameter is an array of surfaces, each surface is an array of 4 indices pointing to the corners of the surface given in a counter clockwise direction when facing the surface. Each surface must have 4 corners.
E.g. positions = [vec0, vec1, vec2, vec3, vec4, vec5]
surfaces = [ [0, 1, 2, 3], [1, 4, 5, 2] ]
see lines around 570 and 580 in the PGs.
Drag the control spheres to sculpt the shape.
in #1 shape corners are green others are purple
in #2 shape corners are green, edge controls are red, with different color controls for each inner points of a surface.
Comments, examples and improvements are welcome.