Skip to content

Commit

Permalink
Change handle linearfilter texture setting in gltf loader
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesDeml committed Nov 11, 2019
1 parent 832e889 commit 909d9cc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
16 changes: 14 additions & 2 deletions examples/jsm/loaders/GLTFLoader.js
Expand Up @@ -1997,8 +1997,20 @@ var GLTFLoader = ( function () {
var samplers = json.samplers || {};
var sampler = samplers[ textureDef.sampler ] || {};

texture.magFilter = WEBGL_FILTERS[ sampler.magFilter ] || LinearFilter;
texture.minFilter = WEBGL_FILTERS[ sampler.minFilter ] || LinearMipmapLinearFilter;
// Make sure basis textures only use linear filters (https://discourse.threejs.org/t/compressed-texture-workflow-gltf-basis/10039/12)
if(source.mimeType === "image/basis") {

texture.magFilter = LinearFilter;
texture.minFilter = LinearFilter;

}
else {

texture.magFilter = WEBGL_FILTERS[ sampler.magFilter ] || LinearFilter;
texture.minFilter = WEBGL_FILTERS[ sampler.minFilter ] || LinearMipmapLinearFilter;

}

texture.wrapS = WEBGL_WRAPPINGS[ sampler.wrapS ] || RepeatWrapping;
texture.wrapT = WEBGL_WRAPPINGS[ sampler.wrapT ] || RepeatWrapping;

Expand Down
4 changes: 0 additions & 4 deletions examples/webgl_loader_gltf_basis.html
Expand Up @@ -86,10 +86,6 @@
if ( child.isMesh ) {

child.material.envMap = envMap;
var texture = child.material.map;
if(texture !== null) {
texture.minFilter = texture.magFilter = THREE.LinearFilter;
}

}

Expand Down

0 comments on commit 909d9cc

Please sign in to comment.