Plane with distance function
Hello,
I'm exploring jit.gen with the distance function of a plane.
http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm
The idea suggested for a plane is:
float sdPlane( vec3 p, vec4 n )
{
// n must be normalized
return dot(p,n.xyz) + n.w;
}
So in jit.gen I add two branches.
The first is the dot product of a vec3 normalized between -1 to 1. and three components from another vector.
the second branche is the w value (4th component) from the other vector.
Max Patch
Copy patch and select New From Clipboard in Max.
I does not give a plane.
Any advice would be appreciated …
Max Patch
Copy patch and select New From Clipboard in Max.
The vec4 n value is a constant parameter. You have it set to snorm: