I’m trying to make a material function I’ll use in a lot of materials, and I’m having no luck with it- the math is beyond me, I’m afraid.
The material function I’m talking about will be used to lerp visibility on a particle. I want to be able to set up a curve with definable points throughout the distance from the camera.
Distance 0-A= 0
A-B= ramp from 0 to 1
B-C= 1
C-D= ramp from 1 to 0
Anything past distance D would stay at 0.
Basically, I’m trying to make a particle be invisible up close, but then start to fade in at, say 500 meters from the camera. From there until 1000 meters, it ramps up to full visibility. From 1000 meters to 2000 meters, it stays fully visible. After 2000 meters, it ramps down to invisible by 3000 meters, and stays invisible at any distance past that.
Anyone know how to construct a shader graph to do this? I’ve tried setting up a curve and atlas in the material, which works… but only for the ranges defined in the curve. I’m trying to make this into a material function with four scalar inputs so that I can use this in multiple materials.
Thanks!