Help with Node Materials

I have created a node material using NME
https://nme.babylonjs.com/#EPY8BV#32

I have used in this PG.
https://playground.babylonjs.com/#D8AK3Z#26
In this example, Alpha is either on or off.
How do I set the value to alpha?

How can I change the color value or roughness value in run time.
roughnessInputBlock.value = 0.9 Will this work?. If, I change the value , then how to bind this uniform value to the shader?
Can I have a documentation which describes about modifying node material’s shaders? I like to add clip plane code to node material. But, I dont know how and where to modify the code.

Thanks,
Gopinath Vellingiri

In your material, the alpha is retrieved from the block named “color”, so you can do:

const color = nodeMaterial.getBlockByName("color");
color.value.a = 0.1;

https://playground.babylonjs.com/#D8AK3Z#27

Same method than above, get the block you want with getBlockByName and change the value:

https://playground.babylonjs.com/#D8AK3Z#28

This doc should help: Node Material | Babylon.js Documentation

You need to make the dot product of the clipping plane equation with the world position to reject the fragment based on the sign of the result:

https://playground.babylonjs.com/#D8AK3Z#30

2 Likes

@Evgeni_Popov
Thanks