Plane with distance function


    May 06 2013 | 2:28 pm
    Hello,
    I'm exploring jit.gen with the distance function of a plane.
    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.
    I does not give a plane.
    Any advice would be appreciated …

    • May 06 2013 | 3:50 pm
      The vec4 n value is a constant parameter. You have it set to snorm: