fuckingtech/public/assets/glsl/lygia/sdf/opExtrude.glsl
Elias Rhouzlane bf76c6b086 fix: code
2025-04-06 17:23:52 +02:00

16 lines
368 B
GLSL

/*
contributors: Inigo Quiles
description: extrude operation of a 2D SDFs into a 3D one
use: <float> opExtrude( in <vec3> p, in <float> sdf, in <float> h )
*/
#ifndef FNC_OPEXTRUDE
#define FNC_OPEXTRUDE
float opExtrude( in vec3 p, in float sdf, in float h ) {
vec2 w = vec2( sdf, abs(p.z) - h );
return min(max(w.x,w.y),0.0) + length(max(w,0.0));
}
#endif