2024-08-10 10:45:04 +02:00
|
|
|
Shader "CrispyPin/FleshCube2"
|
|
|
|
{
|
2024-08-10 10:53:16 +02:00
|
|
|
Properties {}
|
2024-08-10 10:45:04 +02:00
|
|
|
SubShader
|
|
|
|
{
|
|
|
|
Tags { "RenderType"="Opaque" }
|
|
|
|
Cull Front
|
|
|
|
LOD 100
|
|
|
|
|
|
|
|
Pass
|
|
|
|
{
|
|
|
|
CGPROGRAM
|
|
|
|
#pragma vertex vert
|
|
|
|
#pragma fragment frag
|
|
|
|
|
2024-08-10 10:53:16 +02:00
|
|
|
#define MAX_STEPS 128
|
|
|
|
#define MAX_DIST 128
|
|
|
|
#define SURF_DIST 0.01
|
2024-08-10 10:45:04 +02:00
|
|
|
|
|
|
|
#define SCENE_FN main
|
|
|
|
#define SCENE_SCALE 0.04
|
|
|
|
#define REFLECTIONS 2
|
|
|
|
#define DISCARD_ON_MISS
|
|
|
|
|
|
|
|
#include "lib/libgarbage.cginc"
|
|
|
|
|
|
|
|
SurfacePoint main(float3 p) {
|
|
|
|
Material mRed = mat(.95, 0.1, 0.1, 0.4);
|
2024-08-10 10:53:16 +02:00
|
|
|
Material mEdge = mat(.7, 0.2, 0.1, 0.4);
|
2024-08-10 10:45:04 +02:00
|
|
|
SurfacePoint d;
|
|
|
|
|
2024-08-10 10:53:16 +02:00
|
|
|
float3 bias = -pow(sin(_Time*60 + p.y*0.1), 8) * .5 + 1.3;
|
|
|
|
d = mGyroid(p, .5, bias, 0.2, mEdge);
|
2024-08-10 10:45:04 +02:00
|
|
|
float3 gp = p + sin(_Time + p*0.1);
|
2024-08-10 10:53:16 +02:00
|
|
|
d.dist -= sdGyroid(gp, 1.63, .5, .2) * .3;
|
|
|
|
d.dist += sdGyroid(gp, 3.327, 0, .2) * .1;
|
|
|
|
d.dist += sdGyroid(gp, 7.351, .5, .2) * .1;
|
|
|
|
d.dist -= sdGyroid(gp, 17.351, .5, .2) * .05;
|
|
|
|
d.dist -= sdGyroid(gp, 23.521, .2, .2) * .05;
|
2024-08-10 10:45:04 +02:00
|
|
|
d = qUnion(d, mSphere(p, 6 + bias*3, mRed), 5);
|
2024-08-10 10:53:16 +02:00
|
|
|
d = qIntersect(d, mBox(p, 25, mRed), 0.8);
|
2024-08-10 10:45:04 +02:00
|
|
|
return d;
|
|
|
|
}
|
|
|
|
ENDCG
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|