Skip to content

Commit 383bbdc

Browse files
authored
Merge pull request #694 from AntonPalmqvist/materialDatabase-update
Physical Material Database example update
2 parents 761dc09 + b51d4d3 commit 383bbdc

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

example/materialDatabase.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function applyMaterialInfo( info, material ) {
126126
// defaults
127127
material.color.set( 0xffffff );
128128
material.transmission = 0.0;
129-
material.attenuationDistance = Infinity;
129+
material.attenuationDistance = 1;
130130
material.attenuationColor.set( 0xffffff );
131131
material.specularColor.set( 0xffffff );
132132
material.metalness = 0.0;
@@ -159,9 +159,15 @@ function applyMaterialInfo( info, material ) {
159159

160160
}
161161

162-
// Blender uses 1 / density when exporting volume transmission which doesn't look
163-
// exactly right. But because the scene is 1000x in size we multiply by 1000 here.
164-
material.attenuationDistance = 1000 / info.density;
162+
if ( info.transmissionDepth ) {
163+
164+
material.attenuationDistance = info.transmissionDepth;
165+
166+
} else {
167+
168+
material.attenuationDistance = 1;
169+
170+
}
165171

166172
} else {
167173

0 commit comments

Comments
 (0)