|
51 | 51 | var container, stats; |
52 | 52 | var params = { |
53 | 53 | envMap: "EXR", |
54 | | - roughness: 0.1, |
55 | | - metalness: 0.95, |
| 54 | + roughness: 0.0, |
| 55 | + metalness: 0.0, |
56 | 56 | exposure: 1.0 |
57 | 57 | }; |
58 | 58 | var camera, scene, renderer, controls, objects = []; |
|
79 | 79 | standardMaterial = new THREE.MeshStandardMaterial( { |
80 | 80 | map: null, |
81 | 81 | color: 0xffffff, |
82 | | - metalness: 0.95, |
83 | | - roughness: 0.1, |
| 82 | + metalness: params.roughness, |
| 83 | + roughness: params.metalness, |
84 | 84 | envMapIntensity: 1.0 |
85 | 85 | } ); |
86 | 86 |
|
87 | 87 | var geometry = new THREE.TorusKnotBufferGeometry( 18, 8, 150, 20 ); |
88 | 88 |
|
89 | 89 | var torusMesh1 = new THREE.Mesh( geometry, standardMaterial ); |
90 | | - torusMesh1.position.x = 0.0; |
91 | 90 |
|
92 | 91 | scene.add( torusMesh1 ); |
93 | 92 | objects.push( torusMesh1 ); |
|
100 | 99 | var planeMesh1 = new THREE.Mesh( planeGeometry, floorMaterial ); |
101 | 100 | planeMesh1.position.y = - 50; |
102 | 101 | planeMesh1.rotation.x = - Math.PI * 0.5; |
103 | | - planeMesh1.receiveShadow = true; |
104 | 102 | scene.add( planeMesh1 ); |
105 | 103 |
|
106 | 104 | new THREE.EXRLoader().load( "textures/piz_compressed.exr", function ( texture ) { |
|
151 | 149 | container.appendChild( stats.dom ); |
152 | 150 |
|
153 | 151 | controls = new THREE.OrbitControls( camera, renderer.domElement ); |
| 152 | + controls.minDistance = 50; |
| 153 | + controls.maxDistance = 300; |
154 | 154 |
|
155 | 155 | window.addEventListener( 'resize', onWindowResize, false ); |
156 | 156 |
|
|
195 | 195 |
|
196 | 196 | var newEnvMap = standardMaterial.envMap; |
197 | 197 |
|
198 | | - switch( params.envMap ) { |
| 198 | + switch ( params.envMap ) { |
199 | 199 |
|
200 | 200 | case 'EXR': newEnvMap = exrCubeRenderTarget ? exrCubeRenderTarget.texture : null; break; |
201 | 201 | case 'PNG': newEnvMap = pngCubeRenderTarget ? pngCubeRenderTarget.texture : null; break; |
202 | 202 |
|
203 | 203 | } |
204 | 204 |
|
205 | | - if( newEnvMap !== standardMaterial.envMap ) { |
| 205 | + if ( newEnvMap !== standardMaterial.envMap ) { |
206 | 206 |
|
207 | 207 | standardMaterial.envMap = newEnvMap; |
208 | 208 | standardMaterial.needsUpdate = true; |
|
211 | 211 | floorMaterial.needsUpdate = true; |
212 | 212 |
|
213 | 213 | } |
| 214 | + |
214 | 215 | } |
215 | 216 |
|
216 | 217 | renderer.toneMappingExposure = Math.pow( params.exposure, 4.0 ); |
|
0 commit comments