Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 9 additions & 36 deletions examples/webgl_materials_physical_transmission.html
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -148,51 +129,43 @@
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;

} );

gui.add( params, 'envMapIntensity', 0, 1, 0.01 )
.name( 'envMap intensity' )
.onChange( function () {

material1.envMapIntensity = material2.envMapIntensity = params.envMapIntensity;
material1b.envMapIntensity = material2b.envMapIntensity = params.envMapIntensity;
material.envMapIntensity = params.envMapIntensity;

} );

Expand Down