I build a NodeMaterial here: It build successfully and can preview in NME.
However, when I apply this material, here comes error: https://playground.babylonjs.com/#2FDQT5#1536
I believe this is caused by Reflection Block with environment texture on.
At this line, World Normal has not been declared in shader, which makes a error:
in vertex code: vec3 reflectionVector = vec3(reflectionMatrix * vec4(normalize().xyz, 0)).xyz;
Yes, something is wrong in the generated code. Pinging @Deltakosh
cc @Evgeni_Popov I believe this is an issue with the PBR node. Do you have time to check maybe?
Thanks a ton!
You should reuse the same “World pos” block for the PBR input than the one used to generate the vertex shader output, having two different blocks lead to wrong code generation in the vertex shader:
That works! Thanks for your response!
It’s just an idea, how about automatically reuse “World pos”( and more nodes). For example, if two nodes have the same type and also the same inputs, we can tell these two are the same.
Also, maybe we can have have a test tool to test all ShaderVariants to avoid “fake” success.