cleanup flesh cube

This commit is contained in:
Crispy 2024-08-10 10:53:16 +02:00
parent 59f8cdd8dd
commit 9f349f3616
2 changed files with 14 additions and 34 deletions

View file

@ -3109,7 +3109,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
type: 3
objectId: 4e7f3dcf-e925-473a-89e2-dfe6cfe7eac5
randomNum: 77268264
randomNum: 67221367
unityVersion: 2021.3.41f1
cckVersion: 3.10:132
--- !u!114 &2089314931

View file

@ -1,12 +1,6 @@
Shader "CrispyPin/FleshCube2"
{
Properties
{
[Header(Raymarcher Properties)]
_MaxSteps ("Max steps", Integer) = 128
_MaxDist ("Max distance", Float) = 128
_SurfDist ("Surface distance threshold", Range(.0001, .05)) = .001
}
Properties {}
SubShader
{
Tags { "RenderType"="Opaque" }
@ -19,46 +13,32 @@ Shader "CrispyPin/FleshCube2"
#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 MAX_STEPS 128
#define MAX_DIST 128
#define SURF_DIST 0.01
#define SCENE_FN main
//#define LIGHT_FN lighting
#define SCENE_SCALE 0.04
#define REFLECTIONS 2
#define DISCARD_ON_MISS
#include "lib/libgarbage.cginc"
#define SPEED 1.5
SurfacePoint main(float3 p) {
Material mRed = mat(.95, 0.1, 0.1, 0.4);
Material mCut = mat(.7, 0.2, 0.1, 0.4);
Material mEdge = mat(.7, 0.2, 0.1, 0.4);
SurfacePoint d;
// base
float3 bias = -pow(sin(_Time*60 + p.y*0.1), 8)*.5+1.3;
d = mGyroid(p, .5, bias, 0.2, mCut);
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);
d.dist -= sdGyroid(gp, 1.63, .5, 0.2) * 0.3;
d.dist += sdGyroid(gp, 3.327, 0, 0.2) * 0.1;
d.dist += sdGyroid(gp, 7.351, .5, 0.2) * 0.1;
d.dist -= sdGyroid(gp, 17.351, .5, 0.2) * 0.05;
d.dist -= sdGyroid(gp, 23.521, .2, 0.2) * 0.05;
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);
d = qIntersect(d, mBox(p, 25, mRed));
d = qIntersect(d, mBox(p, 25, mRed), 0.8);
return d;
}
ENDCG