This generator creates a 3D mug with a handle. A set of parameters control the size and the shape of the mug and its handle. It is possible to generale low-poly mug by reducing the complexity, removing edges and using flat shading. Click on a snapshot to open it online.
import { Mug } from "3d-assets/mug.js";
var model = new Mug ({
mugHeight: 19.8,
mugSize: 8.64,
mugShape: 3.2,
mugWidth: 0.329,
mugComplexity: 50,
handlePosition: 95,
handleHeight: 7.3,
handleSize: 6.07,
handleShape: -34.9,
handleWidth: 1.42,
handleThickness: 0.74,
handleComplexity: 30,
simple: false,
flat: false
});
mugHeight
– height of the mug, in cm, [7, 20]mugSize
– diameter of the mug, in cm, [6, 12]mugShape
– slope of the walls, in degrees, [-15, 15]mugWidth
– width of the walls, in cm, [0.3, 1]handlePosition
– vertical position of the handle, as percentage, [-100, 100]handleHeight
– desired height of the handle, in cm, [3, 18]handleSize
– desired extension size of the handle, in cm, [3, 10]handleShape
– slope of handle control points, in degrees, [-80, 80]handleWidth
– width of the handle cross-section, in cm, [1, 2]handleThickness
– thickness of the handle cross-section, in cm, [0.3, 1]mugComplexity
– number of faces along the mug perimeter, [4, 120]handleComplexity
– number of faces along the handle, [3, 80]simple
– if true the complexity of the profile is reduced, booleanflat
– if true flat shading is used, booleanAn instance of Mug
is a THREE.Group
with two submeshes
called body
and handle
.