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!