Added new shaders
Some checks failed
CI / Native Windows Build And Tests (push) Has been cancelled
CI / React UI Build (push) Has been cancelled
CI / Windows Release Package (push) Has been cancelled

This commit is contained in:
2026-05-05 22:36:52 +10:00
parent 119e49aec1
commit ce5905373a
32 changed files with 882 additions and 78 deletions

84
shaders/ether/shader.json Normal file
View File

@@ -0,0 +1,84 @@
{
"id": "ether",
"name": "Ether",
"description": "Raymarched ether field. Original by nimitz 2014 (twitter: @stormoid), adapted from https://www.shadertoy.com/view/MsjSW3.",
"category": "Generative",
"entryPoint": "shadeVideo",
"parameters": [
{
"id": "speed",
"label": "Speed",
"type": "float",
"default": 1.0,
"min": 0.0,
"max": 4.0,
"step": 0.01
},
{
"id": "depth",
"label": "Depth",
"type": "float",
"default": 2.5,
"min": 0.2,
"max": 8.0,
"step": 0.01
},
{
"id": "density",
"label": "Density",
"type": "float",
"default": 0.7,
"min": 0.0,
"max": 2.0,
"step": 0.01
},
{
"id": "brightness",
"label": "Brightness",
"type": "float",
"default": 1.0,
"min": 0.0,
"max": 3.0,
"step": 0.01
},
{
"id": "contrast",
"label": "Contrast",
"type": "float",
"default": 1.0,
"min": 0.25,
"max": 3.0,
"step": 0.01
},
{
"id": "offset",
"label": "Offset",
"type": "vec2",
"default": [0.9, 0.5],
"min": [0.0, 0.0],
"max": [2.0, 2.0],
"step": [0.001, 0.001]
},
{
"id": "baseColor",
"label": "Base Color",
"type": "color",
"default": [0.1, 0.3, 0.4, 1.0]
},
{
"id": "energyColor",
"label": "Energy Color",
"type": "color",
"default": [1.0, 0.5, 0.6, 1.0]
},
{
"id": "sourceMix",
"label": "Source Mix",
"type": "float",
"default": 0.0,
"min": 0.0,
"max": 1.0,
"step": 0.01
}
]
}

View File

@@ -0,0 +1,40 @@
float2x2 rotation2(float angle)
{
float c = cos(angle);
float s = sin(angle);
return float2x2(c, -s, s, c);
}
float etherMap(float3 p, float time)
{
p.xz = mul(rotation2(time * 0.4), p.xz);
p.xy = mul(rotation2(time * 0.3), p.xy);
float3 q = p * 2.0 + time;
float wave = sin(q.x + sin(q.z + sin(q.y))) * 0.5;
return length(p + float3(sin(time * 0.7), sin(time * 0.7), sin(time * 0.7))) * log(length(p) + 1.0) + wave - 1.0;
}
float4 shadeVideo(ShaderContext context)
{
float2 resolution = max(context.outputResolution, float2(1.0, 1.0));
float2 fragCoord = context.uv * resolution;
float2 p = fragCoord / resolution.y - offset;
float time = context.time * speed;
float3 color = float3(0.0, 0.0, 0.0);
float d = depth;
for (int i = 0; i <= 5; ++i)
{
float3 rayPosition = float3(0.0, 0.0, 5.0) + normalize(float3(p, -1.0)) * d;
float rz = etherMap(rayPosition, time);
float f = clamp((rz - etherMap(rayPosition + float3(0.1, 0.1, 0.1), time)) * 0.5, -0.1, 1.0);
float3 light = baseColor.rgb + energyColor.rgb * 5.0 * f;
color = color * light + smoothstep(2.5, 0.0, rz) * density * light;
d += min(rz, 1.0);
}
color = pow(max(color * brightness, float3(0.0, 0.0, 0.0)), float3(1.0 / max(contrast, 0.001)));
return saturate(lerp(float4(color, 1.0), context.sourceColor, sourceMix));
}