Use hg_sdf
This commit is contained in:
parent
1df2a90dd8
commit
c33efde305
1 changed files with 5 additions and 14 deletions
|
@ -44,24 +44,15 @@ void mapMaterial(
|
|||
tIndex = 0;
|
||||
}
|
||||
|
||||
float box( vec3 p , vec3 sz )
|
||||
{
|
||||
vec3 n = abs( p ) - sz;
|
||||
return max( max( n.x , n.y ) , n.z );
|
||||
}
|
||||
|
||||
vec2 RM_Map( vec3 pos )
|
||||
{
|
||||
pos = pos - vec3( 0 , 0 , 0 );
|
||||
vec3 q = pos;
|
||||
q.xy = mod( q.xy + 4. , 8. ) - 4.;
|
||||
q.xz *= mat2(
|
||||
cos( 1 ) , -sin(1) ,
|
||||
sin( 1 ) , cos( 1 ) );
|
||||
return vec2( mix( box( q , vec3( 1.5 ) ) ,
|
||||
length( q ) - 1.5 ,
|
||||
HG_pMod2( q.xy , vec2( 8. ) );
|
||||
HG_pR( q.xz , 1 );
|
||||
return vec2( mix( HG_fBox( q , vec3( 1.5 ) ) ,
|
||||
HG_fSphere( q , 1.5 ) ,
|
||||
.35 ) ,
|
||||
step( 0. , 3 - length( pos.xy ) ) );
|
||||
step( 0. , -HG_fSphere( pos , 3 ) ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue