From 370418946c0acdcb3b65f12ae1a17d03e9664ba0 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Wed, 9 Jun 2021 13:07:59 +0200 Subject: [PATCH] Examples: Simplified webgl_materials_physical_transmission --- ...webgl_materials_physical_transmission.html | 45 ++++--------------- 1 file changed, 9 insertions(+), 36 deletions(-) diff --git a/examples/webgl_materials_physical_transmission.html b/examples/webgl_materials_physical_transmission.html index 6a9b698fbdb059..7763797972a0ef 100644 --- a/examples/webgl_materials_physical_transmission.html +++ b/examples/webgl_materials_physical_transmission.html @@ -99,37 +99,18 @@ depthWrite: false, transmission: params.transmission, // use material.transmission for glass materials opacity: params.opacity, + side: THREE.DoubleSide, transparent: true } ); - const material1 = new THREE.MeshPhysicalMaterial().copy( material ); - - const material1b = new THREE.MeshPhysicalMaterial().copy( material ); - material1b.side = THREE.BackSide; - - const material2 = new THREE.MeshPhysicalMaterial().copy( material ); - material2.premultipliedAlpha = true; - - const material2b = new THREE.MeshPhysicalMaterial().copy( material ); - material2b.premultipliedAlpha = true; - material2b.side = THREE.BackSide; - - mesh1 = new THREE.Mesh( geometry, material1 ); + mesh1 = new THREE.Mesh( geometry, material ); mesh1.position.x = - 30.0; scene.add( mesh1 ); - let mesh = new THREE.Mesh( geometry, material1b ); - mesh.renderOrder = - 1; - mesh1.add( mesh ); - - mesh2 = new THREE.Mesh( geometry, material2 ); + mesh2 = new THREE.Mesh( geometry, material ); mesh2.position.x = 30.0; scene.add( mesh2 ); - mesh = new THREE.Mesh( geometry, material2b ); - mesh.renderOrder = - 1; - mesh2.add( mesh ); - // stats = new Stats(); @@ -148,42 +129,35 @@ gui.addColor( params, 'color' ) .onChange( function () { - material1.color.set( params.color ); - material2.color.set( params.color ); - material1b.color.set( params.color ); - material2b.color.set( params.color ); + material.color.set( params.color ); } ); gui.add( params, 'transmission', 0, 1, 0.01 ) .onChange( function () { - material1.transmission = material2.transmission = params.transmission; - material1b.transmission = material2b.transmission = params.transmission; + material.transmission = params.transmission; } ); gui.add( params, 'opacity', 0, 1, 0.01 ) .onChange( function () { - material1.opacity = material2.opacity = params.opacity; - material1b.opacity = material2b.opacity = params.opacity; + material.opacity = params.opacity; } ); gui.add( params, 'metalness', 0, 1, 0.01 ) .onChange( function () { - material1.metalness = material2.metalness = params.metalness; - material1b.metalness = material2b.metalness = params.metalness; + material.metalness = params.metalness; } ); gui.add( params, 'roughness', 0, 1, 0.01 ) .onChange( function () { - material1.roughness = material2.roughness = params.roughness; - material1b.roughness = material2b.roughness = params.roughness; + material.roughness = params.roughness; } ); @@ -191,8 +165,7 @@ .name( 'envMap intensity' ) .onChange( function () { - material1.envMapIntensity = material2.envMapIntensity = params.envMapIntensity; - material1b.envMapIntensity = material2b.envMapIntensity = params.envMapIntensity; + material.envMapIntensity = params.envMapIntensity; } );