<h5 dir="auto">Description of the problem</h5>
<p dir="auto">When using BasisTextureLoaded with a ShaderPass, the texture will only be used properly if the uniform value is set after the instantiation of the ShaderPass.</p>
<blockquote>
<p dir="auto">let shaderPass = new ShaderPass( {</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="vertexShader:   vertexShader,
fragmentShader:  fragmentShader,
uniforms: {
  'tDiffuse': { value: null },
  'tTexture': { value: texture }
}"><pre class="notranslate"><code class="notranslate">vertexShader:   vertexShader,
fragmentShader:  fragmentShader,
uniforms: {
  'tDiffuse': { value: null },
  'tTexture': { value: texture }
}
</code></pre></div>
<p dir="auto">} );</p>
<p dir="auto">//Will only work if you add this line.<br>
shaderPass.uniforms[ "tTexture" ].value = texture;</p>
</blockquote>
<p dir="auto">Without this line, the texture2D( tTexture, vUv) will be return vec4( 0., 0., 0., 0. )</p>
<p dir="auto">I couldn't create a fiddle.<br>
I don't know it it's due to webworkers or to webassembly, or some path issues, but it was a mess.<br>
So I created a github repository.<br>
<a href="https://github.com/Horsetopus/threejs-basistexturelaoder-shaderpass-issue">https://github.com/Horsetopus/threejs-basistexturelaoder-shaderpass-issue</a></p>
<h5 dir="auto">Three.js version</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Dev</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> r113</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> ...</li>
</ul>
<h5 dir="auto">Browser</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Chrome</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Firefox</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Edge</li>
<li>Internet Explorer ? just won't work.</li>
</ul>
<h5 dir="auto">OS</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> All of them</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Windows</li>
<li>[?] macOS</li>
<li>[?] Linux</li>
<li>[?] Android</li>
<li>[?] iOS</li>
</ul>
<p dir="auto">UniformsUtils.merge use the clone method that does not seem to clone by reference. So uniforms variables are not update into the shader</p>
<p dir="auto">So this, is not working:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="uniforms = {
     time: { type: &quot;f&quot;, value: 1.0 },
};

var material = new THREE.ShaderMaterial( {
     uniforms: THREE.UniformsUtils.merge( [
         THREE.UniformsLib[ &quot;common&quot; ],
         uniforms
     ] ),
     ...
     ...

uniforms.time.value ++;"><pre class="notranslate"><span class="pl-s1">uniforms</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
     <span class="pl-c1">time</span>: <span class="pl-kos">{</span> <span class="pl-c1">type</span>: <span class="pl-s">"f"</span><span class="pl-kos">,</span> <span class="pl-c1">value</span>: <span class="pl-c1">1.0</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span>

<span class="pl-k">var</span> <span class="pl-s1">material</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-c1">THREE</span><span class="pl-kos">.</span><span class="pl-c1">ShaderMaterial</span><span class="pl-kos">(</span> <span class="pl-kos">{</span>
     <span class="pl-c1">uniforms</span>: <span class="pl-c1">THREE</span><span class="pl-kos">.</span><span class="pl-c1">UniformsUtils</span><span class="pl-kos">.</span><span class="pl-en">merge</span><span class="pl-kos">(</span> <span class="pl-kos">[</span>
         <span class="pl-c1">THREE</span><span class="pl-kos">.</span><span class="pl-c1">UniformsLib</span><span class="pl-kos">[</span> <span class="pl-s">"common"</span> <span class="pl-kos">]</span><span class="pl-kos">,</span>
         <span class="pl-s1">uniforms</span>
     <span class="pl-kos">]</span> <span class="pl-kos">)</span><span class="pl-kos">,</span>
     ...
     ...

<span class="pl-s1">uniforms</span><span class="pl-kos">.</span><span class="pl-c1">time</span><span class="pl-kos">.</span><span class="pl-c1">value</span> <span class="pl-c1">++</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Here my workaround</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="uniforms = THREE.UniformsUtils.merge([
    THREE.UniformsLib[ &quot;common&quot; ],
    myuniforms
]);

uniforms.time={ type: &quot;f&quot;, value: 1.0 };

var groundMaterial = new THREE.ShaderMaterial( {
     uniforms: uniforms,
     ...
     ...

uniforms.time.value ++;"><pre class="notranslate"><span class="pl-s1">uniforms</span> <span class="pl-c1">=</span> <span class="pl-c1">THREE</span><span class="pl-kos">.</span><span class="pl-c1">UniformsUtils</span><span class="pl-kos">.</span><span class="pl-en">merge</span><span class="pl-kos">(</span><span class="pl-kos">[</span>
    <span class="pl-c1">THREE</span><span class="pl-kos">.</span><span class="pl-c1">UniformsLib</span><span class="pl-kos">[</span> <span class="pl-s">"common"</span> <span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-s1">myuniforms</span>
<span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-s1">uniforms</span><span class="pl-kos">.</span><span class="pl-c1">time</span><span class="pl-c1">=</span><span class="pl-kos">{</span> <span class="pl-c1">type</span>: <span class="pl-s">"f"</span><span class="pl-kos">,</span> <span class="pl-c1">value</span>: <span class="pl-c1">1.0</span> <span class="pl-kos">}</span><span class="pl-kos">;</span>

<span class="pl-k">var</span> <span class="pl-s1">groundMaterial</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-c1">THREE</span><span class="pl-kos">.</span><span class="pl-c1">ShaderMaterial</span><span class="pl-kos">(</span> <span class="pl-kos">{</span>
     <span class="pl-c1">uniforms</span>: <span class="pl-s1">uniforms</span><span class="pl-kos">,</span>
     ...
     ...

<span class="pl-s1">uniforms</span><span class="pl-kos">.</span><span class="pl-c1">time</span><span class="pl-kos">.</span><span class="pl-c1">value</span> <span class="pl-c1">++</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">[r71]</p>