three.js - 对地面/地板的反思

时间:2015-02-24 10:22:25

标签: javascript 3d three.js

我想做同样的事情:(没有重复的领域)

http://people.mozilla.org/~sicking/webgl/ray.html

我做到了,它有效,但反射太大了:/

var groundTexture = THREE.ImageUtils.loadTexture( "files/checkerboard.jpg" );
groundTexture.wrapS = groundTexture.wrapT = THREE.RepeatWrapping;
groundTexture.repeat.set( 25, 25 );
groundTexture.anisotropy = 16;

mirrorGroundCamera = new THREE.CubeCamera( 0.1, 5000, 512 );
scene.add( mirrorGroundCamera );

var mirrorGroundMaterial = new THREE.MeshBasicMaterial( { map: groundTexture,  side: THREE.DoubleSide, envMap: mirrorGroundCamera.renderTarget } );
mirrorGround = new THREE.Mesh( groundGeometry, mirrorGroundMaterial );
mirrorGround.position.y = -0.5;
mirrorGround.rotation.x = - Math.PI / 2;
mirrorGroundCamera.position = mirrorGround.position;
scene.add(mirrorGround);

1 个答案:

答案 0 :(得分:1)

three.js中的环境映射是近似值,并假设环境是无限的"很远。

有关如何在three.js中处理镜像反射的示例,请参阅http://threejs.org/examples/webgl_mirror.html

three.js r.70