8

半透明の png テクスチャを使用するメッシュを持つオブジェクトがあります。

オブジェクトの背面が前面から見えるように、MeshBasicMaterial のフラグまたはオプションはありますか?

サンプルコードは次のとおりです。

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

これにより、球が正確にレンダリングされますが、背面は見えません。

4

2 に答える 2

29

これを行う新しい方法は、 のsideプロパティを使用することですmaterial

例:

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

可能な値はTHREE.FrontSideTHREE.BackSideおよびTHREE.DoubleSideです。

参照: https://github.com/mrdoob/three.js/wiki/Migration

于 2013-03-07T18:54:33.753 に答える
7

backfaceプロパティは、メッシュ自体に設定されます。

sphere.doubleSided = true;
于 2012-04-24T08:12:22.830 に答える