From 7119baabb386cb572a945238889164138bb9f2fd Mon Sep 17 00:00:00 2001 From: Xonk Date: Wed, 5 Jul 2023 20:03:21 -0400 Subject: [PATCH] beacon beam fix= --- shaders/gbuffers_beaconbeam.fsh | 21 ++++++++++++--------- shaders/gbuffers_beaconbeam.vsh | 30 ++++++++++++------------------ 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/shaders/gbuffers_beaconbeam.fsh b/shaders/gbuffers_beaconbeam.fsh index a4581d4..4ddf770 100644 --- a/shaders/gbuffers_beaconbeam.fsh +++ b/shaders/gbuffers_beaconbeam.fsh @@ -1,10 +1,15 @@ #version 120 -varying vec4 lmtexcoord; + varying vec4 color; +varying vec2 texcoord; uniform sampler2D texture; +//faster and actually more precise than pow 2.2 +vec3 toLinear(vec3 sRGB){ + return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878); +} vec4 encode (vec3 n, vec2 lightmaps){ n.xy = n.xy / dot(abs(n), vec3(1.0)); @@ -29,16 +34,14 @@ float encodeVec2(float x,float y){ //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// -/* DRAWBUFFERS:18 */ +/* DRAWBUFFERS:28 */ void main() { - vec3 albedo = texture2D(texture, lmtexcoord.xy).rgb * color.rgb; + vec4 Albedo = vec4(texture2D(texture, texcoord).rgb*5.0,1.0); + Albedo *= color; + Albedo.rgb = toLinear(Albedo.rgb); - - - vec4 data1 = clamp(encode(vec3(0.0), vec2(lmtexcoord.z,1)), 0.0, 1.0); - gl_FragData[0] = vec4(encodeVec2(albedo.r,data1.x), encodeVec2(albedo.g,data1.y), encodeVec2(albedo.b,data1.z), encodeVec2(data1.w,0.75)); - - gl_FragData[1].a = 0.9; + gl_FragData[0] = Albedo; + gl_FragData[1] = vec4(0.0,0.0,0.0,0.9); } \ No newline at end of file diff --git a/shaders/gbuffers_beaconbeam.vsh b/shaders/gbuffers_beaconbeam.vsh index ff28281..eabec6c 100644 --- a/shaders/gbuffers_beaconbeam.vsh +++ b/shaders/gbuffers_beaconbeam.vsh @@ -11,22 +11,19 @@ Read the terms of modification and sharing before changing something below pleas !! DO NOT REMOVE !! */ -varying vec4 lmtexcoord; varying vec4 color; - - - +varying vec2 texcoord; uniform vec2 texelSize; uniform int framemod8; - const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); +const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), + vec2(-1.,3.)/8., + vec2(5.0,1.)/8., + vec2(-3,-5.)/8., + vec2(-5.,5.)/8., + vec2(-7.,-1.)/8., + vec2(3,7.)/8., + vec2(7.,-7.)/8.); //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// @@ -37,14 +34,11 @@ void main() { gl_Position = ftransform(); - lmtexcoord.xy = (gl_MultiTexCoord0).xy; - vec2 lmcoord = gl_MultiTexCoord1.xy/255.; - lmtexcoord.zw = lmcoord; - - color = gl_Color; - if(gl_Color.a < 1.0 ) gl_Position = vec4(10,10,10,1); + texcoord = (gl_MultiTexCoord0).xy; + color = gl_Color; + #ifdef TAA_UPSCALING gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w; #endif