LYGIA Shader Library

planeSDF (lygia/sdf/planeSDF)

generate the SDF of a plane

Use:

<float> planeSDF( in <vec3> pos, in <vec2> h )

Check it on Github


#ifndef FNC_PLANESDF
#define FNC_PLANESDF
float planeSDF( vec3 p ) { 
   return p.y; 
}

float planeSDF(vec3 p, vec3 planePoint, vec3 planeNormal) {
    return (dot(planeNormal, p) + dot(planeNormal, planePoint)) / length(planeNormal);
}
#endif

Use:

<float> planeSDF( in <float3> pos, in <float2> h )

Check it on Github


#ifndef FNC_PLANESDF
#define FNC_PLANESDF
float planeSDF( float3 p ) { 
   return p.y; 
}

float planeSDF(float3 p, float3 planePoint, float3 planeNormal) {
    return (dot(planeNormal, p) + dot(planeNormal, planePoint)) / length(planeNormal);
}
#endif

Dependencies:

Use:

<float> planeSDF( in <float3> pos, in <vec2> h )

Check it on Github



#ifndef FNC_PLANESDF
#define FNC_PLANESDF

inline  __host__ __device__ float planeSDF(float3 p) {  return p.y; }
inline  __host__ __device__ float planeSDF(float3 p, float3 planePoint, float3 planeNormal) { return (dot(planeNormal, p) + dot(planeNormal, planePoint)) / length(planeNormal); }

#endif

License

LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.

Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).

It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.

Get the latest news and releases

Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository