From: Terri00 Date: Tue, 12 Mar 2019 02:49:04 +0000 (+0000) Subject: better compositor shader X-Git-Url: https://skaterift.com/git/?a=commitdiff_plain;h=99471c1fec64d7076aeecef4a9f8d3d6762c8c86;p=tar-legacy.git better compositor shader --- diff --git a/MCDV/1whammy.png b/MCDV/1whammy.png index 276895e..5162977 100644 Binary files a/MCDV/1whammy.png and b/MCDV/1whammy.png differ diff --git a/MCDV/buyzone-bombtargets.png b/MCDV/buyzone-bombtargets.png index 85f457b..0257a6d 100644 Binary files a/MCDV/buyzone-bombtargets.png and b/MCDV/buyzone-bombtargets.png differ diff --git a/MCDV/de_tavr_test.txt b/MCDV/de_tavr_test.txt index efdf1b4..449d681 100644 --- a/MCDV/de_tavr_test.txt +++ b/MCDV/de_tavr_test.txt @@ -1,12 +1,10 @@ // TAVR - AUTO RADAR. v 2.0.0 de_tavr_test { - "CTSpawn_x" "0.400000" - "CTSpawn_y" "0.060000" - "TSpawn_x" "0.300000" - "TSpawn_y" "0.880000" + "TSpawn_x" "0.700000" + "TSpawn_y" "0.330000" "material" "overviews/de_tavr_test" - "pos_x" "-1832.000000" - "pos_y" "1728.000000" - "scale" "5.190000" + "pos_x" "-2432.000000" + "pos_y" "3531.000000" + "scale" "4.880000" } diff --git a/MCDV/main.cpp b/MCDV/main.cpp index 5c1bc37..3e1f01c 100644 --- a/MCDV/main.cpp +++ b/MCDV/main.cpp @@ -39,7 +39,7 @@ void render_to_png(int x, int y, const char* filepath){ int main(int argc, char* argv[]) { std::cout << "Loading VMF\n"; - vmf::vmf vmf_main("map_01.vmf"); + vmf::vmf vmf_main("de_tavr_test.vmf"); std::cout << "Initializing OpenGL\n"; diff --git a/MCDV/playable-space.png b/MCDV/playable-space.png index e4bc264..66186d9 100644 Binary files a/MCDV/playable-space.png and b/MCDV/playable-space.png differ diff --git a/MCDV/shaders/ss_precomp_objectives.fs b/MCDV/shaders/ss_precomp_objectives.fs index aa69226..d096411 100644 --- a/MCDV/shaders/ss_precomp_objectives.fs +++ b/MCDV/shaders/ss_precomp_objectives.fs @@ -1,6 +1,4 @@ #version 330 core -// Note:: All channels marked with an ** are currently not filled out by the engine. - // OPENGL // ____________________________________________________________________________________________ in vec2 TexCoords; @@ -13,7 +11,7 @@ uniform sampler2D tex_in; // Background texture // SHADER HELPERS // ____________________________________________________________________________________________ -// ( A collection of simple blend modes ) +// ( Simple sample with offset ) vec2 pixel_size = 1.0 / vec2(textureSize(tex_in, 0)); vec4 getSample(vec2 offset) { @@ -28,20 +26,22 @@ void main() { vec4 sIn = getSample(vec2(0,0)); - int sampleCount = 32; + //Temp + int sampleCount = 64; int outlineWidth = 1; vec2 sT = vec2(0, 0); - vec2 thisHeight = vec2(1, 1)-getSample(vec2(0,0)).rg; + // Glow sampler ========================================================== for(int x = 0; x <= sampleCount; x++) { for(int y = 0; y <= sampleCount; y++) { - sT += vec2(1, 1)-getSample(vec2(-16 + x,-16 + y)).rg; + sT += (vec2(1, 1)-getSample(vec2(-32 + x,-32 + y)).rg) * (1 - ((abs(-32 +x) * abs(-32 +y)) / 512)); } } + // Outline sampler ======================================================= vec2 olT = vec2(0, 0); for(int x = 0; x <= outlineWidth * 2; x++) { @@ -54,9 +54,7 @@ void main() float global_opacity = 0.25; sT /= (sampleCount * sampleCount); - sT *= 0.5; + sT = vec2(pow(sT.r, 1.5), pow(sT.g, 1.5)); + sT *= 0.75; FragColor = vec4((sIn.r * olT.r) + (sIn.r * sT.r) + (sIn.r * global_opacity), (sIn.g * olT.g) + (sIn.g * sT.g) + (sIn.g * global_opacity), 0, sIn.r + sIn.g); - //r: sIn - //g: olT - //b: sT } \ No newline at end of file diff --git a/MCDV/shaders/ss_precomp_playspace.fs b/MCDV/shaders/ss_precomp_playspace.fs index d9fa6b5..3940ef9 100644 --- a/MCDV/shaders/ss_precomp_playspace.fs +++ b/MCDV/shaders/ss_precomp_playspace.fs @@ -1,6 +1,4 @@ #version 330 core -// Note:: All channels marked with an ** are currently not filled out by the engine. - // OPENGL // ____________________________________________________________________________________________ in vec2 TexCoords; @@ -13,7 +11,7 @@ uniform sampler2D tex_in; // Background texture // SHADER HELPERS // ____________________________________________________________________________________________ -// ( A collection of simple blend modes ) +// ( Simple sample with offset ) vec2 pixel_size = 1.0 / vec2(textureSize(tex_in, 0)); vec4 getSample(vec2 offset) { @@ -33,12 +31,12 @@ void main() } else { + //Temp int sampleCount = 32; int outlineWidth = 2; + // Glow sampler ========================================================== float sT = 0; - float thisHeight = getSample(vec2(0,0)).g; - for(int x = 0; x <= sampleCount; x++) { for(int y = 0; y <= sampleCount; y++) @@ -47,8 +45,11 @@ void main() } } + //Adjust slightly sT *= 2; + sT /= (sampleCount * sampleCount); + // Outline sampler ======================================================= float olT = 0; for(int x = 0; x <= outlineWidth * 2; x++) { @@ -57,10 +58,7 @@ void main() olT += getSample(vec2(-outlineWidth + x,-outlineWidth + y)).r; } } - - clamp(olT, 0, 1); - - sT /= (sampleCount * sampleCount); + FragColor = vec4(sIn.r, sIn.g, sT, olT); } } \ No newline at end of file diff --git a/MCDV/shaders/ss_test.fs b/MCDV/shaders/ss_test.fs index b8f3b1f..de8a480 100644 --- a/MCDV/shaders/ss_test.fs +++ b/MCDV/shaders/ss_test.fs @@ -84,6 +84,12 @@ void main() vec4 sPlayspace = vec4(texture(tex_playspace, TexCoords)); vec4 sObjectives = vec4(texture(tex_objectives, TexCoords)); + vec4 final = sBackground; + final = blend_normal(final, ao_color, sPlayspace.b); + final = blend_normal(final, sample_gradient(sPlayspace.g), sPlayspace.r); + final = blend_normal(final, outline_color, sPlayspace.a - sPlayspace.r); + final = blend_add(final, sObjectives, sObjectives.a); + // Return the final output color - FragColor = blend_add(blend_normal(blend_normal(blend_normal(sBackground, ao_color, sPlayspace.b), sample_gradient(sPlayspace.g), sPlayspace.r), outline_color, sPlayspace.a -sPlayspace.r), sObjectives, sObjectives.a * 0.75); + FragColor = final; } \ No newline at end of file