NME TBNBlock world input doesn't work if connected to another (vertex) node block

Looks like there is still one minor issue with the NME TBNBlock. After latest changes it produces shader error if world input is connected to a vertex node block’s matrix output instead of the world Input block.

See a Playground example here, where world input comes from InstancesBlock: https://playground.babylonjs.com/#VL1FPT#8

The fix is very simple. Just also change the world input target to NodeMaterialBlockTargets.Fragment on this line: Babylon.js/TBNBlock.ts at 3ae2b8e803b7a3bc967c99c31e912c8c11bd2dd8 · BabylonJS/Babylon.js · GitHub

You can confirm the fix by uncommenting line 41 in my Playground example. :slightly_smiling_face:

Alternative would be to just switch the whole TBNBlock to NodeMaterialBlockTargets.Fragment type, as it technically already is so. Then there would be no need to specify the input/output targets separately. But since this would likely also involve moving the source file from Dual folder to Fragment folder for consistency, I’ll leave it for the core developers to figure out which way to fix this.

cc @sebavan

As it is fragment only I would say you should move it in fragment only if that solves the issue. Could you do a PR for it ?

Currently you are the only one using it as it is a freshly built node so no issue at all to move it now.

Ok, I’ll do a PR for it.

I assume there are no other considerations for moving a source file than just updating the other referencing files, remove it from Dual folder index.ts and add to Fragment folder index.ts?

Nope, this is still so new and you are currently the only user of it so it should be totally fine :slight_smile: