|
54 | 54 |
|
55 | 55 | var container, stats; |
56 | 56 | var params = { |
57 | | - opacity: 0.2, |
58 | 57 | roughness: 1.0, |
59 | | - bumpScale: 0.3 |
| 58 | + opacity: 0.5 |
60 | 59 | }; |
61 | 60 | var camera, scene, renderer, controls, objects = []; |
62 | 61 | var composer; |
|
79 | 78 |
|
80 | 79 | standardMaterial = new THREE.MeshStandardMaterial( { |
81 | 80 | map: null, |
82 | | - bumpScale: - 0.05, |
83 | | - color: 0x0304ff, |
84 | 81 | metalness: 0.9, |
85 | | - roughness: 0.5, |
| 82 | + roughness: 1.0, |
86 | 83 | shading: THREE.SmoothShading, |
87 | 84 | blending: THREE.NormalBlending, |
88 | 85 | transparent: true |
89 | 86 | } ); |
90 | 87 | var geometry = new THREE.SphereGeometry( 18, 30, 30 ); |
91 | 88 | var torusMesh1 = new THREE.Mesh( geometry, standardMaterial ); |
92 | | - torusMesh1.position.x = 20.0; |
| 89 | + torusMesh1.position.x = - 20.0; |
93 | 90 | torusMesh1.castShadow = true; |
94 | 91 | scene.add( torusMesh1 ); |
95 | 92 | objects.push( torusMesh1 ); |
96 | 93 |
|
97 | 94 | standardMaterialPremultiplied = new THREE.MeshStandardMaterial( { |
98 | 95 | map: null, |
99 | | - bumpScale: - 0.05, |
100 | | - color: 0x0304ff, |
101 | 96 | metalness: 0.9, |
102 | | - roughness: 0.5, |
| 97 | + roughness: 1.0, |
103 | 98 | shading: THREE.SmoothShading, |
104 | | - blending: THREE.PremultipliedAlphaNormalBlending, |
| 99 | + premultipliedAlpha: true, |
105 | 100 | transparent: true |
106 | 101 | } ); |
107 | 102 |
|
|
114 | 109 | map.repeat.set( 2, 2 ); |
115 | 110 | standardMaterial.map = map; |
116 | 111 | standardMaterial.roughnessMap = map; |
117 | | - //standardMaterial.bumpMap = map; |
118 | 112 | standardMaterial.needsUpdate = true; |
119 | 113 | standardMaterialPremultiplied.map = map; |
120 | 114 | standardMaterialPremultiplied.roughnessMap = map; |
121 | | - //standardMaterialPremultiplied.bumpMap = map; |
122 | 115 | standardMaterialPremultiplied.needsUpdate = true; |
123 | 116 |
|
124 | 117 | } ); |
125 | 118 |
|
126 | 119 | var torusMesh2 = new THREE.Mesh( geometry, standardMaterialPremultiplied ); |
127 | | - torusMesh2.position.x = - 20.0; |
| 120 | + torusMesh2.position.x = 20.0; |
128 | 121 | torusMesh2.castShadow = true; |
129 | 122 | scene.add( torusMesh2 ); |
130 | 123 | objects.push( torusMesh2 ); |
|
152 | 145 | var spotLight = new THREE.SpotLight( 0xffffff ); |
153 | 146 | spotLight.position.set( 50, 100, 50 ); |
154 | 147 | spotLight.angle = Math.PI / 7; |
155 | | - spotLight.penumbra = 0.8 |
| 148 | + spotLight.penumbra = 0.8; |
156 | 149 | spotLight.intensity = 5; |
157 | 150 | spotLight.castShadow = true; |
158 | 151 | scene.add( spotLight ); |
|
190 | 183 | var gui = new dat.GUI(); |
191 | 184 |
|
192 | 185 | gui.add( params, 'roughness', 0, 1 ); |
193 | | - gui.add( params, 'bumpScale', - 1, 1 ); |
194 | 186 | gui.add( params, 'opacity', 0, 1 ); |
195 | 187 | gui.open(); |
196 | 188 |
|
|
229 | 221 | standardMaterial.roughness = params.roughness; |
230 | 222 | standardMaterialPremultiplied.roughness = params.roughness; |
231 | 223 |
|
232 | | - standardMaterial.bumpScale = - 0.05 * params.bumpScale; |
233 | | - standardMaterialPremultiplied.bumpScale = - 0.05 * params.bumpScale; |
234 | | - |
235 | 224 | standardMaterial.opacity = params.opacity; |
236 | 225 | standardMaterialPremultiplied.opacity = params.opacity; |
237 | 226 |
|
|
0 commit comments