Pass value to shader from GUI

Hi guys, I created a Shader in the Playground: Babylon.js Playground

If you use the mouse wheel (zoom in) the sphere will vanish eventually due to the discard command in line 57.

Now I would like to pass in different vDiscardZ values. My use case would be, that I create a slider in my GUI and if the users drags the slider the vDiscardZ value gets changed in realtime.

How would I approach that?

Furthermore, would it be possible to build this kind of shader in the new Node Material Editor? I was playing around a bit but wasn’t able to get it done.

1 Like

Here we are:

It will be far easier to do it in the Node Editor but we need to add a new block (DiscardBlock). I will add that block next week and comment here with a demo :wink:

1 Like

Thanks for your help!
Looking forward to the Node Editor example :ok_hand:

1 Like

Here we are: Babylon.js Node Material Editor

1 Like