This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////////////////////////////////////////////////// | |
// | |
// HG_SDF | |
// | |
// GLSL LIBRARY FOR BUILDING SIGNED DISTANCE BOUNDS | |
// | |
// version 2015-12-15 (initial release) | |
// | |
// Check http://mercury.sexy/hg_sdf for updates | |
// and usage examples. Send feedback to [email protected]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://iquilezles.org/www/articles/distfunctions/distfunctions.htm | |
// -- Distant functions | |
float sdPlane( vec3 p ) {return p.y+0.2;} | |
float sdSphere( vec3 p, float s ) {return length(p)-s;} | |
float sdCylinder( vec3 p, vec3 c ){ return length(p.xz-c.xy)-c.z; } | |
float udRoundBox( vec3 p, vec3 b, float r ){return length(max(abs(p)-b,0.0))-r;} | |
float udRoundBoxInf( vec3 p, vec2 b, float r ){return length(max(vec3(abs(p.xz)-b,0.0),0.0))-r;} | |
float maxcomp( vec3 p ) {return max(p.x,max(p.y,p.z));} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Custom/Curved" { | |
Properties { | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
_QOffset ("Offset", Vector) = (0,0,0,0) | |
_Dist ("Distance", Float) = 100.0 | |
} | |
SubShader { | |
Tags { "RenderType"="Opaque" } | |
Pass | |
{ |
NewerOlder