hohkaminen alhaalta

This commit is contained in:
Teemu Järvisalo
2025-07-29 20:57:34 +03:00
parent 700d7caf6d
commit 2c03c51193
2 changed files with 38 additions and 17 deletions

View File

@ -13,6 +13,15 @@ layout(location = 700) uniform vec3 test; // shapes test
layout(binding = 0) uniform sampler2D u_ShapesTex; // uniform sampler2D shapes texture
// float u_time = syncs[0];
vec3 palette(float t){
vec3 a=vec3(0.46,0.2,0.94);
vec3 b=vec3(0.66,0.64,0.77);
vec3 c=vec3(0.91,0.62,0.97);
vec3 d=vec3(0.26,0.2,0.84);
return a+b*cos(6.28318*(c*t+d));
}
vec2 getUV() {
const vec2 scale = vec2(0.00104166667, 0.00185185185);
return gl_FragCoord.xy * scale - 1.0;
@ -105,7 +114,7 @@ vec2 opU(vec2 d1, vec2 d2) {
vec2 mapScene(in vec3 p) {
float res = 1e8;
float res = p.y;
float mat = 0.;
float hexRadius = 0.85;
@ -428,6 +437,16 @@ vec3 render(vec2 uv) {
col = shading(hitPos, nor, rayDir, t.y);
}
//glow from the bottom
vec3 bGlowColor = palette(syncs[0] * .5); // color change
float bGlowDistance = 0.3;
vec3 p = camPos + t.x * rayDir;
vec3 bGlowLevel = bGlowColor * exp(-(p.y + 0.0) / bGlowDistance) * 9900.;
col += bGlowLevel;
col = clamp(mix(bGlowLevel, col, t.z), 0.0, 1.0);
// distance fog + bass thunder
float fogAmount = 0.01;
col = col * exp(-t.x * fogAmount) + applyFog(col, t.x, rayDir, vec3(0., -0.5, 1.8), fogAmount) * (1.0 - exp(-t.x * fogAmount));