Closed michaelsakharov closed 2 years ago
I have defined the THREE.Renderers.Shaders.ShaderChunk.cs Class to save and utilize the Shader file as a variable, but it has not been reflected in the source yet. Whenever the glsl files of Three.js are changed, it is cumbersome to modify the corresponding variable of the ShaderChunk class every time. I'm still thinking of operating it as a file.
If you need the glsl of the variable type you specify, Remove readonly of ShaderChunkDirectionary in ShaderLib.cs, and ShaderChunkDictionary.Add(lights_fragment_begin filepath, CSM Fragment content) You may be able to use it by modifying it.
Thank you
added ShaderChunk.cs Class to save and utilize the Shader file as a variable
Having Shader Chunks in files actually prevents one of the things Three.js supports, Which is Overwriting Shaders from code. The Cascaded Shadow Mapping example from here: https://github.com/mrdoob/three.js/tree/dev/examples/js/csm is Overwriting the lights_fragment_begin and lights_pars_begin shaders with a new one that supports CSM. This is possible because the shaders are stored in variables, it seems this used to be the case here but was replaced with files. Sure you could replace the Files, But that means Losing the original, so Disabling your changes means Reverting the file, it is no longer possible to Toggle CSM On and Off without Losing Performance with it off. Being able to Overwrite but also keep the previous shader is all possible In code in a much simpler/easier way. It's also in general much harder to replace files From code, and The code doesn't support reloading said files so replacing them from code isn't really possible.