Im totaly new at shaders. Node material makes life easier for people like me. But still, im struggling with one thing:
Im trying to interpolate alpha for mesh instances (using distance and time).
Here is the link https://nodematerial-editor.babylonjs.com/#B08JDF#18
The querstion is: How to set whole mesh alpha to 0 or 1, without “fading in”? As u can see it goes as a wave from some point (called origin) and checks if mesh is in the radius then alpha is 1, otherwise its 0.
I tried clamp, tried output of condition block straight away, but still there is fading effect.
Thanks for your reply!
In your example I dont see anything related to the node materials, I expand the radius dinamically using interpolation functions and set the alpha depending on the distance. Am I able to get an access to the custom buffer data (like color) within node material?
Yes you can! You can just access the mesh.color block on the NME, it will have the per-instance attribute. Since you mentioned you change the radius dynamically, I changed the approach a bit and instead of calculating the distance and defining the color in code, I’m passing the position of the instance as the color attribute itself (you don’t need to use the color attribute for colors only, you can use for anything that needs to be set on the instance level), and performing the calculation on the node material: Babylon.js Playground (babylonjs.com)