Three.js 透明材料上的三种奇怪行为

Three.js 透明材料上的三种奇怪行为,three.js,Three.js,我使用three.js创建了一个房子的场景,房子的墙上有很多门窗,房间里有一些生物,如椅子、沙发等,所有这些都是独立的网格,并作为单个房屋对象组合在一起,我得到了我所期望的,但是我在墙壁材料方面面临一些问题 我附上了2个图片,说明了我的问题,也在这里解释我得到了什么 图1: 我的模型从照相机的长焦镜头看很好看,我可以看到房间里贴着门/窗的墙,我可以看到沙发 图2: 从墙上的门窗看我的房间时,另一面墙消失了。它看起来是透明的,但我可以看到墙上的门窗 我不知道我的墙怎么了 我的代码如下: funct

我使用three.js创建了一个房子的场景,房子的墙上有很多门窗,房间里有一些生物,如椅子、沙发等,所有这些都是独立的网格,并作为单个房屋对象组合在一起,我得到了我所期望的,但是我在墙壁材料方面面临一些问题

我附上了2个图片,说明了我的问题,也在这里解释我得到了什么

图1: 我的模型从照相机的长焦镜头看很好看,我可以看到房间里贴着门/窗的墙,我可以看到沙发

图2: 从墙上的门窗看我的房间时,另一面墙消失了。它看起来是透明的,但我可以看到墙上的门窗

我不知道我的墙怎么了

我的代码如下:

