50 lines
908 B
Text
50 lines
908 B
Text
Shader "CrispyPin/Gyroid"
|
|
{
|
|
Properties
|
|
{
|
|
[Header(Raymarcher Properties)]
|
|
_MaxSteps ("Max steps", Int) = 128
|
|
_MaxDist ("Max distance", Float) = 128
|
|
_SurfDist ("Surface distance threshold", Range(0.0001, 0.05)) = 0.001
|
|
|
|
}
|
|
SubShader
|
|
{
|
|
Tags { "RenderType"="Opaque" }
|
|
Cull Front
|
|
LOD 100
|
|
|
|
Pass
|
|
{
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
int _MaxSteps;
|
|
float _MaxDist;
|
|
float _SurfDist;
|
|
#define MAX_STEPS _MaxSteps
|
|
#define MAX_DIST _MaxDist
|
|
#define SURF_DIST _SurfDist
|
|
|
|
// #define REFLECTIONS 5
|
|
|
|
#define SCENE_FN main
|
|
|
|
#define DISCARD_ON_MISS
|
|
#include "lib/libgarbage.cginc"
|
|
|
|
|
|
SurfacePoint main(float3 p) {
|
|
SurfacePoint d;
|
|
d = qRound(mBox(p, 1), 0.01);
|
|
d = qIntersect(d, mGyroid(p, 16, 0, 0.2), 0.01);
|
|
// sdGyroid(p, 12, sin(_Time.y) * UNITY_PI * 0.5, 0.2),
|
|
// d.mat = mat(.8, 1);
|
|
return d;
|
|
}
|
|
|
|
ENDCG
|
|
}
|
|
}
|
|
}
|