I’m having some trouble with creating a ProceduralTexture from shader source code. Specifically,
new ProceduralTexture('texture', mapSize, fragment, scene, null, true, true);
How can I pass shader source into fragment?
Attempting to do so by passing the source results in BJS attempting to fetch ./src/Shaders/<shader source URL encoded>. (repro)
Attempting to use a blob/object URL or a data: URL results in the same behavior.
Looking through the library’s code, it looked like source: was prefixed to some shader source strings. Doing so, Babylon did not try to fetch it but instead attempted to load it. (repro)
Now, it was complaining about a return statement, so I added a newline after source:. (repro)
BJS then started complaining about float precision. I was #includeing my utils before declaring the float precision, so I fixed that. (repro)
I then got an error about texture overloads, redinfitions, etc. Looking at the error, it appears as though BJS has duplicated the shader code. (repro)