paletti + post process säätö
This commit is contained in:
@ -8,15 +8,24 @@ layout(location = 0) uniform float syncs[11];
|
||||
layout(location = 20) uniform float fft_output[512]; // FFT_SIZE / 4
|
||||
// float u_time = syncs[0];
|
||||
|
||||
// paletti muunnos: arg 0.75 --> 0.
|
||||
vec3 palette(float t, float arg){
|
||||
vec3 a=vec3(0.39,0.56,0.47);
|
||||
vec3 b=vec3(0.54,0.56,0.51);
|
||||
vec3 c=vec3(0.45,0.79,0.42);
|
||||
vec3 d=vec3(0.08,0.37,arg); // t<>st<73> viimenen floatti siirrett<74>v<EFBFBD> 0, kun tehd<68><64>n paletti switch
|
||||
// paletti muunnos: arg 0.8 --> 0.5
|
||||
vec3 palette(float t, float arg, float arg2){
|
||||
vec3 a=vec3(0.52,0.56,0.47);
|
||||
vec3 b=vec3(0.62,0.56,0.51);
|
||||
vec3 c=vec3(0.43,0.79,0.42);
|
||||
vec3 d=vec3(arg,0.42,arg2); // t<>st<73> viimenen floatti siirrett<74>v<EFBFBD> 0, kun tehd<68><64>n paletti switch
|
||||
return a+b*cos(6.28318*(c*t+d));
|
||||
}
|
||||
|
||||
/*
|
||||
vec3 palette(float t){
|
||||
vec3 a=vec3(0.52,0.56,0.47);
|
||||
vec3 b=vec3(0.62,0.56,0.51);
|
||||
vec3 c=vec3(0.43,0.79,0.42);
|
||||
vec3 d=vec3(0,0.42,0.63);
|
||||
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;
|
||||
@ -128,7 +137,7 @@ vec2 mapScene(in vec3 p) {
|
||||
r.xz *= rot2D(0.5);
|
||||
|
||||
//float d1 = hexPylon(vec3(r.x, (r.y + hexHeight / 2), r.z), vec2(hexRadius, hexHeight / 2));
|
||||
float d1 = hexPylon(vec3(r.x, r.y, r.z), vec2(hexRadius, hexHeight));
|
||||
float d1 = hexPylon(vec3(r.x, r.y, r.z), vec2(hexRadius, hexHeight + 5));
|
||||
|
||||
res = (d1 < res) ? d1 : res;
|
||||
|
||||
@ -182,7 +191,7 @@ vec3 phongLighting(vec3 p, vec3 normal, vec3 lightPos, vec3 viewPos, vec3 lightC
|
||||
vec3 diffuse = diff * lightColor;
|
||||
|
||||
// Specular
|
||||
float specularStrength = 11.5;
|
||||
float specularStrength = 13.5;
|
||||
float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32.0); // shininess
|
||||
vec3 specular = specularStrength * spec * lightColor;
|
||||
|
||||
@ -197,11 +206,15 @@ vec3 calcNormal(vec3 pos) {
|
||||
}
|
||||
|
||||
vec3 pal(float color) {
|
||||
vec3 c = palette(color, 0.75);
|
||||
vec3 c2 = palette(color, 0.0);
|
||||
|
||||
float t = clamp((syncs[0] - 12.0) / 2.0, 0.0, 1.0); // Smoothly ramps from 0 to 1 after 12s
|
||||
color *= 0.2;
|
||||
|
||||
vec3 c = palette(color, 0.25, 0.63);
|
||||
vec3 c2 = palette(color, 0.5 ,0.2);
|
||||
|
||||
float t = clamp((syncs[0] - 129.0) / 2.0, 0.0, 1.0); // Smoothly ramps from 0 to 1 after 12s
|
||||
return mix(c, c2, t); // Blend between c and c2 over ~2 seconds
|
||||
//return c2;
|
||||
}
|
||||
|
||||
vec3 applyFog(vec3 col, float t, vec3 rd, vec3 lightDir, float fogAmount) {
|
||||
@ -222,7 +235,8 @@ vec3 shading(vec3 p, vec3 n, vec3 dir, vec3 camPos) {
|
||||
outMaterial = pal(p.y*p.y*0.01);
|
||||
|
||||
vec3 lights = vec3(0.);
|
||||
lights += phongLighting(p, n, camPos, dir, vec3(0.51), outMaterial);
|
||||
//lights += phongLighting(p, n, camPos, dir, vec3(0.51), outMaterial);
|
||||
lights += phongLighting(p, n, vec3(4., 4., -4.), dir, vec3(2.51), outMaterial);
|
||||
|
||||
vec3 lightDir = vec3(0., 2., 3);
|
||||
|
||||
@ -236,15 +250,15 @@ vec3 shading(vec3 p, vec3 n, vec3 dir, vec3 camPos) {
|
||||
|
||||
vec3 postProcess(vec3 col) {
|
||||
// Contrast
|
||||
float contrast = 0.75;
|
||||
float contrast = 0.85;
|
||||
|
||||
col = mix(col, smoothstep(0.0, 1.0, col), contrast);
|
||||
|
||||
// Colour mapping
|
||||
// col *= vec3(1.0, 1.0, 1.0);
|
||||
//col *= vec3(1.0, 1.0, 1.0);
|
||||
|
||||
// Gamma
|
||||
col = pow(col, vec3(0.4545)); // gamma 2.2
|
||||
col = pow(col, vec3(.55)); // gamma 2.2
|
||||
|
||||
// fade in at the beginning
|
||||
//col*=vec3(clamp((u_time-1.8)*0.5,0., 1.));
|
||||
@ -283,7 +297,7 @@ vec3 render(vec2 uv) {
|
||||
|
||||
//glow from the bottom
|
||||
vec3 bGlowColor = pal(syncs[0] * .075); // color change
|
||||
float bGlowDistance = 0.3;
|
||||
float bGlowDistance = 0.8;
|
||||
vec3 p = camPos + t.x * rayDir;
|
||||
|
||||
vec3 bGlowLevel = bGlowColor * exp(-(p.y + 0.0) / bGlowDistance) * 9900.;
|
||||
|
||||
Reference in New Issue
Block a user