Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple Three.js morphing

Tags:

three.js

It's far from easy to start using Three.js. The documentation is incomplete and messed up and other resources seem to be outdated. So please bear with me.

How can I simply morph a geometry and/or mesh?

Take this as an example. How can I make this cylinder bow like a banana?

var material = wireframe: new THREE.MeshBasicMaterial({color: 0x00ff00});
var geometry = new THREE.CylinderGeometry(15, 15, 80, 30, 1, false)
  , mesh = new THREE.Mesh(geometry, material);

The authors of the Three.js examples tend to overdo it and throw so much unrelated stuff together in their demos, that a starter can't understand the point. Take this morphing demo. Why can't they come up with a simple Geometry object and morph it?

As this is directly related to morphing, I'd also like to know, how I can create a rig that behaves realistically (i.e. arms don't fall off). In Cinema 4D this is really simple, but how can I tell Three.js that one morphing point should control multiple mesh points?

Take this simple Three.js roboter as an example.

like image 896
buschtoens Avatar asked May 21 '13 19:05

buschtoens


People also ask

What is BufferGeometry in ThreeJS?

A representation of mesh, line, or point geometry. Includes vertex positions, face indices, normals, colors, UVs, and custom attributes within buffers, reducing the cost of passing all this data to the GPU.

Is Three Js good for game development?

Three. js is a powerful library for creating three-dimensional models and games. With just a few lines of JavaScript, you can create anything from simple 3D patterns to photorealistic, real-time scenes. You can build simple and complex 3D geometrics, animate and move objects through a lifelike scene, and more.

Can three Js do 2D?

JS IS STRUCTURED IN AN ACCESSIBLE WAY. The way that Three. js structures its rendering means that the learning curve won't be too steep. It organizes all of the renders you'll do, whether 3D or 2D, under a “Scene” container.


1 Answers

I understand how you feel about the official Three.js demos being so feature-packed that it is difficult to extract the code for individual effects that you might want to incorporate into your own programs. That was my motivation for creating the collection of elementary and thoroughly commented examples at

http://stemkoski.github.io/Three.js/

While this collection doesn't contain the example you seek (at least not yet), I just wanted to share this link with you in the hopes that it might help you learn about other individual features in the future.

like image 101
Stemkoski Avatar answered Dec 02 '22 17:12

Stemkoski