#version 410 uniform float eyePos; uniform float time; in vec3 colV; in vec3 modelPosV; in vec3 worldPosV; in vec3 viewPosV; in vec2 uvV; out vec4 fragColor; vec3 mf(vec3 x) { return x - floor(x); } float mapRange(float x, float minIn, float maxIn, float minOut, float maxOut) { x -= minIn; x = x * (maxOut - minOut) / (maxIn - minIn); x += minOut; x = clamp(x, minOut, maxOut); return x; } void main (void) { vec3 colVL = colV; vec2 uv = uvV; if(uv.x > 0.5) uv.x = 1.0 - uv.x; if(uv.y > 0.5) uv.y = 1.0 - uv.y; float e = min(uv.x, uv.y); float edgeLimit = 0.1; e = mapRange(e, 0.0, edgeLimit, 0.9, 1.0); // vec3 shadowey3 = worldPosV; // shadowey3 = modelPosV / 3; // float r = cos(shadowey3.x) + cos(shadowey3.y) + cos(shadowey3.z); // r = mapRange(r, -3, 3, 0.8, 1.0); // // float tinyDetailIntensity = mapRange(viewPosV.z, -1.0, 0.0, 0, 0.0065); // float tinyDetailIntensity = mapRange(length(viewPosV), 1.5, 0.0, 0, 0.0065); // // float tinyDetailChecker = (int(uvV.x * 200) + int(uvV.y * 200) & 1) != 0 ? -1.0 : 1.0; // colVL += tinyDetailIntensity * vec3(tinyDetailChecker, tinyDetailChecker, tinyDetailChecker); fragColor = vec4(colVL,1); fragColor.rgb *= e; fragColor.a = sin( + viewPosV.z + time * 3.5) / 2.0 + 0.5; }