gpt4 book ai didi

javascript - 网格仅在反射中可见

转载 作者:行者123 更新时间:2023-12-03 08:21:48 24 4
gpt4 key购买 nike

我正在使用立方体相机来进行实时立方体贴图反射。如何仅在反射中显示网格。

谁能指导我如何实现它,或者是否有可能?

  cubeCamera = new THREE.CubeCamera( 1, 600, 512 );
cubeCamera.renderTarget.texture.minFilter = THREE.LinearMipMapLinearFilter;
scene.add( cubeCamera );

envMap

envMap:cubeCamera.renderTarget,

基本网格

  var geometry = new THREE.PlaneBufferGeometry( 1, 1 );
var material = new THREE.MeshBasicMaterial({color: 0xffffff });

var mesh = new THREE.Mesh( geometry, material);
mesh.position.set( 0, 0, 0 );
scene.add( mesh );

渲染

function animate() {

requestAnimationFrame(animate);
renderer.render(scene, camera);

}

function render() {

cubeCamera.updateCubeMap( renderer, scene );
renderer.render( scene, camera );

}

function update() {

requestAnimationFrame( update );
render();

}

最佳答案

试试这个(我没有测试过)
我假设它是您希望仅在反射中可见的网格对象。

基本网格

var geometry = new THREE.PlaneBufferGeometry( 1, 1 );
var material = new THREE.MeshBasicMaterial({color: 0xffffff });

var mesh = new THREE.Mesh( geometry, material);
mesh.position.set( 0, 0, 0 );
// make your mesh invisible.
mesh.visible = false;
scene.add( mesh );

渲染

function render() {
// Make mesh visible to the cubeCamera.
mesh.visible = true;
cubeCamera.updateCubeMap( renderer, scene );
// Make mesh invisible again.
mesh.visible = false;
renderer.render( scene, camera );
}

关于javascript - 网格仅在反射中可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33714605/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com