2012-04-23 7 views
5

Ho un oggetto con una mesh che utilizza una trama png semitrasparente.Esiste un equivalente del backface-visibility per three.js?

C'è una bandiera o un'opzione per il MeshBasicMaterial in modo che il retro dell'oggetto sia visibile in primo piano?

Ecco alcuni esempi di codice:

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 
     }) 
    ]); 

Questo sarà accuratamente renda la sfera ma la parte posteriore rimane invisibile.

risposta

20

Il nuovo modo per fare questo è quello di utilizzare la proprietà side di material.

Esempio:

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

valori possibili sono THREE.FrontSide, THREE.BackSide e THREE.DoubleSide.

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

7

La struttura controfaccia viene impostata nella maglia stessa:

sphere.doubleSided = true; 
Problemi correlati