ajotuksia + valo
This commit is contained in:
39
shader.glsl
39
shader.glsl
@ -387,7 +387,7 @@ vec3 postProcess(vec3 col) {
|
||||
|
||||
// zoom camera on glyph lock for extra oomph
|
||||
float cameraZoomAnim(float o) {
|
||||
float delay = 11.2;
|
||||
float delay = 10.7;
|
||||
|
||||
if(u_time > delay) {
|
||||
o += (0.25 - smoothstep(-0.7,0.5,sin((timedSine(1.5, delay, 35.0))))) * 0.1;
|
||||
@ -439,7 +439,7 @@ vec3 cameraPointAt(vec3 p) {
|
||||
// flash screen with glyph color when it is locked
|
||||
vec3 colorFlashesAnim(in vec3 col) {
|
||||
|
||||
float delay = 11.25;
|
||||
float delay = 10.75;
|
||||
if(u_time > delay) {
|
||||
float x = smoothstep(-1.0,0.8,sin((timedSine(0.8, delay, 8.0)*2.0)));
|
||||
col = mix(col, glyphColor * (x * 1.4), x * 0.76);
|
||||
@ -459,6 +459,8 @@ void main()
|
||||
|
||||
float d = rayMarch(ro, rd);
|
||||
|
||||
|
||||
|
||||
if (d < 500.) {
|
||||
// Lighting
|
||||
vec3 p = ro + rd * d;
|
||||
@ -474,6 +476,12 @@ void main()
|
||||
// Color for light 1
|
||||
// col = vec3(dif * vec3(0.9216, 0.9294, 0.9412));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Light 2
|
||||
dif = getLight(p, vec3( -3, 5, 5), 1., 0.2);
|
||||
// Color for light 2
|
||||
@ -483,6 +491,33 @@ void main()
|
||||
// Color for light 2
|
||||
col += vec3(dif * light2Color);
|
||||
|
||||
|
||||
|
||||
vec3 lightPosition = glyph1Pos;
|
||||
lightPosition.z = lightPosition.z + 0.3;
|
||||
// dif = getLight(p, lightPosition, 3.75, 1.0);
|
||||
|
||||
|
||||
// float minLight = 0.01;
|
||||
// float radius = sqrt(1.0 / (lightPosition * minLight))
|
||||
vec3 ld = lightPosition-p;
|
||||
float len = length( ld ); // Distance from the light to the surface point.
|
||||
ld /= len; // Normalizing the light-to-surface, aka light-direction, vector.
|
||||
// float lightAtten = min( 1.0 / ( 0.25*len*len ), 1.0 ); // Keeps things between 0 and 1.
|
||||
|
||||
// float att = clamp(1.0 - len/radius, 0.0, 1.0);
|
||||
|
||||
|
||||
float att = 8.0 / (1.0 + 8.1*len + 0.01*len*len); // light attenuation
|
||||
|
||||
if(u_time > 10.76) {
|
||||
col += vec3(dif * glyphColor * att);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
vec3 n = getNormal(p);
|
||||
vec3 dir = vec3(1. , 10., 1.);
|
||||
float ind = clamp( dot( n, normalize(dir )), 0.0, 1.0 );
|
||||
|
||||
Reference in New Issue
Block a user