function wall_fill(type,no_of_walls,wall_no,inner_filltype,inner_fill,outer_filltype,outer_fill,left_filltype,left_fill,right_filltype,right_fill,top_filltype,top_fill,bottom_filltype,bottom_fill,front_filltype,front_fill,back_filltype,back_fill)
    {            
        var materials,inner_material,outer_material,left_material,right_material,top_material,bottom_material,front_material,back_material;

        // inner wall
        if(inner_filltype    ==    'texture')
        {
            var inner_texture            =    THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/'+inner_fill );
            inner_texture.anisotropy    =     renderer.getMaxAnisotropy();
            inner_texture.wrapS         =     inner_texture.wrapT    =    THREE.RepeatWrapping;                
            inner_material    =    new THREE.MeshPhongMaterial({map: inner_texture,transparent : true,transparency : 1.0,opacity: 1.5, overdraw: 0.5});
        }
        else if(inner_filltype    ==    'color')
        {
            inner_fill    =    parseInt(inner_fill);
            inner_material    =    new THREE.MeshBasicMaterial({color: inner_fill,transparent: false,opacity: 1.5, overdraw: 0.5,side: THREE.DoubleSide })
        }
        else
        {
            var inner_texture            =    THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/trans.png' );
            inner_texture.anisotropy    =     renderer.getMaxAnisotropy();
            inner_texture.wrapS         =     inner_texture.wrapT    =    THREE.RepeatWrapping;                
            //inner_material    =    new THREE.MeshPhongMaterial({map: inner_texture,transparent: true,opacity: 1.5, overdraw: 0.5 });
            inner_material    =    new THREE.MeshBasicMaterial({color: 0xd6d6d6,transparent: true,opacity: -1.5, overdraw: 0.5 })
        }

        // outer wall
        if(outer_filltype    ==    'texture')
        {
            var outer_texture            =    THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/'+outer_fill );
            outer_texture.anisotropy    =     renderer.getMaxAnisotropy();
            outer_texture.wrapS         =     outer_texture.wrapT    =    THREE.RepeatWrapping;    
            outer_material    =    new THREE.MeshPhongMaterial({map: outer_texture,transparent: true, opacity: 1.5,overdraw: 0.5,  });
        }
        else if(outer_filltype    ==    'color')
        {
            outer_fill    =    parseInt(outer_fill);
            outer_material    =    new THREE.MeshBasicMaterial({color: outer_fill,transparent: true, opacity: 1.5, overdraw: 0.5,side: THREE.DoubleSide });
        }
        else
        {
            var outer_texture            =    THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/trans.png');
            outer_texture.anisotropy    =     renderer.getMaxAnisotropy();
            outer_texture.wrapS         =     outer_texture.wrapT    =    THREE.RepeatWrapping;    
            //outer_material    =    new THREE.MeshPhongMaterial({map: outer_texture,transparent: true, opacity: 1.5,overdraw: 0.5 });
            outer_material    =    new THREE.MeshBasicMaterial({color: 0xd6d6d6,transparent: true, opacity: -1.5, overdraw: 0.5 });
        }

        // left wall
        if(left_filltype    ==    'texture')
        {
            var left_texture            =    THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/'+left_fill );
            left_texture.anisotropy        =     renderer.getMaxAnisotropy();
            left_texture.wrapS             =     left_texture.wrapT    =    THREE.RepeatWrapping;    
            left_material    =    new THREE.MeshPhongMaterial({map: left_texture,transparent: true, opacity: 1.5,overdraw: 0.5 });
        }
        else if(left_filltype    ==    'color')
        {
            left_fill    =    parseInt(left_fill);
            left_material    =    new THREE.MeshBasicMaterial({color: left_fill,transparent: true, opacity: 1.5, overdraw: 0.5,side: THREE.DoubleSide });
        }
        else
        {
            var left_texture            =    THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/trans.png');
            left_texture.anisotropy        =     renderer.getMaxAnisotropy();
            left_texture.wrapS             =     left_texture.wrapT    =    THREE.RepeatWrapping;    
            //left_material    =    new THREE.MeshPhongMaterial({map: left_texture,transparent: true, opacity: 1.5,overdraw: 0.5 });            
            left_material    =    new THREE.MeshBasicMaterial({color: 0xd6d6d6,transparent: true, opacity: -1.5, overdraw: 0.5 });
        }

        // right wall
        if(right_filltype    ==    'texture')
        {
            var right_texture            =    THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/'+right_fill );
            right_texture.anisotropy    =     renderer.getMaxAnisotropy();
            right_texture.wrapS         =     right_texture.wrapT    =    THREE.RepeatWrapping;    
            right_material    =    new THREE.MeshPhongMaterial({map: right_texture,transparent: true, opacity: 1.5,overdraw: 0.5 });
        }
        else if(right_filltype    ==    'color')
        {
            right_fill    =    parseInt(right_fill);
            right_material    =    new THREE.MeshBasicMaterial({color: right_fill,transparent: true, opacity: 1.5, overdraw: 0.5,side: THREE.DoubleSide });
        }
        else
        {
            var right_texture            =    THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/trans.png');
            right_texture.anisotropy    =     renderer.getMaxAnisotropy();
            right_texture.wrapS         =     right_texture.wrapT    =    THREE.RepeatWrapping;    
            //right_material    =    new THREE.MeshPhongMaterial({map: right_texture,transparent: true, opacity: 1.5,overdraw: 0.5 });
            right_material    =    new THREE.MeshBasicMaterial({color: 0xd6d6d6,transparent: true, opacity: -1.5, overdraw: 0.5 });
        }

        // top wall
        if(top_filltype    ==    'texture')
        {
            var top_texture                =    THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/'+top_fill );
            top_texture.anisotropy        =     renderer.getMaxAnisotropy();
            top_texture.wrapS             =     top_texture.wrapT    =    THREE.RepeatWrapping;    
            top_material    =    new THREE.MeshPhongMaterial({map: top_texture,transparent: true, opacity: 1.5,overdraw: 0.5 });
        }
        else if(top_filltype    ==    'color')
        {
            top_fill    =    parseInt(top_fill);
            top_material    =    new THREE.MeshBasicMaterial({color: top_fill,transparent: true, opacity: 1.5, overdraw: 0.5,side: THREE.DoubleSide });
        }
        else
        {
            var top_texture            =    THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/trans.png');
            top_texture.anisotropy    =     renderer.getMaxAnisotropy();
            top_texture.wrapS         =     top_texture.wrapT    =    THREE.RepeatWrapping;    
            //top_material    =    new THREE.MeshPhongMaterial({map: top_texture,transparent: true, opacity: 1.5,overdraw: 0.5 });
            top_material    =    new THREE.MeshBasicMaterial({color: 0xd6d6d6,transparent: true, opacity: -1.5, overdraw: 0.5 });
        }

        // bottom wall
        if(bottom_filltype    ==    'texture')
        {
            var bottom_texture            =    THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/'+bottom_fill );
            bottom_texture.anisotropy    =     renderer.getMaxAnisotropy();
            bottom_texture.wrapS         =     bottom_texture.wrapT    =    THREE.RepeatWrapping;    
            bottom_material    =    new THREE.MeshPhongMaterial({map: bottom_texture,transparent: true, opacity: 1.5,overdraw: 0.5 });
        }
        else if(bottom_filltype    ==    'color')
        {
            bottom_fill    =    parseInt(bottom_fill);
            bottom_material    =    new THREE.MeshBasicMaterial({color: bottom_fill,transparent: true, opacity: 1.5, overdraw: 0.5,side: THREE.DoubleSide });
        }
        else
        {
            var bottom_texture            =    THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/trans.png');
            bottom_texture.anisotropy    =     renderer.getMaxAnisotropy();
            bottom_texture.wrapS         =     bottom_texture.wrapT    =    THREE.RepeatWrapping;    
            //bottom_material    =    new THREE.MeshPhongMaterial({map: bottom_texture,transparent: true, opacity: 1.5,overdraw: 0.5 });
            bottom_material    =    new THREE.MeshBasicMaterial({color: 0xd6d6d6,transparent: true, opacity: -1.5, overdraw: 0.5 });
        }

        // front wall
        if(front_filltype    ==    'texture')
        {
            var front_texture            =    THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/'+front_fill );
            front_texture.anisotropy    =     renderer.getMaxAnisotropy();
            front_texture.wrapS         =     front_texture.wrapT    =    THREE.RepeatWrapping;    
            front_material    =    new THREE.MeshPhongMaterial({map: front_texture,transparent: true, opacity: 1.5,overdraw: 0.5 });
        }
        else if(front_filltype    ==    'color')
        {
            front_fill    =    parseInt(front_fill);
            front_material    =    new THREE.MeshBasicMaterial({color: front_fill,transparent: true, opacity: 1.5, overdraw: 0.5 ,side: THREE.DoubleSide});
        }
        else
        {
            var front_texture            =    THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/trans.png');
            front_texture.anisotropy    =     renderer.getMaxAnisotropy();
            front_texture.wrapS         =     front_texture.wrapT    =    THREE.RepeatWrapping;    
            //front_material    =    new THREE.MeshPhongMaterial({map: front_texture,transparent: true, opacity: 1.5,overdraw: 0.5 });
            front_material    =    new THREE.MeshBasicMaterial({color: 0xd6d6d6,transparent: true, opacity: -1.5, overdraw: 0.5 });
        }

        // back wall
        if(back_filltype    ==    'texture')
        {
            var back_texture            =    THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/'+back_fill );
            back_texture.anisotropy    =     renderer.getMaxAnisotropy();
            back_texture.wrapS         =     back_texture.wrapT    =    THREE.RepeatWrapping;    
            back_material    =    new THREE.MeshPhongMaterial({map: back_texture,transparent: true, opacity: 1.5,overdraw: 0.5 });
        }
        else if(back_filltype    ==    'color')
        {
            back_fill    =    parseInt(back_fill);
            back_material    =    new THREE.MeshBasicMaterial({color: back_fill,transparent: true, opacity: 1.5, overdraw: 0.5 ,side: THREE.DoubleSide});
        }
        else
        {
            var back_texture            =    THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/trans.png');
            back_texture.anisotropy    =     renderer.getMaxAnisotropy();
            back_texture.wrapS         =     back_texture.wrapT    =    THREE.RepeatWrapping;    
            //back_material    =    new THREE.MeshPhongMaterial({map: back_texture,transparent: true, opacity: 1.5,overdraw: 0.5 });
            back_material    =    new THREE.MeshBasicMaterial({color: 0xd6d6d6,transparent: true, opacity: -1.5, overdraw: 0.5 });
        }

        var left,right,top,bottom,front,back;
            if( wall_no    ==    1)
            {
                left    =    left_material;
                right    =    right_material;
                top        =    top_material;
                bottom    =    bottom_material;
                front    =    inner_material;
                back    =    outer_material;
            }

            if( wall_no    ==    2)
            {
                left    =    outer_material;
                right    =    inner_material;
                top        =    top_material;
                bottom    =    bottom_material;
                front    =    front_material;
                back    =    back_material;
            }

            if( wall_no    ==    3)
            {
                left    =    left_material;
                right    =    right_material;
                top        =    top_material;
                bottom    =    bottom_material;
                front    =    outer_material;
                back    =    inner_material;
            }

            if( wall_no    ==    4)
            {
                left    =    inner_material;
                right    =    outer_material;
                top        =    top_material;
                bottom    =    bottom_material;
                front    =    front_material;
                back    =    back_material;
            }

            materials = [
                      left,    // Left side
                      right, // Right side
                      top,     // Top side    
                      bottom,// Bottom side    
                      front, // Front side
                      back    // Back side
                    ];

        var material    =    new THREE.MeshFaceMaterial(materials);
        return material;
    }   

