Bliss-Shader/shaders/gbuffers_armor_glint.fsh

49 lines
1.3 KiB
Plaintext
Raw Normal View History

2023-01-13 04:00:14 +08:00
#version 120
#extension GL_EXT_gpu_shader4 : enable
2023-01-13 04:28:19 +08:00
#include "lib/settings.glsl"
2023-01-13 04:00:14 +08:00
varying vec4 lmtexcoord;
varying vec4 color;
varying vec4 normalMat;
uniform sampler2D texture;
uniform sampler2D gaux1;
uniform vec4 lightCol;
uniform vec3 sunVec;
uniform vec2 texelSize;
uniform float skyIntensityNight;
uniform float skyIntensity;
uniform float sunElevation;
uniform mat4 gbufferProjectionInverse;
uniform mat4 gbufferModelViewInverse;
uniform mat4 shadowModelView;
uniform mat4 shadowProjection;
//faster and actually more precise than pow 2.2
vec3 toLinear(vec3 sRGB){
return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);
}
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
/* DRAWBUFFERS:2 */
void main() {
gl_FragData[0] = texture2D(texture, lmtexcoord.xy);
vec3 albedo = toLinear(gl_FragData[0].rgb*color.rgb);
float exposure = texelFetch2D(gaux1,ivec2(10,37),0).r;
vec3 col = albedo*exp(-exposure*3.);
gl_FragData[0].rgb = col*color.a;
gl_FragData[0].a = gl_FragData[0].a*0.1;
}