cvr-props/Assets/raymarched/flesh_cube.shader

48 lines
1.1 KiB
Text
Raw Normal View History

Shader "CrispyPin/FleshCube2"
{
2024-08-10 10:53:16 +02:00
Properties {}
SubShader
{
Tags { "RenderType"="Opaque" }
Cull Front
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#define MAX_STEPS 100
2024-08-10 10:53:16 +02:00
#define MAX_DIST 128
#define SURF_DIST 0.025
#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);
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);
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;
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);
return d;
}
ENDCG
}
}
}