Przeglądaj źródła

Improved PCSS shadow example.

Mr.doob 7 lat temu
rodzic
commit
b403e43a20
1 zmienionych plików z 12 dodań i 2 usunięć
  1. 12 2
      examples/webgl_shadowmap_pcss.html

+ 12 - 2
examples/webgl_shadowmap_pcss.html

@@ -190,8 +190,10 @@
 					var material = new THREE.MeshPhongMaterial( { color: Math.random() * 0xffffff } );
 
 					var sphere = new THREE.Mesh( geometry, material );
-					sphere.position.x = Math.random() * 6 - 3;
-					sphere.position.z = Math.random() * 6 - 3;
+					sphere.position.x = Math.random() - 0.5;
+					sphere.position.z = Math.random() - 0.5;
+					sphere.position.normalize();
+					sphere.position.multiplyScalar( Math.random() * 2 + 1 );
 					sphere.castShadow = true;
 					sphere.receiveShadow = true;
 					sphere.userData.phase = Math.random() * Math.PI;
@@ -208,6 +210,14 @@
 				mesh.receiveShadow = true;
 				scene.add( mesh );
 
+				// column
+
+				var mesh = new THREE.Mesh( new THREE.BoxBufferGeometry( 1, 4, 1 ), groundMaterial );
+				mesh.position.y = 2;
+				mesh.castShadow = true;
+				mesh.receiveShadow = true;
+				scene.add( mesh );
+
 				// overwrite shadowmap code
 
 				var shader = THREE.ShaderChunk.shadowmap_pars_fragment;