Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions docs/examples/loaders/MTLLoader.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1>[name]</h1>

<div class="desc">A loader for loading an <em>.mtl</em> resource, used internaly by [page:OBJMTLLoader] and [page:UTF8Loader].<br />
The Material Template Library format (MTL) or .MTL File Format is a companion file format to .OBJ that describes surface shading
(material) properties of objects within one or more .OBJ files.
(material) properties of objects within one or more .OBJ files.
</div>

<h2>Constructor</h2>
Expand Down Expand Up @@ -69,7 +69,7 @@ <h3>[method:null setCrossOrigin]( [page:boolean useCrossOrigin] )</h3>
<div>
Set to true if you need to load textures from a different origin.
</div>


<h3>[method:null setMaterialOptions]( [page:Object options] )</h3>
<div>
Expand All @@ -79,12 +79,13 @@ <h3>[method:null setMaterialOptions]( [page:Object options] )</h3>
<li>wrap: What type of wrapping to apply for textures. THREE.RepeatWrapping (default), THREE.ClampToEdgeWrapping, THREE.MirroredRepeatWrapping</li>
<li>normalizeRGB: RGBs need to be normalized to 0-1 from 0-255. Default: false, assumed to be already normalized</li>
<li>ignoreZeroRGBs: Ignore values of RGBs (Ka,Kd,Ks) that are all 0's. Default: false</li>
<li>invertTrProperty: Use values 1 of Tr field for fully opaque. This option is useful for obj exported from 3ds MAX, vcglib or meshlab. Default: false</li>
</ul>
</div>
<div>
Set of options on how to construct the materials
</div>


<h3>[method:MTLLoaderMaterialCreator parse]( [page:String text] )</h3>
<div>
Expand All @@ -93,7 +94,7 @@ <h3>[method:MTLLoaderMaterialCreator parse]( [page:String text] )</h3>
<div>
Parse a <em>mtl</em> text structure and return a [page:MTLLoaderMaterialCreator] instance.<br />
</div>


<h2>Source</h2>

Expand Down
6 changes: 4 additions & 2 deletions examples/js/loaders/MTLLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,11 @@ THREE.MTLLoader.MaterialCreator.prototype = {
case 'tr':
n = parseFloat( value );

if ( n > 0 ) {
if ( this.options && this.options.invertTrProperty ) n = 1 - n;

params.opacity = 1 - n;
if ( n < 1 ) {

params.opacity = n;
params.transparent = true;

}
Expand Down