Unity3d shader e -f convert to glsl

566 views Asked by At

I am trying to convert to a shader in Unity3D to normal glsl shader.

The code is :

Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, e-f)));

I know the lerp need to be convert to mix and saturate to clamp(xxx, 0.0, 1.0).

But I don't know how to convert the e - f part in the code above.

Any suggestion will be appreciated, thanks :)

1

There are 1 answers

1
Kulkek On

You can see the code generated by your graph : right click on any node -> Show generated code. For this node the glsl function generated is :

void Unity_ReplaceColor_float(float3 In, float3 From, float3 To, float Range, out float3 Out, float Fuzziness)
{
    float Distance = distance(From, In);
    Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 1e-5f)));
}