If I have two materials using the same shader code:
const mat1 = new THREE.RawShaderMaterial({
vertexShader: document.getElementById('vs').textContent,
fragmentShader: document.getElementById('fs').textContent,
});
const mat2 = new THREE.RawShaderMaterial({
vertexShader: document.getElementById('vs').textContent,
fragmentShader: document.getElementById('fs').textContent,
});
will THREE understand that these are the same shaders or will it compile them twice?
If the latter is the case, how can I make it so that shaders are compiled only once and then work with different materials? Materials have different uniforms objects.
Thank you, judging by cache property, it looks like the engine detects matching combinations of vertex/fragment shaders but if, say, a fragment shader is reused with different vertex shaders, it’ll be compiled twice, and the other way around, is that correct?