#version 410 uniform sampler2D texture1; uniform float eyePos; in vec3 colV; in vec3 modelPosV; in vec3 worldPosV; in vec3 viewPosV; in vec3 norV; in vec2 uvV; in vec4 videoMiscV; in vec4 cameraRectV; 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 nNor = normalize(norV); vec3 colVL = colV; vec4 cameraRect = cameraRectV; if(cameraRect[2] == 0.0) cameraRect = vec4(0,0,1,1); vec2 texUv; texUv.x = mapRange(uvV.x, 0,1,cameraRect[0], cameraRect[2]); texUv.y = mapRange(uvV.y, 0,1,cameraRect[1], cameraRect[3]); vec3 texturePixel = texture(texture1, texUv).rgb; fragColor.rgb = texturePixel; fragColor.a = 1.0; //return; // float b = (texturePixel.r + texturePixel.g + texturePixel.b) / 3.0; // b = b * b * 3.0; const float k = 8; texturePixel *= ((k - 1.0) / k) + cos((uvV.y + uvV.x / videoMiscV.x) * 10 * videoMiscV.y) / k; // b = clamp(b, 0.0, 1.7); // texturePixel = vec3(b, b, b); colVL *= texturePixel; fragColor.rgb = colVL; return; 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; float r = cos(shadowey3.x) + cos(shadowey3.y) + cos(shadowey3.z); r = mapRange(r, -3, 3, 0.8, 1.0); fragColor = vec4(colVL,1); fragColor.rgb *= e * r;; }