我想抹掉奇怪的行

时间:2019-06-10 12:44:36

标签: three.js

我制作了一个黑球,并应用了环境图和彩色图。然后我用相机移动了绿色矩形灯。然后出现了一条奇怪的圆线。

这是我的代码。

var width = 20;
var height = 20;
var intensity = 5;

rectLight = new THREE.RectAreaLight( 0x093112, intensity,  width, height );
rectLight.position.set( 10, 0, 0 );
rectLight.lookAt( 0, 0, 0 );
scene.add( rectLight );

var rectLightHelper = new THREE.RectAreaLightHelper( rectLight );
rectLight.add( rectLightHelper );

var ambiantLight = new THREE.AmbientLight(0xffffff);
scene.add(ambiantLight);

var envMap = new THREE.CubeTextureLoader()
    .setPath('imgs/')
    .load([
        'px.png',
        'nx.png',
        'py.png',
        'ny.png',
        'pz.png',
        'nz.png'
     ]);
envMap.mapping = THREE.CubeReflectionMapping;

var map = new THREE.TextureLoader().load('imgs/pearl_txt2.jpg');
map.minFilter = THREE.NearestFilter;
map.mapping = THREE.SphericalReflectionMapping;

var beta = 0.33, alpha = 0.4;

sphere = new THREE.Mesh(
    new THREE.SphereBufferGeometry(5,32,32),
        new THREE.MeshPhysicalMaterial({
            color : 0xffffff,
            map: map,
            metalness : beta,
            roughness : alpha,
            envMap : envMap,
            side : THREE.FrontSide,
            skinning : true,
            reflectivity : 0.5,
            emissiveMap : new THREE.TextureLoader().load('imgs/2.jpg')
        })
    );

scene.add(sphere);

这是 result

希望你能帮助我。

0 个答案:

没有答案