2012-04-23 22 views
5

Tengo un objeto con una malla que usa una textura png semitransparente.¿Hay una visibilidad de la cara posterior equivalente para three.js?

¿Hay una bandera u opción para MeshBasicMaterial para que la parte posterior del objeto sea visible desde el frente?

Aquí hay un código de ejemplo:

var texture = THREE.ImageUtils.loadTexture('world.png'); 

// create the sphere's material 
var sphereMaterial = new THREE.MeshBasicMaterial({ 
    map: texture, 
    transparent: true, 
    blending: THREE.AdditiveAlpha 
}); 

sphereMaterial.depthTest = false; 

// set up the sphere vars 
var radius = 50, segments = 20, rings = 20; 

// create a new mesh with sphere geometry - 
var sphere = new THREE.SceneUtils.createMultiMaterialObject(
    new THREE.SphereGeometry(radius, segments, rings),[ 
    sphereMaterial, 
    new THREE.MeshBasicMaterial({ 
     color: 0xa7f1ff, 
     opacity: 0.6, 
     wireframe: true 
     }) 
    ]); 

Esto hará que precisa la esfera, pero la parte de atrás permanece invisible.

Respuesta

20

La nueva manera de hacer esto es mediante el uso de la propiedad sidematerial.

Ejemplo:

new THREE.MeshPhongMaterial({ map: texture, side: THREE.BackSide }) 

Los valores posibles son THREE.FrontSide, THREE.BackSide y THREE.DoubleSide.

Ver: https://github.com/mrdoob/three.js/wiki/Migration

7

La propiedad de la cara posterior se encuentra en la propia malla:

sphere.doubleSided = true; 
Cuestiones relacionadas