@@ -20,7 +20,6 @@ import {RoughnessMipmapper} from 'three/examples/jsm/utils/RoughnessMipmapper.js
2020import { $clone , $prepare , GLTFInstance , PreparedGLTF } from '../GLTFInstance.js' ;
2121import { Renderer } from '../Renderer.js' ;
2222import { alphaChunk } from '../shader-chunk/alphatest_fragment.glsl.js' ;
23- import { normalmapChunk } from '../shader-chunk/normalmap_pars_fragment.glsl.js' ;
2423
2524
2625const $roughnessMipmapper = Symbol ( 'roughnessMipmapper' ) ;
@@ -159,19 +158,15 @@ export class ModelViewerGLTFInstance extends GLTFInstance {
159158 // via onBeforeCompile.toString(), so these two functions do the same
160159 // thing but look different in order to force a proper recompile.
161160 const oldOnBeforeCompile = material . onBeforeCompile ;
162- const patchFragment = ( shader : Shader ) => {
163- shader . fragmentShader =
164- shader . fragmentShader
165- . replace ( '#include <alphatest_fragment>' , alphaChunk )
166- . replace ( '#include <normalmap_pars_fragment>' , normalmapChunk ) ;
167- } ;
168161 clone . onBeforeCompile = ( material as any ) . isGLTFSpecularGlossinessMaterial ?
169162 ( shader : Shader ) => {
170163 oldOnBeforeCompile ( shader , undefined as any ) ;
171- patchFragment ( shader ) ;
164+ shader . fragmentShader = shader . fragmentShader . replace (
165+ '#include <alphatest_fragment>' , alphaChunk ) ;
172166 } :
173167 ( shader : Shader ) => {
174- patchFragment ( shader ) ;
168+ shader . fragmentShader = shader . fragmentShader . replace (
169+ '#include <alphatest_fragment>' , alphaChunk ) ;
175170 oldOnBeforeCompile ( shader , undefined as any ) ;
176171 } ;
177172 // This makes shadows better for non-manifold meshes
0 commit comments