Skip to content

Commit ab2b7e0

Browse files
authored
Merge pull request #660 from AntonPalmqvist/materialDatabase-update
materialDatabase updates
2 parents a6608cd + 31ebc2a commit ab2b7e0

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

example/materialDatabase.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
ACESFilmicToneMapping,
2+
AgXToneMapping,
33
PerspectiveCamera,
44
Scene,
55
Box3,
@@ -48,7 +48,7 @@ async function init() {
4848

4949
// renderer
5050
renderer = new WebGLRenderer( { antialias: true } );
51-
renderer.toneMapping = ACESFilmicToneMapping;
51+
renderer.toneMapping = AgXToneMapping;
5252
document.body.appendChild( renderer.domElement );
5353

5454
// path tracer
@@ -181,12 +181,22 @@ function applyMaterialInfo( info, material ) {
181181
material.roughness = 1.0;
182182
material.ior = 1.5;
183183
material.thickness = 1.0;
184+
material.iridescence = 0.0;
185+
material.iridescenceIOR = 1.0;
186+
material.iridescenceThicknessRange = [ 0, 0 ];
184187

185188
if ( info.specularColor ) material.specularColor.setRGB( ...info.specularColor );
186189
if ( 'metalness' in info ) material.metalness = info.metalness;
187190
if ( 'roughness' in info ) material.roughness = info.roughness;
188191
if ( 'ior' in info ) material.ior = info.ior;
189192
if ( 'transmission' in info ) material.transmission = info.transmission;
193+
if ( 'thinFilmThickness' in info ) {
194+
195+
material.iridescence = 1.0;
196+
material.iridescenceIOR = info.thinFilmIor;
197+
material.iridescenceThicknessRange = [ info.thinFilmThickness, info.thinFilmThickness ];
198+
199+
}
190200

191201
if ( material.transmission ) {
192202

@@ -199,8 +209,7 @@ function applyMaterialInfo( info, material ) {
199209

200210
}
201211

202-
const cleanName = info.name.replace( /\s+/g, '-' ).replace( /[()]+/g, '' );
203-
imgEl.src = `https://physicallybased.info/reference/render/${ cleanName }-cycles.png`;
212+
imgEl.src = info.reference[ 0 ];
204213

205214
}
206215

0 commit comments

Comments
 (0)