Bezier Sculpture Prototypes

A first prototype in using Bezier surfaces to sculpt 3D shapes.

Usage is

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

https://playground.babylonjs.com/#DITNRE#1
in #1 shape corners are green others are purple

https://playground.babylonjs.com/#DITNRE#2
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.

8 Likes

This is really great prototype for online 3D scuplting!
I wonder if it is possible to export the result to json or save as GLB.

The mesh sculpture you can certainly export to a glb file. The sculpture data, ie the control points and surfaces to reconstruct the mesh should be exportable as a JSON, don’t know enough about glb file format to export that way.

OH! This is wild. Wow

And it’s in a playground too so we can see the code. :heart_eyes:

This is so cool! Pretty intuitive and fun to use, can’t wait too see more <3

1 Like

Amazing dude!
EDIT: This is the kind of PG which makes me realize that I still don’t know anything about 3D :smiley:

A different control setup https://playground.babylonjs.com/#DITNRE#4

Changing controls dynamically https://playground.babylonjs.com/#DITNRE#5

4 Likes