|
54 | 54 | const wallMaterial = new THREE.MeshStandardMaterial( { color: 0xcccccc, side: THREE.BackSide } ); |
55 | 55 | const whiteMat = new THREE.MeshStandardMaterial( { color: 0xeeeeee } ); |
56 | 56 |
|
57 | | - // Left room (warm/red): x=-8 to 0, z=-4 to 4, y=0 to 5 |
| 57 | + // Room shell: x=-8 to 8, z=-4 to 4, y=0 to 5 |
58 | 58 |
|
59 | | - const leftRoom = new THREE.Mesh( new THREE.BoxGeometry( 8, 5, 8 ), wallMaterial ); |
60 | | - leftRoom.position.set( - 4, 2.5, 0 ); |
61 | | - leftRoom.receiveShadow = true; |
62 | | - scene.add( leftRoom ); |
| 59 | + const room = new THREE.Mesh( new THREE.BoxGeometry( 16, 5, 8 ), wallMaterial ); |
| 60 | + room.position.set( 0, 2.5, 0 ); |
| 61 | + room.receiveShadow = true; |
| 62 | + scene.add( room ); |
63 | 63 |
|
64 | 64 | const redWall = new THREE.Mesh( |
65 | 65 | new THREE.PlaneGeometry( 8, 5 ), |
|
69 | 69 | redWall.position.set( - 7.99, 2.5, 0 ); |
70 | 70 | scene.add( redWall ); |
71 | 71 |
|
72 | | - // Right room (cool/blue): x=0 to 8, z=-4 to 4, y=0 to 5 |
73 | | - |
74 | | - const rightRoom = new THREE.Mesh( new THREE.BoxGeometry( 8, 5, 8 ), wallMaterial.clone() ); |
75 | | - rightRoom.position.set( 4, 2.5, 0 ); |
76 | | - rightRoom.receiveShadow = true; |
77 | | - scene.add( rightRoom ); |
78 | | - |
79 | 72 | const blueWall = new THREE.Mesh( |
80 | 73 | new THREE.PlaneGeometry( 8, 5 ), |
81 | 74 | new THREE.MeshStandardMaterial( { color: 0x0044ff } ) |
|
174 | 167 |
|
175 | 168 | // Stepped blocks near red wall |
176 | 169 | const step1 = new THREE.Mesh( new THREE.BoxGeometry( 1.5, 0.5, 1 ), whiteMat ); |
177 | | - step1.position.set( - 6.5, 0.25, 2 ); |
| 170 | + step1.position.set( - 7, 0.25, 0 ); |
178 | 171 | step1.castShadow = true; |
179 | 172 | step1.receiveShadow = true; |
180 | 173 | scene.add( step1 ); |
181 | 174 |
|
182 | 175 | const step2 = new THREE.Mesh( new THREE.BoxGeometry( 1.0, 1.0, 1 ), whiteMat ); |
183 | | - step2.position.set( - 6.5, 0.5, 2 ); |
| 176 | + step2.position.set( - 7, 0.5, 0 ); |
184 | 177 | step2.castShadow = true; |
185 | 178 | step2.receiveShadow = true; |
186 | 179 | scene.add( step2 ); |
187 | 180 |
|
188 | 181 | const step3 = new THREE.Mesh( new THREE.BoxGeometry( 0.5, 1.5, 1 ), whiteMat ); |
189 | | - step3.position.set( - 6.5, 0.75, 2 ); |
| 182 | + step3.position.set( - 7, 0.75, 0 ); |
190 | 183 | step3.castShadow = true; |
191 | 184 | step3.receiveShadow = true; |
192 | 185 | scene.add( step3 ); |
|
222 | 215 | new THREE.TorusKnotGeometry( 0.3, 0.1, 64, 16 ), |
223 | 216 | new THREE.MeshStandardMaterial( { color: 0xff44aa, metalness: 0.2, roughness: 0.5 } ) |
224 | 217 | ); |
225 | | - torusKnot.position.set( 4, 1.5, 0 ); |
| 218 | + torusKnot.position.set( 4, 1.65, 0 ); |
226 | 219 | torusKnot.castShadow = true; |
227 | 220 | torusKnot.receiveShadow = true; |
228 | 221 | scene.add( torusKnot ); |
229 | 222 |
|
230 | 223 | // Tall cone sculpture |
231 | 224 | const sculpture = new THREE.Mesh( |
232 | 225 | new THREE.ConeGeometry( 0.4, 2.5, 5 ), |
233 | | - new THREE.MeshStandardMaterial( { color: 0xeeeeee } ) |
| 226 | + whiteMat |
234 | 227 | ); |
235 | 228 | sculpture.position.set( 6.5, 1.25, - 1.5 ); |
236 | 229 | sculpture.castShadow = true; |
|
284 | 277 |
|
285 | 278 | async function bakeWithResolution( resolution ) { |
286 | 279 |
|
287 | | - // Left volume |
| 280 | + // Remove both volumes before baking to prevent feedback |
288 | 281 |
|
289 | 282 | if ( probesLeft ) { |
290 | 283 |
|
|
293 | 286 |
|
294 | 287 | } |
295 | 288 |
|
296 | | - probesLeft = new LightProbeGrid( 7.8, 4.7, 7.6, resolution, resolution, resolution ); |
297 | | - probesLeft.position.set( - 3.9, 2.45, 0 ); |
298 | | - probesLeft.bake( renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 } ); |
299 | | - probesLeft.visible = params.enabled; |
300 | | - scene.add( probesLeft ); |
301 | | - |
302 | | - // Right volume |
303 | | - |
304 | 289 | if ( probesRight ) { |
305 | 290 |
|
306 | 291 | scene.remove( probesRight ); |
307 | 292 | probesRight.dispose(); |
308 | 293 |
|
309 | 294 | } |
310 | 295 |
|
| 296 | + // Bake both volumes |
| 297 | + |
| 298 | + probesLeft = new LightProbeGrid( 7.8, 4.7, 7.6, resolution, resolution, resolution ); |
| 299 | + probesLeft.position.set( - 3.9, 2.45, 0 ); |
| 300 | + probesLeft.bake( renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 } ); |
| 301 | + probesLeft.visible = params.enabled; |
| 302 | + |
311 | 303 | probesRight = new LightProbeGrid( 7.8, 4.7, 7.6, resolution, resolution, resolution ); |
312 | 304 | probesRight.position.set( 3.9, 2.45, 0 ); |
313 | 305 | probesRight.bake( renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 } ); |
314 | 306 | probesRight.visible = params.enabled; |
| 307 | + |
| 308 | + // Add both after baking |
| 309 | + |
| 310 | + scene.add( probesLeft ); |
315 | 311 | scene.add( probesRight ); |
316 | 312 |
|
317 | 313 | // Update debug visualization |
|
0 commit comments