Create mesh or wireframe in Three.js

- Andrés Cruz

En español

Create mesh or wireframe in Three.js

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 )

 

 

 

 

Andrés Cruz

Develop with Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter

Andrés Cruz In Udemy

I agree to receive announcements of interest about this Blog.

!Courses from!

10$

On Udemy

There are 2d 07:32!


Udemy

!Courses from!

4$

In Academy

View courses

!Books from!

1$

See the books
¡Become an affiliate on Gumroad!