如何创建可以反映场景中其他形状的材质?我已经尝试过reflectivity
属性,但是它没有反映任何内容。
有一个例子似乎具有这种效果:http://threejs.org/examples/#webgl_shading_physical
看起来好像不是使用标准材料来创建的。
深入理论:反射基本上是从某个位置拍摄的场景图像。因此,如果要将平面网格用作镜子,则必须在该位置添加一个摄像头,让其将场景渲染为动画循环中的纹理,然后在平面网格的材质中使用该纹理。除了提到的示例WestLangley,我还建议您查看http://stemkoski.github.io/Three.js/Reflection.html。
还可以进行设置;为了减少反射效果,例如,尝试:
var mirrorMaterial = new THREE.MeshBasicMaterial( { color: 0x111111, envMap: mirrorCamera.renderTarget } );
或
var mirrorMaterial = new THREE.MeshPhongMaterial( { emissive: 0x111111, envMap: mirrorCamera.renderTarget } );
https://threejs.org/examples/#webgl_materials_cubemap我用上面的例子做到了:
new THREE.MeshLambertMaterial ({
map: texture,
envMap: scene.background,
combine: THREE.MixOperation,
reflectivity: .5
})
据我所知,关键变量是THREE.MixOperation