// : http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl vec3 hsv2rgb(float h, float s, float v) { vec4 k = vec4(1.0, 2.0/3.0, 1.0/3.0, 3.0); vec3 p = abs(fract(vec3(h)+k.xyz)*6.0-k.www); return v*mix(k.xxx, clamp(pk.xxx, 0.0, 1.0), s); } const float iridescenceOpacity = 0.6; const float hsvSaturation = 0.7; const float hsvValue = 0.8; const float addIridescenceValue = 0.2; void main() { ... float hue = (1.0-pow(dot(normal, eyeDir), 2.0))*hueRange+hueAverage; hue -= (1.0-dataTex.a)*addIridescenceValue; vec3 diffuse = hsv2rgb(hue, hsvSaturation, hsvValue)*iridescenceOpacity; ... }
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_BASE_LEVEL, 6);
I used the sixth mip level, but it all depends on the initial resolution of the texture and the degree of blur required. Honestly, this is not a very good way to blur, since stripes in the form of a sharp color transition border are formed on the faces of a cubmap, but this is not noticeable on a beetle with a pronounced relief surface. #version 110 uniform mat4 matrixProj; // uniform mat4 matrixView; // attribute vec3 vertex; attribute vec3 normal; attribute vec3 tangent; attribute vec2 texCoord; varying vec2 vTexCoord; varying mat3 vTbn; // varying float zPos; // z- void main() { vec4 pos = matrixProj*matrixView*vec4(vertex, 1.0); gl_Position = pos; vTexCoord = texCoord; zPos = pos.z; vec3 bitangent = cross(normal, tangent); // vTbn = mat3(tangent, bitangent, normal); // ... }
#version 110 uniform sampler2D texture; // uniform samplerCube envMap; // uniform vec3 light; // uniform float bright; // uniform float focalDistance; // uniform float focalRange; // uniform vec3 eyeDir; // uniform float hueAverage; // , uniform float hueRange; // varying vec2 vTexCoord; varying mat3 vTbn; varying float zPos; const float shadowOpacity = 0.7; // const float envBright = 1.0; // const float envLighting = -0.6;// const float iridescenceOpacity = 0.6;// const float hsvSaturation = 0.7; // const float hsvValue = 0.8;// const float addIridescenceValue = 0.2;// vec3 hsv2rgb(float h, float s, float v) { vec4 k = vec4(1.0, 2.0/3.0, 1.0/3.0, 3.0); vec3 p = abs(fract(vec3(h)+k.xyz)*6.0-k.www); return v*mix(k.xxx, clamp(pk.xxx, 0.0, 1.0), s); } void main() { vec4 dataTex = texture2D(texture, vTexCoord); vec3 normal = normalize(vTbn*(vec3(dataTex.rg, 1.0)*2.0-1.0));// float lighting = clamp(dot(normal, light), 0.0, 1.0);// float hue = (1.0-pow(dot(normal, eyeDir), 2.0))*hueRange+hueAverage;// hue -= (1.0-dataTex.a)*addIridescenceValue;// vec3 diffuse = hsv2rgb(hue, hsvSaturation, hsvValue)*iridescenceOpacity;// RGB vec3 env = textureCube(envMap, reflect(-eyeDir, normal)).rgb;// diffuse += env*bright*envBright+envLighting;// float shadow = lighting*dataTex.b*shadowOpacity+1.0-shadowOpacity;// gl_FragColor.rgb = shadow*diffuse;// gl_FragColor.a = clamp((focalDistance+zPos)/focalRange, -1.0, 1.0);// }
#version 110 uniform sampler2D guiMap; // - uniform sampler2D themeMap; // uniform float themeNum;// (v- ) varying vec2 vTexCoord; void main() { float a = texture2D(guiMap, vTexCoord).r; // gl_FragColor = texture2D(themeMap, vec2(a, themeNum)); // }
avconv -f x11grab -s 1280x720 -i :0.0+2240,185 -c:v libx264 -r 30 -vsync 2 -b 4000k -threads 8 -y 1.mp4
Source: https://habr.com/ru/post/239661/
All Articles