更新的功能

function wall_fill(type,no_of_walls,wall_no,inner_filltype,inner_fill,outer_filltype,outer_fill,left_filltype,left_fill,right_filltype,right_fill,top_filltype,top_fill,bottom_filltype,bottom_fill,front_filltype,front_fill,back_filltype,back_fill)
    {           
        var materials,inner_material,outer_material,left_material,right_material,top_material,bottom_material,front_material,back_material;

        // inner wall
        if(inner_filltype   ==  'texture')
        {
            var inner_texture           =   THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/'+inner_fill );
            inner_texture.anisotropy    =   renderer.getMaxAnisotropy();
            inner_texture.wrapS         =   inner_texture.wrapT =   THREE.RepeatWrapping;               
            inner_material  =   new THREE.MeshBasicMaterial({map: inner_texture,transparent : true, opacity:0.5,side: THREE.DoubleSide });
        }
        else if(inner_filltype  ==  'color')
        {
            inner_fill  =   parseInt(inner_fill);
            inner_material  =   new THREE.MeshBasicMaterial({color: inner_fill,transparent: true,opacity:0.5 })
        }
        else
        {
            var inner_texture           =   THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/trans.png' );
            inner_texture.anisotropy    =   renderer.getMaxAnisotropy();
            inner_texture.wrapS         =   inner_texture.wrapT =   THREE.RepeatWrapping;               
            //inner_material    =   new THREE.MeshBasicMaterial({map: inner_texture,transparent: true });
            inner_material  =   new THREE.MeshBasicMaterial({color: 0xd6d6d6,transparent: true,opacity:0.5 })
        }

        // outer wall
        if(outer_filltype   ==  'texture')
        {
            var outer_texture           =   THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/'+outer_fill );
            outer_texture.anisotropy    =   renderer.getMaxAnisotropy();
            outer_texture.wrapS         =   outer_texture.wrapT =   THREE.RepeatWrapping;   
            outer_material  =   new THREE.MeshBasicMaterial({map: outer_texture,transparent: true,opacity:0.5,side: THREE.DoubleSide});
        }
        else if(outer_filltype  ==  'color')
        {
            outer_fill  =   parseInt(outer_fill);
            outer_material  =   new THREE.MeshBasicMaterial({color: outer_fill,transparent: true, opacity:0.5});
        }
        else
        {
            var outer_texture           =   THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/trans.png');
            outer_texture.anisotropy    =   renderer.getMaxAnisotropy();
            outer_texture.wrapS         =   outer_texture.wrapT =   THREE.RepeatWrapping;   
            //outer_material    =   new THREE.MeshBasicMaterial({map: outer_texture,transparent: true });
            outer_material  =   new THREE.MeshBasicMaterial({color: 0xd6d6d6,transparent: true ,opacity:0.5});
        }

        // left wall
        if(left_filltype    ==  'texture')
        {
            var left_texture            =   THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/'+left_fill );
            left_texture.anisotropy     =   renderer.getMaxAnisotropy();
            left_texture.wrapS          =   left_texture.wrapT  =   THREE.RepeatWrapping;   
            left_material   =   new THREE.MeshBasicMaterial({map: left_texture,transparent: true ,opacity:0.5});
        }
        else if(left_filltype   ==  'color')
        {
            left_fill   =   parseInt(left_fill);
            left_material   =   new THREE.MeshBasicMaterial({color: left_fill,transparent: true,opacity:0.5 });
        }
        else
        {
            var left_texture            =   THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/trans.png');
            left_texture.anisotropy     =   renderer.getMaxAnisotropy();
            left_texture.wrapS          =   left_texture.wrapT  =   THREE.RepeatWrapping;   
            //left_material =   new THREE.MeshBasicMaterial({map: left_texture,transparent: true });            
            left_material   =   new THREE.MeshBasicMaterial({color: 0xd6d6d6,transparent: true,opacity:0.5 });
        }

        // right wall
        if(right_filltype   ==  'texture')
        {
            var right_texture           =   THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/'+right_fill );
            right_texture.anisotropy    =   renderer.getMaxAnisotropy();
            right_texture.wrapS         =   right_texture.wrapT =   THREE.RepeatWrapping;   
            right_material  =   new THREE.MeshBasicMaterial({map: right_texture,transparent: true ,opacity:0.5});
        }
        else if(right_filltype  ==  'color')
        {
            right_fill  =   parseInt(right_fill);
            right_material  =   new THREE.MeshBasicMaterial({color: right_fill,transparent: true,opacity:0.5 });
        }
        else
        {
            var right_texture           =   THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/trans.png');
            right_texture.anisotropy    =   renderer.getMaxAnisotropy();
            right_texture.wrapS         =   right_texture.wrapT =   THREE.RepeatWrapping;   
            //right_material    =   new THREE.MeshBasicMaterial({map: right_texture,transparent: true });
            right_material  =   new THREE.MeshBasicMaterial({color: 0xd6d6d6,transparent: true,opacity:0.5});
        }

        // top wall
        if(top_filltype ==  'texture')
        {
            var top_texture             =   THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/'+top_fill );
            top_texture.anisotropy      =   renderer.getMaxAnisotropy();
            top_texture.wrapS           =   top_texture.wrapT   =   THREE.RepeatWrapping;   
            top_material    =   new THREE.MeshBasicMaterial({map: top_texture,transparent: true,opacity:0.5 });
        }
        else if(top_filltype    ==  'color')
        {
            top_fill    =   parseInt(top_fill);
            top_material    =   new THREE.MeshBasicMaterial({color: top_fill,transparent: true,opacity:0.5});
        }
        else
        {
            var top_texture         =   THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/trans.png');
            top_texture.anisotropy  =   renderer.getMaxAnisotropy();
            top_texture.wrapS       =   top_texture.wrapT   =   THREE.RepeatWrapping;   
            //top_material  =   new THREE.MeshBasicMaterial({map: top_texture,transparent: true });
            top_material    =   new THREE.MeshBasicMaterial({color: 0xd6d6d6,transparent: true,opacity:0.5 });
        }

        // bottom wall
        if(bottom_filltype  ==  'texture')
        {
            var bottom_texture          =   THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/'+bottom_fill );
            bottom_texture.anisotropy   =   renderer.getMaxAnisotropy();
            bottom_texture.wrapS        =   bottom_texture.wrapT    =   THREE.RepeatWrapping;   
            bottom_material =   new THREE.MeshBasicMaterial({map: bottom_texture,transparent: true,opacity:0.5 });
        }
        else if(bottom_filltype ==  'color')
        {
            bottom_fill =   parseInt(bottom_fill);
            bottom_material =   new THREE.MeshBasicMaterial({color: bottom_fill,transparent: true, opacity:0.5});
        }
        else
        {
            var bottom_texture          =   THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/trans.png');
            bottom_texture.anisotropy   =   renderer.getMaxAnisotropy();
            bottom_texture.wrapS        =   bottom_texture.wrapT    =   THREE.RepeatWrapping;   
            //bottom_material   =   new THREE.MeshBasicMaterial({map: bottom_texture,transparent: true });
            bottom_material =   new THREE.MeshBasicMaterial({color: 0xd6d6d6,transparent: true,opacity:0.5 });
        }

        // front wall
        if(front_filltype   ==  'texture')
        {
            var front_texture           =   THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/'+front_fill );
            front_texture.anisotropy    =   renderer.getMaxAnisotropy();
            front_texture.wrapS         =   front_texture.wrapT =   THREE.RepeatWrapping;   
            front_material  =   new THREE.MeshBasicMaterial({map: front_texture,transparent: true,opacity:0.5 });
        }
        else if(front_filltype  ==  'color')
        {
            front_fill  =   parseInt(front_fill);
            front_material  =   new THREE.MeshBasicMaterial({color: front_fill,transparent: true ,opacity:0.5});
        }
        else
        {
            var front_texture           =   THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/trans.png');
            front_texture.anisotropy    =   renderer.getMaxAnisotropy();
            front_texture.wrapS         =   front_texture.wrapT =   THREE.RepeatWrapping;   
            //front_material    =   new THREE.MeshBasicMaterial({map: front_texture,transparent: true });
            front_material  =   new THREE.MeshBasicMaterial({color: 0xd6d6d6,transparent: true,opacity:0.5 });
        }

        // back wall
        if(back_filltype    ==  'texture')
        {
            var back_texture            =   THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/'+back_fill );
            back_texture.anisotropy =   renderer.getMaxAnisotropy();
            back_texture.wrapS      =   back_texture.wrapT  =   THREE.RepeatWrapping;   
            back_material   =   new THREE.MeshBasicMaterial({map: back_texture,transparent: true,opacity:0.5, });
        }
        else if(back_filltype   ==  'color')
        {
            back_fill   =   parseInt(back_fill);
            back_material   =   new THREE.MeshBasicMaterial({color: back_fill,transparent: true ,opacity:0.5});
        }
        else
        {
            var back_texture            =   THREE.ImageUtils.loadTexture( baseurl+'uploads/textures/'+type+'/trans.png');
            back_texture.anisotropy =   renderer.getMaxAnisotropy();
            back_texture.wrapS      =   back_texture.wrapT  =   THREE.RepeatWrapping;   
            //back_material =   new THREE.MeshBasicMaterial({map: back_texture,transparent: true });
            back_material   =   new THREE.MeshBasicMaterial({color: 0xd6d6d6,transparent: true ,opacity:0.5});
        }

        var left,right,top,bottom,front,back;
            if( wall_no ==  1)
            {
                left    =   left_material;
                right   =   right_material;
                top     =   top_material;
                bottom  =   bottom_material;
                front   =   inner_material;
                back    =   outer_material;
            }

            if( wall_no ==  2)
            {
                left    =   outer_material;
                right   =   inner_material;
                top     =   top_material;
                bottom  =   bottom_material;
                front   =   front_material;
                back    =   back_material;
            }

            if( wall_no ==  3)
            {
                left    =   left_material;
                right   =   right_material;
                top     =   top_material;
                bottom  =   bottom_material;
                front   =   outer_material;
                back    =   inner_material;
            }

            if( wall_no ==  4)
            {
                left    =   inner_material;
                right   =   outer_material;
                top     =   top_material;
                bottom  =   bottom_material;
                front   =   front_material;
                back    =   back_material;
            }

            materials = [
                      left, // Left side 
                      right, // Right side 
                      top,   // Top side    
                      bottom,// Bottom side 
                      front, // Front side 
                      back  // Back side 
                    ];

        var material    =   new THREE.MeshFaceMaterial(materials); 
        return material;
    }    

