Hi! I tried to use this shadow shader in my project. All works ok, but i would be like to change some defines in shader dynamically by dat gui, to see live result:
%NUM_SAMPLES% is a placeholder which is going to be replaced with 30. So if you try to replace %NUM_SAMPLES% again, the value does not exist anymore. This happens with all defines.
Even if you perform the replacement correctly, three.js will not update the shader program. Setting material.needsUpdate to true does actually not help here. The problem is that three.js caches the material inside WebGLRenderer and does not assume shader chunks are modified on-the-fly for built-in materials.
So if you still want to achieve your goal, you have to fix your regex and use a custom shader material instead.