From: Terri00 Date: Fri, 21 Jun 2019 12:41:53 +0000 (+0100) Subject: Better inter-layer effect blending X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;h=26e890a703357adc334abefc188f096add1c9c17;p=tar-legacy.git Better inter-layer effect blending --- diff --git a/MCDV/layer0.dds b/MCDV/layer0.dds deleted file mode 100644 index 7b0e2d0..0000000 Binary files a/MCDV/layer0.dds and /dev/null differ diff --git a/MCDV/layer0.png b/MCDV/layer0.png index 3c84b1b..dcdcd65 100644 Binary files a/MCDV/layer0.png and b/MCDV/layer0.png differ diff --git a/MCDV/layer1.dds b/MCDV/layer1.dds deleted file mode 100644 index 11a183d..0000000 Binary files a/MCDV/layer1.dds and /dev/null differ diff --git a/MCDV/layer1.png b/MCDV/layer1.png index 6ecd981..a76b4d3 100644 Binary files a/MCDV/layer1.png and b/MCDV/layer1.png differ diff --git a/MCDV/layerx.png b/MCDV/layerx.png index 86d71eb..33eaa87 100644 Binary files a/MCDV/layerx.png and b/MCDV/layerx.png differ diff --git a/MCDV/main2.cpp b/MCDV/main2.cpp index 7a197fa..c54ace4 100644 --- a/MCDV/main2.cpp +++ b/MCDV/main2.cpp @@ -78,7 +78,7 @@ uint32_t g_msaa_mul = 1; void render_to_png(int x, int y, const char* filepath); void save_to_dds(int x, int y, const char* filepath, IMG imgmode = IMG::MODE_DXT1); -#define _DEBUG +//#define _DEBUG int app(int argc, const char** argv) { #ifndef _DEBUG @@ -250,23 +250,21 @@ int app(int argc, const char** argv) { g_shader_multilayer_blend->setFloat("value", 0.5669f); g_shader_multilayer_blend->setFloat("active", 0.0f); + bool above = false; + for(int x = 0; x < g_tar_config->layers.size(); x++) { tar_config_layer* l = &g_tar_config->layers[g_tar_config->layers.size() - x - 1]; - if (l == &megalayer) continue; + if (l == &megalayer) { above = true; continue; } _flayers[l]->BindRTToTexSlot(1); _flayers[l]->BindHeightToTexSlot(0); - g_shader_multilayer_blend->setFloat("layer_min", l->layer_min); - g_shader_multilayer_blend->setFloat("layer_max", l->layer_max); - + g_shader_multilayer_blend->setFloat("layer_target", !above? l->layer_min: l->layer_max); + g_mesh_screen_quad->Draw(); } - g_shader_multilayer_blend->setFloat("layer_min", megalayer.layer_min); - g_shader_multilayer_blend->setFloat("layer_max", megalayer.layer_max); - //g_shader_multilayer_blend->setFloat("saturation", 1.0f); //g_shader_multilayer_blend->setFloat("value", 1.0f); g_shader_multilayer_blend->setFloat("active", 1.0f); diff --git a/MCDV/sample_stuff/de_tavr_test.vmx b/MCDV/sample_stuff/de_tavr_test.vmx index 747a8a2..2278daf 100644 --- a/MCDV/sample_stuff/de_tavr_test.vmx +++ b/MCDV/sample_stuff/de_tavr_test.vmx @@ -2,7 +2,7 @@ versioninfo { "editorversion" "400" "editorbuild" "8075" - "mapversion" "336" + "mapversion" "345" "formatversion" "100" "prefab" "0" } @@ -44,7 +44,7 @@ viewsettings world { "id" "1" - "mapversion" "336" + "mapversion" "345" "classname" "worldspawn" "detailmaterial" "detail/detailsprites" "detailvbsp" "detail.vbsp" @@ -1629,9 +1629,9 @@ world side { "id" "621" - "plane" "(0 767.992 64) (-128.003 767.992 64) (-128.011 895.992 64)" + "plane" "(64 592 64) (-64 592 64) (-64 720 64)" "material" "RYAN_DEV/PURE_ORANGE2" - "uaxis" "[0 1 0 -127.985] 0.25" + "uaxis" "[0 1 0 64.015] 0.25" "vaxis" "[1 0 0 -127.972] 0.25" "rotation" "0" "lightmapscale" "16" @@ -1640,9 +1640,9 @@ world side { "id" "620" - "plane" "(-128.008 767.997 16) (-0.00814819 767.997 16) (-0.00830078 895.997 16)" + "plane" "(64 720 16) (-64 720 16) (-64 592 16)" "material" "RYAN_DEV/PURE_ORANGE2" - "uaxis" "[0 1 0 -127.985] 0.25" + "uaxis" "[0 1 0 64.015] 0.25" "vaxis" "[1 0 0 -127.972] 0.25" "rotation" "0" "lightmapscale" "16" @@ -1651,7 +1651,7 @@ world side { "id" "619" - "plane" "(-0.0055542 767.997 16) (-128.003 767.997 16) (-128.003 767.992 64)" + "plane" "(64 592 16) (-64 592 16) (-64 592 64)" "material" "RYAN_DEV/PURE_ORANGE2" "uaxis" "[-1 0 0 127.972] 0.25" "vaxis" "[0 0 -1 0] 0.25" @@ -1662,7 +1662,7 @@ world side { "id" "618" - "plane" "(-128.008 895.994 16) (-0.00674438 895.996 16) (-0.0055542 895.994 64)" + "plane" "(-64 720 16) (64 720 16) (64 720 64)" "material" "RYAN_DEV/PURE_ORANGE2" "uaxis" "[-1 0 0 127.972] 0.25" "vaxis" "[0 0 -1 0] 0.25" @@ -1673,9 +1673,9 @@ world side { "id" "617" - "plane" "(-128.006 767.994 16) (-128.006 895.997 16) (-128.006 895.997 64)" + "plane" "(-64 592 16) (-64 720 16) (-64 720 64)" "material" "RYAN_DEV/PURE_ORANGE2" - "uaxis" "[0 1 0 -127.985] 0.25" + "uaxis" "[0 1 0 64.015] 0.25" "vaxis" "[0 0 -1 0] 0.25" "rotation" "0" "lightmapscale" "16" @@ -1684,9 +1684,9 @@ world side { "id" "616" - "plane" "(-0.0055542 895.994 16) (-0.00552368 767.992 16) (0 767.992 64)" + "plane" "(64 720 16) (64 592 16) (64 592 64)" "material" "RYAN_DEV/PURE_ORANGE2" - "uaxis" "[0 1 0 -127.985] 0.25" + "uaxis" "[0 1 0 64.015] 0.25" "vaxis" "[0 0 -1 0] 0.25" "rotation" "0" "lightmapscale" "16" @@ -1860,10 +1860,10 @@ world side { "id" "693" - "plane" "(-44.4096 798.574 96) (-89.5167 782.157 96) (-105.931 827.264 96)" + "plane" "(19.5938 622.572 96) (-25.5195 606.152 96) (-41.9375 651.264 96)" "material" "RYAN_DEV/PURE_ORANGE2" - "uaxis" "[-0.34202 0.939693 0 -54.4103] 0.25" - "vaxis" "[0.939693 0.34202 0 -29.5875] 0.25" + "uaxis" "[-0.34202 0.939693 0 54.6907] 0.25" + "vaxis" "[0.939693 0.34202 0 -29.3668] 0.25" "rotation" "0" "lightmapscale" "16" "smoothing_groups" "0" @@ -1871,10 +1871,10 @@ world side { "id" "692" - "plane" "(-89.5167 782.157 64) (-44.4099 798.574 64) (-60.8264 843.678 64)" + "plane" "(3.16797 667.678 64) (-41.9375 651.26 64) (-25.5195 606.154 64)" "material" "RYAN_DEV/PURE_ORANGE2" - "uaxis" "[-0.34202 0.939693 0 -54.4103] 0.25" - "vaxis" "[0.939693 0.34202 0 -29.5875] 0.25" + "uaxis" "[-0.34202 0.939693 0 54.6907] 0.25" + "vaxis" "[0.939693 0.34202 0 -29.3668] 0.25" "rotation" "0" "lightmapscale" "16" "smoothing_groups" "0" @@ -1882,9 +1882,9 @@ world side { "id" "691" - "plane" "(-44.4124 798.571 64) (-89.5153 782.156 64) (-89.5153 782.156 96)" + "plane" "(19.5898 622.572 64) (-25.5195 606.154 64) (-25.5117 606.158 96)" "material" "RYAN_DEV/PURE_ORANGE2" - "uaxis" "[-0.939693 -0.34202 0 29.5875] 0.25" + "uaxis" "[-0.939693 -0.34202 0 29.3668] 0.25" "vaxis" "[0 0 -1 64] 0.25" "rotation" "0" "lightmapscale" "16" @@ -1893,9 +1893,9 @@ world side { "id" "690" - "plane" "(-105.933 827.261 64) (-60.8271 843.679 64) (-60.8277 843.68 96)" + "plane" "(-41.9375 651.26 64) (3.17254 667.679 64) (3.17188 667.68 96)" "material" "RYAN_DEV/PURE_ORANGE2" - "uaxis" "[-0.939693 -0.34202 0 29.5875] 0.25" + "uaxis" "[-0.939693 -0.34202 0 29.3668] 0.25" "vaxis" "[0 0 -1 64] 0.25" "rotation" "0" "lightmapscale" "16" @@ -1904,9 +1904,9 @@ world side { "id" "689" - "plane" "(-89.5167 782.154 64) (-105.934 827.261 64) (-105.933 827.261 96)" + "plane" "(-25.5156 606.152 64) (-41.9335 651.261 64) (-41.9336 651.262 96)" "material" "RYAN_DEV/PURE_ORANGE2" - "uaxis" "[-0.34202 0.939693 0 -54.4103] 0.25" + "uaxis" "[-0.34202 0.939693 0 54.6907] 0.25" "vaxis" "[0 0 -1 64] 0.25" "rotation" "0" "lightmapscale" "16" @@ -1915,9 +1915,9 @@ world side { "id" "688" - "plane" "(-60.8277 843.68 64) (-44.4096 798.574 64) (-44.4096 798.574 96)" + "plane" "(3.17383 667.68 64) (19.5918 622.574 64) (19.5918 622.57 96)" "material" "RYAN_DEV/PURE_ORANGE2" - "uaxis" "[-0.34202 0.939693 0 -54.4103] 0.25" + "uaxis" "[-0.34202 0.939693 0 54.6907] 0.25" "vaxis" "[0 0 -1 64] 0.25" "rotation" "0" "lightmapscale" "16" @@ -2636,6 +2636,21 @@ world } } entity +{ + "id" "2894" + "classname" "tar_map_divider" + "maxs" "4096 4096 2" + "mins" "-4096 -4096 -2" + "origin" "-80 0 -64" + editor + { + "color" "127 224 0" + "visgroupshown" "1" + "visgroupautoshown" "1" + "logicalpos" "[0 0]" + } +} +entity { "id" "2809" "classname" "tar_config" diff --git a/MCDV/shaders/ss_comp_multilayer_blend.fs b/MCDV/shaders/ss_comp_multilayer_blend.fs index 5aec90a..d93ce05 100644 --- a/MCDV/shaders/ss_comp_multilayer_blend.fs +++ b/MCDV/shaders/ss_comp_multilayer_blend.fs @@ -9,8 +9,10 @@ out vec4 FragColor; uniform sampler2D tex_layer; uniform sampler2D gbuffer_height; -uniform float layer_min; -uniform float layer_max; +//uniform float layer_min; +//uniform float layer_max; + +uniform float layer_target; float saturation = 0.1; float value = 0.666; @@ -80,12 +82,15 @@ void main() vec4 s_layer = texture(tex_layer, TexCoords); float s_height = texture(gbuffer_height, TexCoords).r; - float dist_from_min = 1 - remap(clamp(layer_min - s_height, 0, dist), 0, dist, 0, 1); - float dist_from_max = 1 - remap(clamp(s_height - layer_max, 0, dist), 0, dist, 0, 1); + float dist_from_target = remap(abs(layer_target - s_height), 0, 200, 0, 1); - float dist_blend = clamp(clamp(dist_from_max + dist_from_min, 0, 1) + ( 1 - active ), 0, 1); - + float dist_blend = 1 - active;//1 - clamp((active) + dist_from_target, 0, 1);//clamp(clamp(dist_from_max + dist_from_min, 0, 1) + ( 1 - active ), 0, 1); + if(active < 0.5) + dist_blend -= (1 - dist_from_target); + + dist_blend = clamp(dist_blend, 0, 1); + vec3 colHSV = rgb2hsv(s_layer.rgb); colHSV.g *= saturation; colHSV.b *= value; diff --git a/MCDV/vmf_new.hpp b/MCDV/vmf_new.hpp index 99f8948..3ea75ab 100644 --- a/MCDV/vmf_new.hpp +++ b/MCDV/vmf_new.hpp @@ -505,8 +505,8 @@ public: std::vector intersecting; float x, _x, y, _y, z, _z; - x = _y = _z = std::numeric_limits::max(); - _x = y = z = std::numeric_limits::min(); + _x = _y = _z = 99999.0f;// std::numeric_limits::max(); + x = y = z = -99999.0f;// std::numeric_limits::min(); for (int i = 0; i < m_sides.size(); i++) { for (int j = 0; j < m_sides.size(); j++) { @@ -548,12 +548,12 @@ public: intersecting.push_back(p); // Calculate bounds - _x = glm::max(_x, p.x); - _y = glm::min(_y, p.y); - _z = glm::min(_z, p.z); - x = glm::min(x, p.x); - y = glm::max(y, p.y); - z = glm::max(z, p.z); + _x = glm::round(glm::min(_x, p.x)); + _y = glm::round(glm::min(_y, p.y)); + _z = glm::round(glm::min(_z, p.z)); + x = glm::round(glm::max(x, p.x)); + y = glm::round(glm::max(y, p.y)); + z = glm::round(glm::max(z, p.z)); } } } @@ -829,7 +829,7 @@ public: // Draw solids for (auto && solid : this->m_solids) { - if (solid.NWU.y > this->m_render_h_min || solid.NWU.y < this->m_render_h_max) continue; + if (solid.NWU.y < this->m_render_h_max || solid.NWU.y > this->m_render_h_min) continue; if (check_in_whitelist(&solid.m_editorvalues.m_visgroups, this->m_whitelist_visgroups)) { shader->setUnsigned("Info", infoFlags); @@ -854,10 +854,10 @@ public: // Visgroup pre-check if (check_in_whitelist(&ent.m_editorvalues.m_visgroups, this->m_whitelist_visgroups)) { if (this->m_whitelist_classnames.count(ent.m_classname)) { - if (ent.m_origin.y > this->m_render_h_min || ent.m_origin.y < this->m_render_h_max) continue; if (ent.m_classname == "prop_static" || ent.m_classname == "prop_dynamic" || ent.m_classname == "prop_physics" ) { + if (ent.m_origin.y > this->m_render_h_min || ent.m_origin.y < this->m_render_h_max) continue; model = glm::mat4(); model = glm::translate(model, ent.m_origin); @@ -901,14 +901,14 @@ public: unsigned int vgroup = this->m_visgroups[visgroup]; bounds.NWU = glm::vec3( - std::numeric_limits::min(), - std::numeric_limits::min(), - std::numeric_limits::min()); + -999999.0f, + -999999.0f, + -999999.0f); bounds.SEL = glm::vec3( - std::numeric_limits::max(), - std::numeric_limits::max(), - std::numeric_limits::max()); + 999999.0f, + 999999.0f, + 999999.0f); for (auto && iSolid : this->m_solids) { if (!check_in_whitelist(&iSolid.m_editorvalues.m_visgroups, std::set{ vgroup })) continue;