details are at GitHub issue virtual-cast/babylon-mtoon-material#66.
This bugs may be caused by meshUboDeclaration or instancesDeclaration or something.
I’m waiting for any help.
details are at GitHub issue virtual-cast/babylon-mtoon-material#66.
This bugs may be caused by meshUboDeclaration or instancesDeclaration or something.
I’m waiting for any help.
I think you want to rename the files:
ubo-declaration => mtoonUboDeclaration
vertex-declaration => mtoonVertexDeclaration
fragment-declaration => mtoonFragmentDeclaration
When using #include<__decl__mtoonVertex>, the system is removing __decl__ and is replacing Vertex by UboDeclaration if the engine supports Ubo or by VertexDeclaration if not. Same kind of transformations for #include<__decl__mtoonFragment>.
The shaders are registered at constructor.
Isn’t that correct?
Yes it should work.
Are you sure you are using the updated instancesDeclaration.fx file? Can you console.log Effect.IncludesShadersStore["instancesDeclaration"] and make sure it’s the right one (and especially that you can see occurrences of WORLD_UBO).
result of console.log(Effect.IncludesShadersStore["instancesDeclaration"]);. babylon.js v5.0.0-alpha.25.
#ifdef INSTANCES
attribute vec4 world0;
attribute vec4 world1;
attribute vec4 world2;
attribute vec4 world3;
#if defined(THIN_INSTANCES) && !defined(WORLD_UBO)
uniform mat4 world;
#endif
#if defined(VELOCITY) || defined(PREPASS_VELOCITY)
attribute vec4 previousWorld0;
attribute vec4 previousWorld1;
attribute vec4 previousWorld2;
attribute vec4 previousWorld3;
#ifdef THIN_INSTANCES
uniform mat4 previousWorld;
#endif
#endif
#else
#if !defined(WORLD_UBO)
uniform mat4 world;
#endif
#if defined(VELOCITY) || defined(PREPASS_VELOCITY)
uniform mat4 previousWorld;
#endif
#endif
I wonder #if preprocessor should appear in compiled vertex code, but my error vertex code does not have any #if declaration, only #define have.
Perhaps preprocessor of #if or #ifdef processing timing problem?
proprocess #ifdef(this timing will only define MaterialDefine's #define) → generate uniform mat4 world → process #include and put #define WORLD_UBO but #ifdef already processed, so runtime vertex code has uniform mat4 world.
I tried to add WORLD_UBO = true to MToonMaterialDefines, it does not have error, but no mesh are rendered. And in WebGL1, VERTEX SHADER ERROR: 0:170: 'world' : undeclared identifier error appears.
(sorry for poor english)
There are two problems:
const uniformBuffers = ['Material', 'Scene', 'Mesh'];After those changes it does work for me locally.
Brilliant! It works for me! Thank you so much!