Hi, I’m toying around with Babylon. I’m interested in writing shaders where I take the raw GLSL created by babylon, changing it automatically by a compiler, and putting it back into a babylonjs shader. I want to do this to plug a custom graph editor built on top of a custom compiler, into a raw babylonjs shader.
I’ve been poking around the context at runtime. My first question is: What’s the best way to get the raw GLSL from a babylon shader? I see material._effect._fragmentSourceCode - is that a reliable place? Does the scene need to render first for this to be populated?
Second: if I take the above fragment and vertex source from a babylon PBR shader, set that to BABYLON.Effect.ShadersStore['customVertexShader'] =...
and BABYLON.Effect.ShadersStore['customFragmentShader'] =...
and create a new shader like:
shaderMaterial = new BABYLON.ShaderMaterial(
'shader',
scene,
{
vertex: 'custom',
fragment: 'custom',
},
{
attributes: ['position', 'normal', 'uv'],
uniforms: [
'world',
'worldView',
'worldViewProjection',
'view',
'projection',
'Scene',
],
}
);
I get nothing rendered, and from WebGL, the warning/error
[.WebGL-0x7f86a6808200]RENDER WARNING: there is no texture bound to the unit 0
babylon:1
WebGL: too many errors, no more errors will be reported to the console for this context.
Is this because I didn’t include enough uniforms and attributes in the shader definition?