Skip to content

Commit f91e454

Browse files
materialDatabase updates:
- Switched tonemapper from ACES to AgX - Added iridescence for materials that support it - Changed reference image source to URL from API
1 parent a6608cd commit f91e454

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

example/materialDatabase.js

Lines changed: 12 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,13 +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 ) {
190194

195+
material.iridescence = 1.0;
196+
material.iridescenceIOR = info.thinFilmIor;
197+
material.iridescenceThicknessRange = [ info.thinFilmThickness, info.thinFilmThickness ];
198+
199+
}
191200
if ( material.transmission ) {
192201

193202
if ( info.color ) material.attenuationColor.setRGB( ...info.color );
@@ -199,8 +208,7 @@ function applyMaterialInfo( info, material ) {
199208

200209
}
201210

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

205213
}
206214

0 commit comments

Comments
 (0)