make handheld lights work on particles and translucents. make lit particle brightness work again. exclude hand from bloom. extend bloom mulitplier slider.

This commit is contained in:
Xonk
2023-10-30 16:07:38 -04:00
parent 6fdc95dff4
commit 8f5111d82d
15 changed files with 135 additions and 47 deletions

View File

@ -1,7 +1,24 @@
uniform sampler2D depthtex1;
uniform sampler2D colortex1;
uniform sampler2D colortex5;
uniform vec2 texelSize;
uniform float viewWidth;
uniform float viewHeight;
vec3 decode (vec2 encn){
vec3 n = vec3(0.0);
encn = encn * 2.0 - 1.0;
n.xy = abs(encn);
n.z = 1.0 - n.x - n.y;
n.xy = n.z <= 0.0 ? (1.0 - n.yx) * sign(encn) : encn;
return clamp(normalize(n.xyz),-1.0,1.0);
}
vec2 decodeVec2(float a){
const vec2 constant1 = 65535. / vec2( 256., 65536.);
const float constant2 = 256. / 255.;
return fract( a * constant1 ) * constant2 ;
}
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
@ -15,6 +32,11 @@ void main() {
vec2 resScale = max(vec2(viewWidth,viewHeight),vec2(1920.0,1080.))/vec2(1920.,1080.);
vec2 quarterResTC = gl_FragCoord.xy*2.*resScale*texelSize;
vec4 data = texture2D(colortex1,quarterResTC);
vec4 dataUnpacked1 = vec4(decodeVec2(data.z),decodeVec2(data.w));
float depth = texture2D(depthtex1,quarterResTC).x;
bool hand = abs(dataUnpacked1.w-0.75) < 0.01 && depth < 1.0;
//0.5
gl_FragData[0] = texture2D(colortex5,quarterResTC-1.0*vec2(texelSize.x,texelSize.y))/4.*0.5;
gl_FragData[0] += texture2D(colortex5,quarterResTC+1.0*vec2(texelSize.x,texelSize.y))/4.*0.5;
@ -37,7 +59,7 @@ vec2 quarterResTC = gl_FragCoord.xy*2.*resScale*texelSize;
gl_FragData[0] += texture2D(colortex5,quarterResTC)*0.125;
gl_FragData[0].rgb = clamp(gl_FragData[0].rgb,0.0,65000.);
if (quarterResTC.x > 1.0 - 3.5*texelSize.x || quarterResTC.y > 1.0 -3.5*texelSize.y || quarterResTC.x < 3.5*texelSize.x || quarterResTC.y < 3.5*texelSize.y) gl_FragData[0].rgb = vec3(0.0);
if (hand || quarterResTC.x > 1.0 - 3.5*texelSize.x || quarterResTC.y > 1.0 -3.5*texelSize.y || quarterResTC.x < 3.5*texelSize.x || quarterResTC.y < 3.5*texelSize.y) gl_FragData[0].rgb = vec3(0.0);
}