我仍然得到了相同的结果,我在THREE.js应用程序中所做的是完全禁用所有材质的透明度。然后在我的材料上启用“alphaTest”参数。这将禁用平滑alpha,并为透明或不透明使用截止值

以下是我的材质设置:

specular: new THREE.Color( 0x101010 ),
shininess: 40,
alphaTest: 0.15,
color: new THREE.Color( 0xffffff ),
metal: true,
wrapAround: true,
side: THREE.DoubleSide
使用此选项可以安全地设置
透明:false


如果没有一个对象是半透明的,这将解决您的问题。如果它们是半透明的,则必须实现更复杂的算法才能正确绘制透明度(请参见深度剥离或其他方法,如按特定顺序绘制对象)。

1。为什么
不透明度=-1.5或+1.5
?2.为什么您的设置为透支=0.5?3.你要把几何图形合并成一个吗?4.为什么要使用
MeshFaceMaterials
?5.您是否正在使用
WebGLRenderer
?1
Opacity=-1.5,1.5
对我有效,如果我将0设置为1,我看不到任何变化,所以我按原样离开了,2。我试过不透支,所以没有意义,3.是的4.我认为
MeshFaceMaterials
很好,所以我使用它5。是
WebGLRenderer
Hi@WestLangley问题1有任何答复吗。为什么
opacity
0.5?2.为什么要设置各向异性?3.为什么要设置
wrapps
wrapT
?4.为什么
透明
为真?1.opacity 0.5:我想要完全透明的材质,它正好看起来像门空间2.当我从远处看时,纹理看起来模糊,因此使用
各向异性
4。我需要材质环绕整个几何体,因此使用4。我需要透明材料,所以我使用Hi@beiller,谢谢你的回复,但我仍然看不到任何变化,除了我的材料现在是全白色的