
We can activate the wireframe or the mesh easily in our geometric figures using the wireframe option in the different meshes that we create in Three.js.
Starting with a basic mesh for a cube, like the one we saw before to create our first scene in Three.js:
const geometry = new THREE.BoxGeometry(4,4,4)
const material = new THREE.MeshBasicMaterial({ color: 0x00FF00})
We added the wireframe option; you can do this for most of the meshes supported by Three.js:
const geometry = new THREE.BoxGeometry(4,4,4)
const material = new THREE.MeshBasicMaterial({ color: 0x00FF00, wireframe: true })
And that's it; for the rest, we add it to the scene and we will have a figure like the one on the cover:
const cube = new THREE.Mesh( geometry, material )
scene.add( cube )
I agree to receive announcements of interest about this Blog.
We will see how to create a mesh in basic geometric shapes in Three.js.
- Andrés Cruz