summaryrefslogtreecommitdiffstats
path: root/Shaders/iq_sdf.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2023-08-10 18:22:03 -0700
committeryum <yum.food.vr@gmail.com>2023-08-10 18:22:03 -0700
commitf7fbd1965543f47596eae491bbe8947bf44d1518 (patch)
treee1cd568d74f2f2a63fd5b2ff5b86eae099bcf80e /Shaders/iq_sdf.cginc
parente9a8b991552d08823b0f44b238f4afaede53c54e (diff)
Add basic PBR parameters to new shader
No UVs for raymarched geometry yet, so drop textures. Also drop most old shader settings.
Diffstat (limited to 'Shaders/iq_sdf.cginc')
-rw-r--r--Shaders/iq_sdf.cginc7
1 files changed, 7 insertions, 0 deletions
diff --git a/Shaders/iq_sdf.cginc b/Shaders/iq_sdf.cginc
index d82e24c..7951261 100644
--- a/Shaders/iq_sdf.cginc
+++ b/Shaders/iq_sdf.cginc
@@ -130,6 +130,13 @@ float smoothstep_quintic(float x)
return x*x*x*(x*(x*6.0-15.0)+10.0);
}
+float distance_from_line_segment( float3 p, float3 a, float3 b, float r )
+{
+ float3 pa = p - a, ba = b - a;
+ float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 );
+ return length( pa - ba*h ) - r;
+}
+
// End licensed section
#endif // __IQ_SDF_INC__