Graphics Reference
In-Depth Information
var sphere = new
THREE.Mesh(sphereGeometry, mat);
scene.add(sphere);
With these simple steps, you can create really interesting effects by just experiment-
ing with textures and geometries.
There's moreā€¦
With Three.js, it is possible to repeat textures (refer to the Setup repeating textures
recipe). You can use this to create interesting-looking objects such as this:
The code required to set a texture to repeat is the following:
var mat = new THREE.MeshPhongMaterial();
mat.map = new THREE.ImageUtils.loadTexture(
"../assets/textures/
partial-transparency.png");
mat.transparent = true;
mat.map.wrapS = mat.map.wrapT =
THREE.RepeatWrapping;
mat.map.repeat.set( 4, 4 );
mat.depthWrite = false;
mat.color = new THREE.Color(0x00ff00);
Search WWH ::




Custom Search