나는 초보자이며 THREE.js와 나는 도움이 필요하다.THREE.js로 불완전한 그림자
을 얻을 것을 아래에 볼 수 있고이 코드입니다 :
// on initialise le moteur de rendu
renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.getElementById('container').appendChild(renderer.domElement);
// on initialise la scène
scene = new THREE.Scene();
// on initialise la camera que l’on place ensuite sur la scène
camera = new THREE.PerspectiveCamera(50, window.innerWidth/window.innerHeight, 1, 100000);
camera.position.set(0, 0, 1000);
scene.add(camera);
// plane
\t me = new THREE.Mesh(new THREE.PlaneGeometry(900,550), new THREE.MeshPhongMaterial({color: 0xffffff}));
\t scene.add(me);
me.position.x = 130;
me.position.y = 10;
me.rotation.y = -20;
// on créé un cube au quel on définie un matériau puis on l’ajoute à la scène
cube = new THREE.Mesh(new THREE.CubeGeometry(100, 100, 100), new THREE.MeshPhongMaterial({color:0x00ffff}));
scene.add(cube);
cube.position.y = 0;
cube.position.x = 20;
cube.position.z = 0;
cube.rotation.y = 0;
scene.add(new THREE.AmbientLight(0x212223));
light = new THREE.SpotLight(0xffffff, 1);
light.position.set(-300,-100,20);
light.angle = Math.PI/5;
light.shadowCameraVisible = true;
scene.add(light);
renderer.shadowMap.enabled = true;
renderer.shadowMapDarkness = 1;
light.castShadow = true;
light.intensity = 0.8;
cube.castShadow = true;
cube.receiveShadow = true;
me.receiveShadow = true;
lightHelper = new THREE.SpotLightHelper(light);
scene.add(lightHelper);
renderer.render(scene, camera);
내 코드 변경의 나머지 x와 빛의 Y 값 또는 입방체의 그림자와 그 큐브의 그림자가 항상 완전하지는 않습니다. 이유를 이해하지 못합니다 ... 나는 초보자입니다. 나는 실수를 한 것 같습니다. 암호.
내 컴퓨터에서 코드를 실행 해 보니 효과적이었습니다. 그림자가 완료되었습니다. 모든 항목을 업데이트 해보세요. – Arnaud
그렇습니다. position.x = 300을 넣었을 때 작동했지만 x 값이 모두 작동하지 않아서 왜 (내 애니메이션의 나머지 부분이 x 값을 수정하는지) 이해할 수 없습니다 – sami54