From dd2ac0a32e64f6f8cf160cb6a1568444c63f5bfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Garc=C3=ADa=20Li=C3=B1=C3=A1n?= Date: Sat, 14 Mar 2020 20:41:36 +0100 Subject: [PATCH] - Changed location of Compositor pipelines. - 1-bit transparency for shadow mapping. - Several effects ported to the Compositor. - Miscellaneous fixes to Compositor Effects. --- Compositor/Effects/ALS/shadow-pass.eff | 11 ++++++---- Compositor/Effects/bumpspec.eff | 5 +++++ Compositor/Effects/herbtundra.eff | 2 +- Compositor/Effects/light-cone.eff | 4 ++++ Compositor/Effects/light-point.eff | 4 ++++ Compositor/Effects/light-spot.eff | 4 ++++ .../Effects/model-combined-transparent.eff | 1 - Compositor/Effects/model-combined.eff | 2 +- Compositor/Effects/reflect.eff | 5 +++++ Compositor/Effects/shadow-vol.eff | 4 ++++ Compositor/Effects/shadow.eff | 4 ++++ Compositor/Shaders/ALS/clustered-include.frag | 2 +- Compositor/Shaders/ALS/shadows-include.vert | 13 ++++++++---- Compositor/{ALS => }/als.xml | 21 +++++++++++++++---- Compositor/default.xml | 2 +- Compositor/{LowSpec => }/low-spec.xml | 0 defaults.xml | 6 ++++++ 17 files changed, 73 insertions(+), 17 deletions(-) create mode 100644 Compositor/Effects/bumpspec.eff create mode 100644 Compositor/Effects/light-cone.eff create mode 100644 Compositor/Effects/light-point.eff create mode 100644 Compositor/Effects/light-spot.eff create mode 100644 Compositor/Effects/reflect.eff create mode 100644 Compositor/Effects/shadow-vol.eff create mode 100644 Compositor/Effects/shadow.eff rename Compositor/{ALS => }/als.xml (84%) rename Compositor/{LowSpec => }/low-spec.xml (100%) diff --git a/Compositor/Effects/ALS/shadow-pass.eff b/Compositor/Effects/ALS/shadow-pass.eff index 3a9e20a65..0b049c937 100644 --- a/Compositor/Effects/ALS/shadow-pass.eff +++ b/Compositor/Effects/ALS/shadow-pass.eff @@ -7,10 +7,13 @@ false 0 0 0 0 back - - Shaders/Default/trivial.vert - Shaders/Default/trivial.frag - + + false + + + greater + 0.5 + diff --git a/Compositor/Effects/bumpspec.eff b/Compositor/Effects/bumpspec.eff new file mode 100644 index 000000000..79c6c3293 --- /dev/null +++ b/Compositor/Effects/bumpspec.eff @@ -0,0 +1,5 @@ + + + Effects/bumpspec + Effects/model-default + diff --git a/Compositor/Effects/herbtundra.eff b/Compositor/Effects/herbtundra.eff index da6f88562..1b3367dc1 100644 --- a/Compositor/Effects/herbtundra.eff +++ b/Compositor/Effects/herbtundra.eff @@ -216,7 +216,7 @@ Shaders/Default/forest.vert Shaders/Default/include_fog.frag - Shaders/forest.frag.frag + Shaders/Default/forest.frag tangent 6 diff --git a/Compositor/Effects/light-cone.eff b/Compositor/Effects/light-cone.eff new file mode 100644 index 000000000..08b152aa6 --- /dev/null +++ b/Compositor/Effects/light-cone.eff @@ -0,0 +1,4 @@ + + + Effects/light-cone + diff --git a/Compositor/Effects/light-point.eff b/Compositor/Effects/light-point.eff new file mode 100644 index 000000000..ff33d0dbf --- /dev/null +++ b/Compositor/Effects/light-point.eff @@ -0,0 +1,4 @@ + + + Effects/light-point + diff --git a/Compositor/Effects/light-spot.eff b/Compositor/Effects/light-spot.eff new file mode 100644 index 000000000..0d1739ec6 --- /dev/null +++ b/Compositor/Effects/light-spot.eff @@ -0,0 +1,4 @@ + + + Effects/light-spot + diff --git a/Compositor/Effects/model-combined-transparent.eff b/Compositor/Effects/model-combined-transparent.eff index 55701c583..c2ae01ceb 100644 --- a/Compositor/Effects/model-combined-transparent.eff +++ b/Compositor/Effects/model-combined-transparent.eff @@ -6,7 +6,6 @@ and fallback to plain transparency when the model shader is disabled. Effects/model-combined-transparent Effects/model-combined - diff --git a/Compositor/Effects/model-combined.eff b/Compositor/Effects/model-combined.eff index 4514fd6dc..aed99f782 100644 --- a/Compositor/Effects/model-combined.eff +++ b/Compositor/Effects/model-combined.eff @@ -843,7 +843,7 @@ please see Docs/README.model-combined.eff for documentation - + als-lighting diff --git a/Compositor/Effects/reflect.eff b/Compositor/Effects/reflect.eff new file mode 100644 index 000000000..591069e1e --- /dev/null +++ b/Compositor/Effects/reflect.eff @@ -0,0 +1,5 @@ + + + Effects/reflect + Effects/model-default + diff --git a/Compositor/Effects/shadow-vol.eff b/Compositor/Effects/shadow-vol.eff new file mode 100644 index 000000000..da4367a4e --- /dev/null +++ b/Compositor/Effects/shadow-vol.eff @@ -0,0 +1,4 @@ + + + Effects/shadow-vol + diff --git a/Compositor/Effects/shadow.eff b/Compositor/Effects/shadow.eff new file mode 100644 index 000000000..791d6b477 --- /dev/null +++ b/Compositor/Effects/shadow.eff @@ -0,0 +1,4 @@ + + + Effects/shadow + diff --git a/Compositor/Shaders/ALS/clustered-include.frag b/Compositor/Shaders/ALS/clustered-include.frag index 71f2f8c26..c5b3bbdaa 100644 --- a/Compositor/Shaders/ALS/clustered-include.frag +++ b/Compositor/Shaders/ALS/clustered-include.frag @@ -38,7 +38,7 @@ layout (std140) uniform SpotLightBlock { vec3 addColors(vec3 a, vec3 b) { - return 0.14 * log(exp(a/0.14) + exp(b/0.14)); + return 0.14 * log(exp(a/0.14) + exp(b/0.14) - vec3(1.0)); } // @param p Fragment position in view space. diff --git a/Compositor/Shaders/ALS/shadows-include.vert b/Compositor/Shaders/ALS/shadows-include.vert index 4e80c8c68..bc6758ee9 100644 --- a/Compositor/Shaders/ALS/shadows-include.vert +++ b/Compositor/Shaders/ALS/shadows-include.vert @@ -1,5 +1,7 @@ #version 120 +uniform bool shadows_enabled; + uniform mat4 fg_LightMatrix_csm0; uniform mat4 fg_LightMatrix_csm1; uniform mat4 fg_LightMatrix_csm2; @@ -10,6 +12,9 @@ varying vec4 lightSpacePos[4]; void setupShadows(vec4 eyeSpacePos) { + if (!shadows_enabled) + return; + float normalOffset = 0.005; float costheta = clamp(dot(gl_Normal, gl_LightSource[0].position.xyz), 0.0, 1.0); @@ -31,8 +36,8 @@ void setupShadows(vec4 eyeSpacePos) lightSpacePos[3] = fg_LightMatrix_csm3 * eyeSpacePos; // Offset only in UV space - lightSpacePos[0].xy = offsets[0].xy; - lightSpacePos[1].xy = offsets[1].xy; - lightSpacePos[2].xy = offsets[2].xy; - lightSpacePos[3].xy = offsets[3].xy; + // lightSpacePos[0].xy = offsets[0].xy; + // lightSpacePos[1].xy = offsets[1].xy; + // lightSpacePos[2].xy = offsets[2].xy; + // lightSpacePos[3].xy = offsets[3].xy; } diff --git a/Compositor/ALS/als.xml b/Compositor/als.xml similarity index 84% rename from Compositor/ALS/als.xml rename to Compositor/als.xml index 84855f100..5ff5869c6 100644 --- a/Compositor/ALS/als.xml +++ b/Compositor/als.xml @@ -10,6 +10,13 @@ screen rgba8 + + depth + 2d + screen + screen + depth32f + sun-shadowmap-atlas 2d @@ -27,7 +34,7 @@ - + csm0 0.1 3.0 @@ -38,7 +45,7 @@ 0.5 - + csm1 3.0 50.0 @@ -49,7 +56,7 @@ 0.5 - + csm2 50.0 150.0 @@ -60,7 +67,7 @@ 0.5 - + csm3 150.0 1500.0 @@ -98,6 +105,12 @@ color0 4 4 + + + depth + depth + 4 + 4 diff --git a/Compositor/default.xml b/Compositor/default.xml index d2c35d190..3e3c5126d 100644 --- a/Compositor/default.xml +++ b/Compositor/default.xml @@ -4,4 +4,4 @@ This Compositor is used by default when none has been specified in the CameraGroup settings. --> - + diff --git a/Compositor/LowSpec/low-spec.xml b/Compositor/low-spec.xml similarity index 100% rename from Compositor/LowSpec/low-spec.xml rename to Compositor/low-spec.xml diff --git a/defaults.xml b/defaults.xml index f4d4278e5..142dffb76 100644 --- a/defaults.xml +++ b/defaults.xml @@ -53,6 +53,12 @@ Started September 2000 by David Megginson, david@megginson.com false Materials/regions/materials.xml + + + false + 1024 + + false default-pipeline