diff --git a/README.md b/README.md
index bf3016ac..5ec1fb81 100644
--- a/README.md
+++ b/README.md
@@ -381,7 +381,7 @@ r_useHDR [0 or 1] | Use High Dynamic Range lighting
r_hdrAutoExposure [0 or 1] | Adaptive tonemapping with HDR. This allows to have very bright or very dark scenes but the camera will adapt to it so the scene won't loose details
r_exposure [0 .. 1] | Default 0.5, Controls brightness and affects HDR exposure key. This is what you change in the video brightness options
r_useSSAO [0 .. 1] | Use Screen Space Ambient Occlusion to darken the corners in the scene
-r_useFilmicPostProcessEffects | Apply several post process effects to mimic a filmic look
+r_useFilmicPostProcessing | Apply several post process effects to mimic a filmic look
## Modding Support
Name | Description
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index c388dae3..e49ca8aa 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -97,6 +97,10 @@ The main goal is that the new content looks the same in RBDOOM-3-BFG as in Blend
* Added support for Mikkelsen tangent space standard for new assets (thanks to Stephen Pridham)
+* Renamed r_useFilmicPostProcessEffects to r_useFilmicPostProcessing
+
+* Replaced Motion Blur System Option with Filmic VFX (r_useFilmicPostProcessing)
+
_______________________________________
diff --git a/base/renderprogs/_manifest.lua b/base/renderprogs/_manifest.lua
index 649b8590..05f27770 100644
--- a/base/renderprogs/_manifest.lua
+++ b/base/renderprogs/_manifest.lua
@@ -7,22 +7,121 @@ return
"BRDF.inc.hlsl",
-- shaders
- "ambient_lighting.ps.hlsl",
- "ambient_lighting.vs.hlsl",
- "ambient_lighting_IBL.ps.hlsl",
- "ambient_lighting_IBL.vs.hlsl",
- "AmbientOcclusion_AO.ps.hlsl",
- "AmbientOcclusion_AO.vs.hlsl",
- "AmbientOcclusion_blur.ps.hlsl",
- "AmbientOcclusion_blur.vs.hlsl",
- "AmbientOcclusion_minify.ps.hlsl",
- "AmbientOcclusion_minify.vs.hlsl",
- "bink.ps.hlsl",
- "bink.vs.hlsl",
- "bink_gui.ps.hlsl",
- "bink_gui.vs.hlsl",
- "blendLight.ps.hlsl",
- "blendLight.vs.hlsl",
+ "builtin/debug/debug_shadowmap.ps.hlsl",
+ "builtin/debug/debug_shadowmap.vs.hlsl",
+ "builtin/debug/shadowDebug.ps.hlsl",
+ "builtin/debug/shadowDebug.vs.hlsl",
+ "builtin/debug/shadowDebug_skinned.ps.hlsl",
+ "builtin/debug/shadowDebug_skinned.vs.hlsl",
+ "builtin/debug/octahedron.ps.hlsl",
+ "builtin/debug/octahedron.vs.hlsl",
+
+ "builtin/fog/blendLight.ps.hlsl",
+ "builtin/fog/blendLight.vs.hlsl",
+ "builtin/fog/fog.ps.hlsl",
+ "builtin/fog/fog.vs.hlsl",
+ "builtin/fog/fog_skinned.ps.hlsl",
+ "builtin/fog/fog_skinned.vs.hlsl",
+
+ "builtin/legacy/bumpyenvironment.ps.hlsl",
+ "builtin/legacy/bumpyenvironment.vs.hlsl",
+ "builtin/legacy/bumpyenvironment_skinned.ps.hlsl",
+ "builtin/legacy/bumpyenvironment_skinned.vs.hlsl",
+ "builtin/legacy/environment.ps.hlsl",
+ "builtin/legacy/environment.vs.hlsl",
+ "builtin/legacy/environment_skinned.ps.hlsl",
+ "builtin/legacy/environment_skinned.vs.hlsl",
+ "builtin/legacy/skybox.ps.hlsl",
+ "builtin/legacy/skybox.vs.hlsl",
+ "builtin/legacy/wobblesky.ps.hlsl",
+ "builtin/legacy/wobblesky.vs.hlsl",
+
+ "builtin/lighting/ambient_lighting.ps.hlsl",
+ "builtin/lighting/ambient_lighting.vs.hlsl",
+ "builtin/lighting/ambient_lighting_IBL.ps.hlsl",
+ "builtin/lighting/ambient_lighting_IBL.vs.hlsl",
+ "builtin/lighting/interaction.ps.hlsl",
+ "builtin/lighting/interaction.vs.hlsl",
+ "builtin/lighting/interactionAmbient.ps.hlsl",
+ "builtin/lighting/interactionAmbient.vs.hlsl",
+ "builtin/lighting/interactionAmbient_skinned.ps.hlsl",
+ "builtin/lighting/interactionAmbient_skinned.vs.hlsl",
+ "builtin/lighting/interactionSM.ps.hlsl",
+ "builtin/lighting/interactionSM.vs.hlsl",
+ "builtin/lighting/shadow.ps.hlsl",
+ "builtin/lighting/shadow.vs.hlsl",
+ "builtin/lighting/shadow_skinned.ps.hlsl",
+ "builtin/lighting/shadow_skinned.vs.hlsl",
+
+ "builtin/post/fxaa.ps.hlsl",
+ "builtin/post/fxaa.vs.hlsl",
+ "builtin/post/hdr_glare_chromatic.ps.hlsl",
+ "builtin/post/hdr_glare_chromatic.vs.hlsl",
+ "builtin/post/motionBlur.ps.hlsl",
+ "builtin/post/motionBlur.vs.hlsl",
+ "builtin/post/postprocess.ps.hlsl",
+ "builtin/post/postprocess.vs.hlsl",
+ "builtin/post/screen.ps.hlsl",
+ "builtin/post/screen.vs.hlsl",
+ "builtin/post/SMAA_blending_weight_calc.ps.hlsl",
+ "builtin/post/SMAA_blending_weight_calc.vs.hlsl",
+ "builtin/post/SMAA_edge_detection.ps.hlsl",
+ "builtin/post/SMAA_edge_detection.vs.hlsl",
+ "builtin/post/SMAA_final.ps.hlsl",
+ "builtin/post/SMAA_final.vs.hlsl",
+ "builtin/post/tonemap.ps.hlsl",
+ "builtin/post/tonemap.vs.hlsl",
+
+ "builtin/SSAO/AmbientOcclusion_AO.ps.hlsl",
+ "builtin/SSAO/AmbientOcclusion_AO.vs.hlsl",
+ "builtin/SSAO/AmbientOcclusion_blur.ps.hlsl",
+ "builtin/SSAO/AmbientOcclusion_blur.vs.hlsl",
+ "builtin/SSAO/AmbientOcclusion_minify.ps.hlsl",
+ "builtin/SSAO/AmbientOcclusion_minify.vs.hlsl",
+
+ "builtin/SSGI/DeepGBufferRadiosity_radiosity.ps.hlsl",
+ "builtin/SSGI/DeepGBufferRadiosity_radiosity.vs.hlsl",
+ "builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl",
+ "builtin/SSGI/DeepGBufferRadiosity_blur.vs.hlsl",
+
+ "builtin/video/bink.ps.hlsl",
+ "builtin/video/bink.vs.hlsl",
+ "builtin/video/bink_gui.ps.hlsl",
+ "builtin/video/bink_gui.vs.hlsl",
+
+ "builtin/VR/stereoDeGhost.ps.hlsl",
+ "builtin/VR/stereoDeGhost.vs.hlsl",
+ "builtin/VR/stereoInterlace.ps.hlsl",
+ "builtin/VR/stereoInterlace.vs.hlsl",
+ "builtin/VR/stereoWarp.ps.hlsl",
+ "builtin/VR/stereoWarp.vs.hlsl",
+
+ "builtin/color.ps.hlsl",
+ "builtin/color.vs.hlsl",
+
+ "builtin/depth.ps.hlsl",
+ "builtin/depth.vs.hlsl",
+ "builtin/depth_skinned.ps.hlsl",
+ "builtin/depth_skinned.vs.hlsl",
+
+ "builtin/gbuffer.ps.hlsl",
+ "builtin/gbuffer.vs.hlsl",
+ "builtin/gui.ps.hlsl",
+ "builtin/gui.vs.hlsl",
+
+ "builtin/texture.ps.hlsl",
+ "builtin/texture.vs.hlsl",
+ "builtin/texture_color.ps.hlsl",
+ "builtin/texture_color.vs.hlsl",
+ "builtin/texture_color_skinned.ps.hlsl",
+ "builtin/texture_color_skinned.vs.hlsl",
+ "builtin/texture_color_texgen.ps.hlsl",
+ "builtin/texture_color_texgen.vs.hlsl",
+
+ "builtin/vertex_color.ps.hlsl",
+ "builtin/vertex_color.vs.hlsl",
+
+ -- optional shaders required by game materials
"bloodorb1_capture.ps.hlsl",
"bloodorb1_capture.vs.hlsl",
"bloodorb2_capture.ps.hlsl",
@@ -31,102 +130,16 @@ return
"bloodorb3_capture.vs.hlsl",
"bloodorb_draw.ps.hlsl",
"bloodorb_draw.vs.hlsl",
- "bumpyenvironment.ps.hlsl",
- "bumpyenvironment.vs.hlsl",
- "bumpyenvironment_skinned.ps.hlsl",
- "bumpyenvironment_skinned.vs.hlsl",
- "color.ps.hlsl",
- "color.vs.hlsl",
"colorProcess.ps.hlsl",
"colorProcess.vs.hlsl",
- "DeepGBufferRadiosity_radiosity.ps.hlsl",
- "DeepGBufferRadiosity_radiosity.vs.hlsl",
- "DeepGBufferRadiosity_blur.ps.hlsl",
- "DeepGBufferRadiosity_blur.vs.hlsl",
- "debug_shadowmap.ps.hlsl",
- "debug_shadowmap.vs.hlsl",
- "depth.ps.hlsl",
- "depth.vs.hlsl",
- "depth_skinned.ps.hlsl",
- "depth_skinned.vs.hlsl",
"enviroSuit.ps.hlsl",
"enviroSuit.vs.hlsl",
- "environment.ps.hlsl",
- "environment.vs.hlsl",
- "environment_skinned.ps.hlsl",
- "environment_skinned.vs.hlsl",
- "fog.ps.hlsl",
- "fog.vs.hlsl",
- "fog_skinned.ps.hlsl",
- "fog_skinned.vs.hlsl",
- "fxaa.ps.hlsl",
- "fxaa.vs.hlsl",
- "gbuffer.ps.hlsl",
- "gbuffer.vs.hlsl",
- "gui.ps.hlsl",
- "gui.vs.hlsl",
- "hdr_glare_chromatic.ps.hlsl",
- "hdr_glare_chromatic.vs.hlsl",
"heatHazeWithMask.ps.hlsl",
"heatHazeWithMask.vs.hlsl",
"heatHazeWithMaskAndVertex.ps.hlsl",
"heatHazeWithMaskAndVertex.vs.hlsl",
"heathaze.ps.hlsl",
"heathaze.vs.hlsl",
- "interaction.ps.hlsl",
- "interaction.vs.hlsl",
- "interactionAmbient.ps.hlsl",
- "interactionAmbient.vs.hlsl",
- "interactionAmbient_skinned.ps.hlsl",
- "interactionAmbient_skinned.vs.hlsl",
- "interactionSM.ps.hlsl",
- "interactionSM.vs.hlsl",
- "motionBlur.ps.hlsl",
- "motionBlur.vs.hlsl",
- "postprocess.ps.hlsl",
- "postprocess.vs.hlsl",
- "screen.ps.hlsl",
- "screen.vs.hlsl",
- "shadow.ps.hlsl",
- "shadow.vs.hlsl",
- "shadowDebug.ps.hlsl",
- "shadowDebug.vs.hlsl",
- "shadowDebug_skinned.ps.hlsl",
- "shadowDebug_skinned.vs.hlsl",
- "shadow_skinned.ps.hlsl",
- "shadow_skinned.vs.hlsl",
- "simpleshade.ps.hlsl",
- "simpleshade.vs.hlsl",
- "skybox.ps.hlsl",
- "skybox.vs.hlsl",
- "SMAA_blending_weight_calc.ps.hlsl",
- "SMAA_blending_weight_calc.vs.hlsl",
- "SMAA_edge_detection.ps.hlsl",
- "SMAA_edge_detection.vs.hlsl",
- "SMAA_final.ps.hlsl",
- "SMAA_final.vs.hlsl",
- "stereoDeGhost.ps.hlsl",
- "stereoDeGhost.vs.hlsl",
- "stereoInterlace.ps.hlsl",
- "stereoInterlace.vs.hlsl",
- "stereoWarp.ps.hlsl",
- "stereoWarp.vs.hlsl",
- "texture.ps.hlsl",
- "texture.vs.hlsl",
- "texture_color.ps.hlsl",
- "texture_color.vs.hlsl",
- "texture_color_skinned.ps.hlsl",
- "texture_color_skinned.vs.hlsl",
- "texture_color_texgen.ps.hlsl",
- "texture_color_texgen.vs.hlsl",
- "tonemap.ps.hlsl",
- "tonemap.vs.hlsl",
- "vertex_color.ps.hlsl",
- "vertex_color.vs.hlsl",
- "wobblesky.ps.hlsl",
- "wobblesky.vs.hlsl",
- "zcullReconstruct.ps.hlsl",
- "zcullReconstruct.vs.hlsl",
}
diff --git a/base/renderprogs/bloodorb1_capture.ps.hlsl b/base/renderprogs/bloodorb1_capture.ps.hlsl
index 04162ae8..bb6efa0d 100644
--- a/base/renderprogs/bloodorb1_capture.ps.hlsl
+++ b/base/renderprogs/bloodorb1_capture.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); //_accum
diff --git a/base/renderprogs/bloodorb1_capture.vs.hlsl b/base/renderprogs/bloodorb1_capture.vs.hlsl
index 30b4cf8c..57fc9a70 100644
--- a/base/renderprogs/bloodorb1_capture.vs.hlsl
+++ b/base/renderprogs/bloodorb1_capture.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform float4 rpUser0 : register( c128 ); //rpCenterScale
diff --git a/base/renderprogs/bloodorb2_capture.ps.hlsl b/base/renderprogs/bloodorb2_capture.ps.hlsl
index 7b500dd1..a0dddc8a 100644
--- a/base/renderprogs/bloodorb2_capture.ps.hlsl
+++ b/base/renderprogs/bloodorb2_capture.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); //_accum
diff --git a/base/renderprogs/bloodorb2_capture.vs.hlsl b/base/renderprogs/bloodorb2_capture.vs.hlsl
index ce677359..08aed7f4 100644
--- a/base/renderprogs/bloodorb2_capture.vs.hlsl
+++ b/base/renderprogs/bloodorb2_capture.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform float4 rpUser0 : register( c128 ); //rpCenterScaleTex0
diff --git a/base/renderprogs/bloodorb3_capture.ps.hlsl b/base/renderprogs/bloodorb3_capture.ps.hlsl
index d49d1cf5..9c115252 100644
--- a/base/renderprogs/bloodorb3_capture.ps.hlsl
+++ b/base/renderprogs/bloodorb3_capture.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); //_accum
diff --git a/base/renderprogs/bloodorb3_capture.vs.hlsl b/base/renderprogs/bloodorb3_capture.vs.hlsl
index 80531a83..e7eb7bd8 100644
--- a/base/renderprogs/bloodorb3_capture.vs.hlsl
+++ b/base/renderprogs/bloodorb3_capture.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform float4 rpUser0 : register( c128 ); //rpCenterScaleTex
diff --git a/base/renderprogs/bloodorb_draw.ps.hlsl b/base/renderprogs/bloodorb_draw.ps.hlsl
index 01a9b378..b81a92a7 100644
--- a/base/renderprogs/bloodorb_draw.ps.hlsl
+++ b/base/renderprogs/bloodorb_draw.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); //_accum
diff --git a/base/renderprogs/bloodorb_draw.vs.hlsl b/base/renderprogs/bloodorb_draw.vs.hlsl
index 81561cc1..5474a9da 100644
--- a/base/renderprogs/bloodorb_draw.vs.hlsl
+++ b/base/renderprogs/bloodorb_draw.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/AmbientOcclusion_AO.ps.hlsl b/base/renderprogs/builtin/SSAO/AmbientOcclusion_AO.ps.hlsl
similarity index 99%
rename from base/renderprogs/AmbientOcclusion_AO.ps.hlsl
rename to base/renderprogs/builtin/SSAO/AmbientOcclusion_AO.ps.hlsl
index 389176a8..98b039a6 100644
--- a/base/renderprogs/AmbientOcclusion_AO.ps.hlsl
+++ b/base/renderprogs/builtin/SSAO/AmbientOcclusion_AO.ps.hlsl
@@ -29,7 +29,8 @@
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
diff --git a/base/renderprogs/AmbientOcclusion_AO.vs.hlsl b/base/renderprogs/builtin/SSAO/AmbientOcclusion_AO.vs.hlsl
similarity index 97%
rename from base/renderprogs/AmbientOcclusion_AO.vs.hlsl
rename to base/renderprogs/builtin/SSAO/AmbientOcclusion_AO.vs.hlsl
index 06898657..b8e13538 100644
--- a/base/renderprogs/AmbientOcclusion_AO.vs.hlsl
+++ b/base/renderprogs/builtin/SSAO/AmbientOcclusion_AO.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN
diff --git a/base/renderprogs/AmbientOcclusion_blur.ps.hlsl b/base/renderprogs/builtin/SSAO/AmbientOcclusion_blur.ps.hlsl
similarity index 99%
rename from base/renderprogs/AmbientOcclusion_blur.ps.hlsl
rename to base/renderprogs/builtin/SSAO/AmbientOcclusion_blur.ps.hlsl
index 14196763..4c67d3ca 100644
--- a/base/renderprogs/AmbientOcclusion_blur.ps.hlsl
+++ b/base/renderprogs/builtin/SSAO/AmbientOcclusion_blur.ps.hlsl
@@ -16,7 +16,8 @@
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register( s0 ); // view normals
diff --git a/base/renderprogs/AmbientOcclusion_blur.vs.hlsl b/base/renderprogs/builtin/SSAO/AmbientOcclusion_blur.vs.hlsl
similarity index 97%
rename from base/renderprogs/AmbientOcclusion_blur.vs.hlsl
rename to base/renderprogs/builtin/SSAO/AmbientOcclusion_blur.vs.hlsl
index 06898657..b8e13538 100644
--- a/base/renderprogs/AmbientOcclusion_blur.vs.hlsl
+++ b/base/renderprogs/builtin/SSAO/AmbientOcclusion_blur.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN
diff --git a/base/renderprogs/AmbientOcclusion_minify.ps.hlsl b/base/renderprogs/builtin/SSAO/AmbientOcclusion_minify.ps.hlsl
similarity index 98%
rename from base/renderprogs/AmbientOcclusion_minify.ps.hlsl
rename to base/renderprogs/builtin/SSAO/AmbientOcclusion_minify.ps.hlsl
index 7b4b37cb..0ddd69de 100644
--- a/base/renderprogs/AmbientOcclusion_minify.ps.hlsl
+++ b/base/renderprogs/builtin/SSAO/AmbientOcclusion_minify.ps.hlsl
@@ -15,7 +15,8 @@
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register( s0 ); // zbuffer
diff --git a/base/renderprogs/AmbientOcclusion_minify.vs.hlsl b/base/renderprogs/builtin/SSAO/AmbientOcclusion_minify.vs.hlsl
similarity index 97%
rename from base/renderprogs/AmbientOcclusion_minify.vs.hlsl
rename to base/renderprogs/builtin/SSAO/AmbientOcclusion_minify.vs.hlsl
index 06898657..b8e13538 100644
--- a/base/renderprogs/AmbientOcclusion_minify.vs.hlsl
+++ b/base/renderprogs/builtin/SSAO/AmbientOcclusion_minify.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN
diff --git a/base/renderprogs/DeepGBufferRadiosity_blur.ps.hlsl b/base/renderprogs/builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl
similarity index 99%
rename from base/renderprogs/DeepGBufferRadiosity_blur.ps.hlsl
rename to base/renderprogs/builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl
index 93049278..30c84858 100644
--- a/base/renderprogs/DeepGBufferRadiosity_blur.ps.hlsl
+++ b/base/renderprogs/builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl
@@ -16,7 +16,8 @@
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register( s0 ); // view normals
diff --git a/base/renderprogs/DeepGBufferRadiosity_blur.vs.hlsl b/base/renderprogs/builtin/SSGI/DeepGBufferRadiosity_blur.vs.hlsl
similarity index 97%
rename from base/renderprogs/DeepGBufferRadiosity_blur.vs.hlsl
rename to base/renderprogs/builtin/SSGI/DeepGBufferRadiosity_blur.vs.hlsl
index 06898657..b8e13538 100644
--- a/base/renderprogs/DeepGBufferRadiosity_blur.vs.hlsl
+++ b/base/renderprogs/builtin/SSGI/DeepGBufferRadiosity_blur.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN
diff --git a/base/renderprogs/DeepGBufferRadiosity_radiosity.ps.hlsl b/base/renderprogs/builtin/SSGI/DeepGBufferRadiosity_radiosity.ps.hlsl
similarity index 99%
rename from base/renderprogs/DeepGBufferRadiosity_radiosity.ps.hlsl
rename to base/renderprogs/builtin/SSGI/DeepGBufferRadiosity_radiosity.ps.hlsl
index 45c2aa04..d76c681a 100644
--- a/base/renderprogs/DeepGBufferRadiosity_radiosity.ps.hlsl
+++ b/base/renderprogs/builtin/SSGI/DeepGBufferRadiosity_radiosity.ps.hlsl
@@ -1,5 +1,6 @@
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// #version 120 // -*- c++ -*-
// #extension GL_EXT_gpu_shader4 : require
diff --git a/base/renderprogs/DeepGBufferRadiosity_radiosity.vs.hlsl b/base/renderprogs/builtin/SSGI/DeepGBufferRadiosity_radiosity.vs.hlsl
similarity index 97%
rename from base/renderprogs/DeepGBufferRadiosity_radiosity.vs.hlsl
rename to base/renderprogs/builtin/SSGI/DeepGBufferRadiosity_radiosity.vs.hlsl
index 06898657..b8e13538 100644
--- a/base/renderprogs/DeepGBufferRadiosity_radiosity.vs.hlsl
+++ b/base/renderprogs/builtin/SSGI/DeepGBufferRadiosity_radiosity.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN
diff --git a/base/renderprogs/stereoDeGhost.ps.hlsl b/base/renderprogs/builtin/VR/stereoDeGhost.ps.hlsl
similarity index 97%
rename from base/renderprogs/stereoDeGhost.ps.hlsl
rename to base/renderprogs/builtin/VR/stereoDeGhost.ps.hlsl
index 3251a234..17a4d39f 100644
--- a/base/renderprogs/stereoDeGhost.ps.hlsl
+++ b/base/renderprogs/builtin/VR/stereoDeGhost.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/stereoDeGhost.vs.hlsl b/base/renderprogs/builtin/VR/stereoDeGhost.vs.hlsl
similarity index 98%
rename from base/renderprogs/stereoDeGhost.vs.hlsl
rename to base/renderprogs/builtin/VR/stereoDeGhost.vs.hlsl
index 5ba29f16..941643cd 100644
--- a/base/renderprogs/stereoDeGhost.vs.hlsl
+++ b/base/renderprogs/builtin/VR/stereoDeGhost.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/stereoInterlace.ps.hlsl b/base/renderprogs/builtin/VR/stereoInterlace.ps.hlsl
similarity index 98%
rename from base/renderprogs/stereoInterlace.ps.hlsl
rename to base/renderprogs/builtin/VR/stereoInterlace.ps.hlsl
index 405a3e02..434b2df7 100644
--- a/base/renderprogs/stereoInterlace.ps.hlsl
+++ b/base/renderprogs/builtin/VR/stereoInterlace.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/stereoInterlace.vs.hlsl b/base/renderprogs/builtin/VR/stereoInterlace.vs.hlsl
similarity index 98%
rename from base/renderprogs/stereoInterlace.vs.hlsl
rename to base/renderprogs/builtin/VR/stereoInterlace.vs.hlsl
index f51f67c3..fd1e6d18 100644
--- a/base/renderprogs/stereoInterlace.vs.hlsl
+++ b/base/renderprogs/builtin/VR/stereoInterlace.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/stereoWarp.ps.hlsl b/base/renderprogs/builtin/VR/stereoWarp.ps.hlsl
similarity index 98%
rename from base/renderprogs/stereoWarp.ps.hlsl
rename to base/renderprogs/builtin/VR/stereoWarp.ps.hlsl
index 90dccf37..e50c6cc2 100644
--- a/base/renderprogs/stereoWarp.ps.hlsl
+++ b/base/renderprogs/builtin/VR/stereoWarp.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
/*
diff --git a/base/renderprogs/stereoWarp.vs.hlsl b/base/renderprogs/builtin/VR/stereoWarp.vs.hlsl
similarity index 98%
rename from base/renderprogs/stereoWarp.vs.hlsl
rename to base/renderprogs/builtin/VR/stereoWarp.vs.hlsl
index ebaec269..e5217bf0 100644
--- a/base/renderprogs/stereoWarp.vs.hlsl
+++ b/base/renderprogs/builtin/VR/stereoWarp.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/color.ps.hlsl b/base/renderprogs/builtin/color.ps.hlsl
similarity index 97%
rename from base/renderprogs/color.ps.hlsl
rename to base/renderprogs/builtin/color.ps.hlsl
index 3251a234..17a4d39f 100644
--- a/base/renderprogs/color.ps.hlsl
+++ b/base/renderprogs/builtin/color.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/color.vs.hlsl b/base/renderprogs/builtin/color.vs.hlsl
similarity index 98%
rename from base/renderprogs/color.vs.hlsl
rename to base/renderprogs/builtin/color.vs.hlsl
index 177605ac..57b2d72c 100644
--- a/base/renderprogs/color.vs.hlsl
+++ b/base/renderprogs/builtin/color.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
#if defined(USE_GPU_SKINNING)
uniform matrices_ubo { float4 matrices[408]; };
diff --git a/base/renderprogs/debug_shadowmap.ps.hlsl b/base/renderprogs/builtin/debug/debug_shadowmap.ps.hlsl
similarity index 98%
rename from base/renderprogs/debug_shadowmap.ps.hlsl
rename to base/renderprogs/builtin/debug/debug_shadowmap.ps.hlsl
index ec330b44..c99b9c5a 100644
--- a/base/renderprogs/debug_shadowmap.ps.hlsl
+++ b/base/renderprogs/builtin/debug/debug_shadowmap.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2DArray samp0 : register(s0);
diff --git a/base/renderprogs/debug_shadowmap.vs.hlsl b/base/renderprogs/builtin/debug/debug_shadowmap.vs.hlsl
similarity index 98%
rename from base/renderprogs/debug_shadowmap.vs.hlsl
rename to base/renderprogs/builtin/debug/debug_shadowmap.vs.hlsl
index d15c952f..a8aca020 100644
--- a/base/renderprogs/debug_shadowmap.vs.hlsl
+++ b/base/renderprogs/builtin/debug/debug_shadowmap.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/zcullReconstruct.ps.hlsl b/base/renderprogs/builtin/debug/octahedron.ps.hlsl
similarity index 63%
rename from base/renderprogs/zcullReconstruct.ps.hlsl
rename to base/renderprogs/builtin/debug/octahedron.ps.hlsl
index 8194481b..8ef576de 100644
--- a/base/renderprogs/zcullReconstruct.ps.hlsl
+++ b/base/renderprogs/builtin/debug/octahedron.ps.hlsl
@@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
+Copyright (C) 2020 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@@ -26,17 +27,38 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
-struct PS_OUT {
- float depth : DEPTH;
+uniform sampler2D samp0 : register(s0); // texture 0 is octahedron cube map
+
+struct PS_IN {
+ float4 position : VPOS;
+ float3 texcoord0 : TEXCOORD0_centroid;
+ float3 texcoord1 : TEXCOORD1_centroid;
+ float4 color : COLOR0;
+};
+
+struct PS_OUT {
float4 color : COLOR;
};
// *INDENT-ON*
-void main( out PS_OUT result )
+void main( PS_IN fragment, out PS_OUT result )
{
- result.depth = 1;
- result.color = float4( 0.0, 0.0, 0.0, 0.0 );
-}
\ No newline at end of file
+
+ float3 globalNormal = normalize( fragment.texcoord1 );
+ float3 globalEye = normalize( fragment.texcoord0 );
+
+ float3 reflectionVector = _float3( dot3( globalEye, globalNormal ) );
+ reflectionVector *= globalNormal;
+ reflectionVector = ( reflectionVector * 2.0f ) - globalEye;
+
+ float2 normalizedOctCoord = octEncode( reflectionVector );
+ float2 normalizedOctCoordZeroOne = ( normalizedOctCoord + float2( 1.0 ) ) * 0.5;
+
+ float4 envMap = tex2D( samp0, normalizedOctCoordZeroOne );
+
+ result.color = float4( sRGBToLinearRGB( envMap.xyz ), 1.0f ) * fragment.color;
+}
diff --git a/base/renderprogs/builtin/debug/octahedron.vs.hlsl b/base/renderprogs/builtin/debug/octahedron.vs.hlsl
new file mode 100644
index 00000000..ca9cab0c
--- /dev/null
+++ b/base/renderprogs/builtin/debug/octahedron.vs.hlsl
@@ -0,0 +1,120 @@
+/*
+===========================================================================
+
+Doom 3 BFG Edition GPL Source Code
+Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
+Copyright (C) 2020 Robert Beckebans
+
+This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
+
+Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Doom 3 BFG Edition Source Code. If not, see .
+
+In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
+
+If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
+
+===========================================================================
+*/
+
+#include "renderprogs/global.inc.hlsl"
+
+
+uniform matrices_ubo { float4 matrices[408]; };
+
+// *INDENT-OFF*
+struct VS_IN {
+ float4 position : POSITION;
+ float2 texcoord : TEXCOORD0;
+ float4 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR0;
+ float4 color2 : COLOR1;
+};
+
+struct VS_OUT {
+ float4 position : POSITION;
+ float3 texcoord0 : TEXCOORD0;
+ float3 texcoord1 : TEXCOORD1;
+ float4 color : COLOR0;
+};
+// *INDENT-ON*
+
+void main( VS_IN vertex, out VS_OUT result )
+{
+ float4 vNormal = vertex.normal * 2.0 - 1.0;
+
+#if defined( USE_GPU_SKINNING )
+
+ //--------------------------------------------------------------
+ // GPU transformation of the normal / binormal / bitangent
+ //
+ // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
+ //--------------------------------------------------------------
+ const float w0 = vertex.color2.x;
+ const float w1 = vertex.color2.y;
+ const float w2 = vertex.color2.z;
+ const float w3 = vertex.color2.w;
+
+ float4 matX, matY, matZ; // must be float4 for vec4
+ int joint = int( vertex.color.x * 255.1 * 3.0 );
+ matX = matrices[int( joint + 0 )] * w0;
+ matY = matrices[int( joint + 1 )] * w0;
+ matZ = matrices[int( joint + 2 )] * w0;
+
+ joint = int( vertex.color.y * 255.1 * 3.0 );
+ matX += matrices[int( joint + 0 )] * w1;
+ matY += matrices[int( joint + 1 )] * w1;
+ matZ += matrices[int( joint + 2 )] * w1;
+
+ joint = int( vertex.color.z * 255.1 * 3.0 );
+ matX += matrices[int( joint + 0 )] * w2;
+ matY += matrices[int( joint + 1 )] * w2;
+ matZ += matrices[int( joint + 2 )] * w2;
+
+ joint = int( vertex.color.w * 255.1 * 3.0 );
+ matX += matrices[int( joint + 0 )] * w3;
+ matY += matrices[int( joint + 1 )] * w3;
+ matZ += matrices[int( joint + 2 )] * w3;
+
+ float3 normal;
+ normal.x = dot3( matX, vNormal );
+ normal.y = dot3( matY, vNormal );
+ normal.z = dot3( matZ, vNormal );
+ normal = normalize( normal );
+
+ float4 modelPosition;
+ modelPosition.x = dot4( matX, vertex.position );
+ modelPosition.y = dot4( matY, vertex.position );
+ modelPosition.z = dot4( matZ, vertex.position );
+ modelPosition.w = 1.0;
+
+#else
+
+ float4 modelPosition = vertex.position;
+ float4 normal = vNormal;
+
+#endif
+
+ result.position.x = dot4( modelPosition, rpMVPmatrixX );
+ result.position.y = dot4( modelPosition, rpMVPmatrixY );
+ result.position.z = dot4( modelPosition, rpMVPmatrixZ );
+ result.position.w = dot4( modelPosition, rpMVPmatrixW );
+
+ float4 toEye = rpLocalViewOrigin - vertex.position;
+
+ result.texcoord0 = toEye.xyz;
+ result.texcoord1 = normal.xyz;
+
+ result.color = sRGBAToLinearRGBA( rpColor );
+}
diff --git a/base/renderprogs/shadowDebug.ps.hlsl b/base/renderprogs/builtin/debug/shadowDebug.ps.hlsl
similarity index 97%
rename from base/renderprogs/shadowDebug.ps.hlsl
rename to base/renderprogs/builtin/debug/shadowDebug.ps.hlsl
index 3251a234..17a4d39f 100644
--- a/base/renderprogs/shadowDebug.ps.hlsl
+++ b/base/renderprogs/builtin/debug/shadowDebug.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/shadowDebug.vs.hlsl b/base/renderprogs/builtin/debug/shadowDebug.vs.hlsl
similarity index 98%
rename from base/renderprogs/shadowDebug.vs.hlsl
rename to base/renderprogs/builtin/debug/shadowDebug.vs.hlsl
index 58aed0dd..24aacd4e 100644
--- a/base/renderprogs/shadowDebug.vs.hlsl
+++ b/base/renderprogs/builtin/debug/shadowDebug.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/shadowDebug_skinned.ps.hlsl b/base/renderprogs/builtin/debug/shadowDebug_skinned.ps.hlsl
similarity index 97%
rename from base/renderprogs/shadowDebug_skinned.ps.hlsl
rename to base/renderprogs/builtin/debug/shadowDebug_skinned.ps.hlsl
index 3251a234..17a4d39f 100644
--- a/base/renderprogs/shadowDebug_skinned.ps.hlsl
+++ b/base/renderprogs/builtin/debug/shadowDebug_skinned.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/shadowDebug_skinned.vs.hlsl b/base/renderprogs/builtin/debug/shadowDebug_skinned.vs.hlsl
similarity index 98%
rename from base/renderprogs/shadowDebug_skinned.vs.hlsl
rename to base/renderprogs/builtin/debug/shadowDebug_skinned.vs.hlsl
index 78653b28..9c03f6a1 100644
--- a/base/renderprogs/shadowDebug_skinned.vs.hlsl
+++ b/base/renderprogs/builtin/debug/shadowDebug_skinned.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
uniform matrices_ubo { float4 matrices[408]; };
diff --git a/base/renderprogs/depth.ps.hlsl b/base/renderprogs/builtin/depth.ps.hlsl
similarity index 97%
rename from base/renderprogs/depth.ps.hlsl
rename to base/renderprogs/builtin/depth.ps.hlsl
index 26f25047..18732db9 100644
--- a/base/renderprogs/depth.ps.hlsl
+++ b/base/renderprogs/builtin/depth.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/depth.vs.hlsl b/base/renderprogs/builtin/depth.vs.hlsl
similarity index 98%
rename from base/renderprogs/depth.vs.hlsl
rename to base/renderprogs/builtin/depth.vs.hlsl
index f57f5d43..c79954a4 100644
--- a/base/renderprogs/depth.vs.hlsl
+++ b/base/renderprogs/builtin/depth.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/depth_skinned.ps.hlsl b/base/renderprogs/builtin/depth_skinned.ps.hlsl
similarity index 97%
rename from base/renderprogs/depth_skinned.ps.hlsl
rename to base/renderprogs/builtin/depth_skinned.ps.hlsl
index 26f25047..18732db9 100644
--- a/base/renderprogs/depth_skinned.ps.hlsl
+++ b/base/renderprogs/builtin/depth_skinned.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/depth_skinned.vs.hlsl b/base/renderprogs/builtin/depth_skinned.vs.hlsl
similarity index 98%
rename from base/renderprogs/depth_skinned.vs.hlsl
rename to base/renderprogs/builtin/depth_skinned.vs.hlsl
index 30f6ea0c..2cfb93e7 100644
--- a/base/renderprogs/depth_skinned.vs.hlsl
+++ b/base/renderprogs/builtin/depth_skinned.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
uniform matrices_ubo { float4 matrices[408]; };
diff --git a/base/renderprogs/blendLight.ps.hlsl b/base/renderprogs/builtin/fog/blendLight.ps.hlsl
similarity index 98%
rename from base/renderprogs/blendLight.ps.hlsl
rename to base/renderprogs/builtin/fog/blendLight.ps.hlsl
index 6dd83028..919b5dd7 100644
--- a/base/renderprogs/blendLight.ps.hlsl
+++ b/base/renderprogs/builtin/fog/blendLight.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/blendLight.vs.hlsl b/base/renderprogs/builtin/fog/blendLight.vs.hlsl
similarity index 98%
rename from base/renderprogs/blendLight.vs.hlsl
rename to base/renderprogs/builtin/fog/blendLight.vs.hlsl
index a8e2c5e8..ce4ffab1 100644
--- a/base/renderprogs/blendLight.vs.hlsl
+++ b/base/renderprogs/builtin/fog/blendLight.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/fog.ps.hlsl b/base/renderprogs/builtin/fog/fog.ps.hlsl
similarity index 98%
rename from base/renderprogs/fog.ps.hlsl
rename to base/renderprogs/builtin/fog/fog.ps.hlsl
index 95c7fd70..28507e63 100644
--- a/base/renderprogs/fog.ps.hlsl
+++ b/base/renderprogs/builtin/fog/fog.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/fog.vs.hlsl b/base/renderprogs/builtin/fog/fog.vs.hlsl
similarity index 98%
rename from base/renderprogs/fog.vs.hlsl
rename to base/renderprogs/builtin/fog/fog.vs.hlsl
index 47e0302d..438b945e 100644
--- a/base/renderprogs/fog.vs.hlsl
+++ b/base/renderprogs/builtin/fog/fog.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/fog_skinned.ps.hlsl b/base/renderprogs/builtin/fog/fog_skinned.ps.hlsl
similarity index 98%
rename from base/renderprogs/fog_skinned.ps.hlsl
rename to base/renderprogs/builtin/fog/fog_skinned.ps.hlsl
index 95c7fd70..28507e63 100644
--- a/base/renderprogs/fog_skinned.ps.hlsl
+++ b/base/renderprogs/builtin/fog/fog_skinned.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/fog_skinned.vs.hlsl b/base/renderprogs/builtin/fog/fog_skinned.vs.hlsl
similarity index 98%
rename from base/renderprogs/fog_skinned.vs.hlsl
rename to base/renderprogs/builtin/fog/fog_skinned.vs.hlsl
index 054a0a3f..5d968151 100644
--- a/base/renderprogs/fog_skinned.vs.hlsl
+++ b/base/renderprogs/builtin/fog/fog_skinned.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
uniform matrices_ubo { float4 matrices[408]; };
diff --git a/base/renderprogs/gbuffer.ps.hlsl b/base/renderprogs/builtin/gbuffer.ps.hlsl
similarity index 98%
rename from base/renderprogs/gbuffer.ps.hlsl
rename to base/renderprogs/builtin/gbuffer.ps.hlsl
index ba03b484..8cc0d393 100644
--- a/base/renderprogs/gbuffer.ps.hlsl
+++ b/base/renderprogs/builtin/gbuffer.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); // normal map
diff --git a/base/renderprogs/gbuffer.vs.hlsl b/base/renderprogs/builtin/gbuffer.vs.hlsl
similarity index 99%
rename from base/renderprogs/gbuffer.vs.hlsl
rename to base/renderprogs/builtin/gbuffer.vs.hlsl
index 1c339b87..40f45b0b 100644
--- a/base/renderprogs/gbuffer.vs.hlsl
+++ b/base/renderprogs/builtin/gbuffer.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
#if defined( USE_GPU_SKINNING )
uniform matrices_ubo { float4 matrices[408]; };
diff --git a/base/renderprogs/gui.ps.hlsl b/base/renderprogs/builtin/gui.ps.hlsl
similarity index 98%
rename from base/renderprogs/gui.ps.hlsl
rename to base/renderprogs/builtin/gui.ps.hlsl
index a3357f0c..cb4bf123 100644
--- a/base/renderprogs/gui.ps.hlsl
+++ b/base/renderprogs/builtin/gui.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/gui.vs.hlsl b/base/renderprogs/builtin/gui.vs.hlsl
similarity index 98%
rename from base/renderprogs/gui.vs.hlsl
rename to base/renderprogs/builtin/gui.vs.hlsl
index f0c0501d..673ae1fe 100644
--- a/base/renderprogs/gui.vs.hlsl
+++ b/base/renderprogs/builtin/gui.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/bumpyenvironment.ps.hlsl b/base/renderprogs/builtin/legacy/bumpyenvironment.ps.hlsl
similarity index 98%
rename from base/renderprogs/bumpyenvironment.ps.hlsl
rename to base/renderprogs/builtin/legacy/bumpyenvironment.ps.hlsl
index abcba0f9..912b732b 100644
--- a/base/renderprogs/bumpyenvironment.ps.hlsl
+++ b/base/renderprogs/builtin/legacy/bumpyenvironment.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
diff --git a/base/renderprogs/bumpyenvironment.vs.hlsl b/base/renderprogs/builtin/legacy/bumpyenvironment.vs.hlsl
similarity index 98%
rename from base/renderprogs/bumpyenvironment.vs.hlsl
rename to base/renderprogs/builtin/legacy/bumpyenvironment.vs.hlsl
index 2884bf16..03ece170 100644
--- a/base/renderprogs/bumpyenvironment.vs.hlsl
+++ b/base/renderprogs/builtin/legacy/bumpyenvironment.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/bumpyenvironment_skinned.ps.hlsl b/base/renderprogs/builtin/legacy/bumpyenvironment_skinned.ps.hlsl
similarity index 98%
rename from base/renderprogs/bumpyenvironment_skinned.ps.hlsl
rename to base/renderprogs/builtin/legacy/bumpyenvironment_skinned.ps.hlsl
index ab6e566f..0a8d65c0 100644
--- a/base/renderprogs/bumpyenvironment_skinned.ps.hlsl
+++ b/base/renderprogs/builtin/legacy/bumpyenvironment_skinned.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
diff --git a/base/renderprogs/bumpyenvironment_skinned.vs.hlsl b/base/renderprogs/builtin/legacy/bumpyenvironment_skinned.vs.hlsl
similarity index 99%
rename from base/renderprogs/bumpyenvironment_skinned.vs.hlsl
rename to base/renderprogs/builtin/legacy/bumpyenvironment_skinned.vs.hlsl
index 0d7de212..02afd6d0 100644
--- a/base/renderprogs/bumpyenvironment_skinned.vs.hlsl
+++ b/base/renderprogs/builtin/legacy/bumpyenvironment_skinned.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform matrices_ubo { float4 matrices[408]; };
diff --git a/base/renderprogs/environment.ps.hlsl b/base/renderprogs/builtin/legacy/environment.ps.hlsl
similarity index 98%
rename from base/renderprogs/environment.ps.hlsl
rename to base/renderprogs/builtin/legacy/environment.ps.hlsl
index 12511ff4..53d6a35d 100644
--- a/base/renderprogs/environment.ps.hlsl
+++ b/base/renderprogs/builtin/legacy/environment.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
diff --git a/base/renderprogs/environment.vs.hlsl b/base/renderprogs/builtin/legacy/environment.vs.hlsl
similarity index 98%
rename from base/renderprogs/environment.vs.hlsl
rename to base/renderprogs/builtin/legacy/environment.vs.hlsl
index 931838d1..312451da 100644
--- a/base/renderprogs/environment.vs.hlsl
+++ b/base/renderprogs/builtin/legacy/environment.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/environment_skinned.ps.hlsl b/base/renderprogs/builtin/legacy/environment_skinned.ps.hlsl
similarity index 98%
rename from base/renderprogs/environment_skinned.ps.hlsl
rename to base/renderprogs/builtin/legacy/environment_skinned.ps.hlsl
index 12511ff4..53d6a35d 100644
--- a/base/renderprogs/environment_skinned.ps.hlsl
+++ b/base/renderprogs/builtin/legacy/environment_skinned.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
diff --git a/base/renderprogs/environment_skinned.vs.hlsl b/base/renderprogs/builtin/legacy/environment_skinned.vs.hlsl
similarity index 99%
rename from base/renderprogs/environment_skinned.vs.hlsl
rename to base/renderprogs/builtin/legacy/environment_skinned.vs.hlsl
index 02892239..64652c6b 100644
--- a/base/renderprogs/environment_skinned.vs.hlsl
+++ b/base/renderprogs/builtin/legacy/environment_skinned.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
uniform matrices_ubo { float4 matrices[408]; };
diff --git a/base/renderprogs/skybox.ps.hlsl b/base/renderprogs/builtin/legacy/skybox.ps.hlsl
similarity index 97%
rename from base/renderprogs/skybox.ps.hlsl
rename to base/renderprogs/builtin/legacy/skybox.ps.hlsl
index 18fdd1fa..a1fd7746 100644
--- a/base/renderprogs/skybox.ps.hlsl
+++ b/base/renderprogs/builtin/legacy/skybox.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform samplerCUBE samp0 : register(s0);
diff --git a/base/renderprogs/skybox.vs.hlsl b/base/renderprogs/builtin/legacy/skybox.vs.hlsl
similarity index 98%
rename from base/renderprogs/skybox.vs.hlsl
rename to base/renderprogs/builtin/legacy/skybox.vs.hlsl
index 4db0dc39..5675fd62 100644
--- a/base/renderprogs/skybox.vs.hlsl
+++ b/base/renderprogs/builtin/legacy/skybox.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/wobblesky.ps.hlsl b/base/renderprogs/builtin/legacy/wobblesky.ps.hlsl
similarity index 97%
rename from base/renderprogs/wobblesky.ps.hlsl
rename to base/renderprogs/builtin/legacy/wobblesky.ps.hlsl
index 18fdd1fa..a1fd7746 100644
--- a/base/renderprogs/wobblesky.ps.hlsl
+++ b/base/renderprogs/builtin/legacy/wobblesky.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform samplerCUBE samp0 : register(s0);
diff --git a/base/renderprogs/wobblesky.vs.hlsl b/base/renderprogs/builtin/legacy/wobblesky.vs.hlsl
similarity index 98%
rename from base/renderprogs/wobblesky.vs.hlsl
rename to base/renderprogs/builtin/legacy/wobblesky.vs.hlsl
index d0d72137..79b6f684 100644
--- a/base/renderprogs/wobblesky.vs.hlsl
+++ b/base/renderprogs/builtin/legacy/wobblesky.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/ambient_lighting.ps.hlsl b/base/renderprogs/builtin/lighting/ambient_lighting.ps.hlsl
similarity index 99%
rename from base/renderprogs/ambient_lighting.ps.hlsl
rename to base/renderprogs/builtin/lighting/ambient_lighting.ps.hlsl
index d60ec9f9..517d9753 100644
--- a/base/renderprogs/ambient_lighting.ps.hlsl
+++ b/base/renderprogs/builtin/lighting/ambient_lighting.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map
diff --git a/base/renderprogs/ambient_lighting.vs.hlsl b/base/renderprogs/builtin/lighting/ambient_lighting.vs.hlsl
similarity index 99%
rename from base/renderprogs/ambient_lighting.vs.hlsl
rename to base/renderprogs/builtin/lighting/ambient_lighting.vs.hlsl
index a1e5e82f..1839ac1b 100644
--- a/base/renderprogs/ambient_lighting.vs.hlsl
+++ b/base/renderprogs/builtin/lighting/ambient_lighting.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
#if defined( USE_GPU_SKINNING )
uniform matrices_ubo { float4 matrices[408]; };
diff --git a/base/renderprogs/ambient_lighting_IBL.ps.hlsl b/base/renderprogs/builtin/lighting/ambient_lighting_IBL.ps.hlsl
similarity index 89%
rename from base/renderprogs/ambient_lighting_IBL.ps.hlsl
rename to base/renderprogs/builtin/lighting/ambient_lighting_IBL.ps.hlsl
index bf177439..d4108784 100644
--- a/base/renderprogs/ambient_lighting_IBL.ps.hlsl
+++ b/base/renderprogs/builtin/lighting/ambient_lighting_IBL.ps.hlsl
@@ -27,8 +27,10 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
-#include "BRDF.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
+#include "renderprogs/BRDF.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); // texture 0 is the per-surface normal map
@@ -37,8 +39,8 @@ uniform sampler2D samp2 : register(s2); // texture 2 is the per-surface baseColo
uniform sampler2D samp3 : register(s3); // texture 3 is the BRDF LUT
uniform sampler2D samp4 : register(s4); // texture 4 is SSAO
-uniform samplerCUBE samp7 : register(s7); // texture 7 is the irradiance cube map
-uniform samplerCUBE samp8 : register(s8); // texture 8 is the radiance cube map
+uniform sampler2D samp7 : register(s7); // texture 7 is the irradiance cube map
+uniform sampler2D samp8 : register(s8); // texture 8 is the radiance cube map
struct PS_IN
{
@@ -59,6 +61,7 @@ struct PS_OUT
};
// *INDENT-ON*
+
void main( PS_IN fragment, out PS_OUT result )
{
half4 bumpMap = tex2D( samp0, fragment.texcoord0.xy );
@@ -81,11 +84,12 @@ void main( PS_IN fragment, out PS_OUT result )
globalNormal.x = dot3( localNormal, fragment.texcoord4 );
globalNormal.y = dot3( localNormal, fragment.texcoord5 );
globalNormal.z = dot3( localNormal, fragment.texcoord6 );
+ globalNormal = normalize( globalNormal );
float3 globalEye = normalize( fragment.texcoord3.xyz );
float3 reflectionVector = globalNormal * dot3( globalEye, globalNormal );
- reflectionVector = ( reflectionVector * 2.0f ) - globalEye;
+ reflectionVector = normalize( ( reflectionVector * 2.0f ) - globalEye );
half vDotN = saturate( dot3( globalEye, globalNormal ) );
@@ -150,7 +154,10 @@ void main( PS_IN fragment, out PS_OUT result )
// evaluate diffuse IBL
- float3 irradiance = texCUBE( samp7, globalNormal ).rgb;
+ float2 normalizedOctCoord = octEncode( globalNormal );
+ float2 normalizedOctCoordZeroOne = ( normalizedOctCoord + float2( 1.0 ) ) * 0.5;
+
+ float3 irradiance = tex2D( samp7, normalizedOctCoordZeroOne ).rgb;
float3 diffuseLight = ( kD * irradiance * diffuseColor ) * ao * ( rpDiffuseModifier.xyz * 1.0 );
// evaluate specular IBL
@@ -159,7 +166,12 @@ void main( PS_IN fragment, out PS_OUT result )
const float MAX_REFLECTION_LOD = 10.0;
float mip = clamp( ( roughness * MAX_REFLECTION_LOD ), 0.0, MAX_REFLECTION_LOD );
//float mip = 0.0;
- float3 radiance = textureLod( samp8, reflectionVector, mip ).rgb;
+
+ normalizedOctCoord = octEncode( reflectionVector );
+ normalizedOctCoordZeroOne = ( normalizedOctCoord + float2( 1.0 ) ) * 0.5;
+
+ float3 radiance = textureLod( samp8, normalizedOctCoordZeroOne, mip ).rgb;
+ //radiance = float3( 0.0 );
float2 envBRDF = texture( samp3, float2( max( vDotN, 0.0 ), roughness ) ).rg;
diff --git a/base/renderprogs/ambient_lighting_IBL.vs.hlsl b/base/renderprogs/builtin/lighting/ambient_lighting_IBL.vs.hlsl
similarity index 99%
rename from base/renderprogs/ambient_lighting_IBL.vs.hlsl
rename to base/renderprogs/builtin/lighting/ambient_lighting_IBL.vs.hlsl
index 5bfc659c..7eee66c1 100644
--- a/base/renderprogs/ambient_lighting_IBL.vs.hlsl
+++ b/base/renderprogs/builtin/lighting/ambient_lighting_IBL.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
#if defined( USE_GPU_SKINNING )
uniform matrices_ubo { float4 matrices[408]; };
diff --git a/base/renderprogs/interaction.ps.hlsl b/base/renderprogs/builtin/lighting/interaction.ps.hlsl
similarity index 98%
rename from base/renderprogs/interaction.ps.hlsl
rename to base/renderprogs/builtin/lighting/interaction.ps.hlsl
index fad381ee..d0faa08f 100644
--- a/base/renderprogs/interaction.ps.hlsl
+++ b/base/renderprogs/builtin/lighting/interaction.ps.hlsl
@@ -27,8 +27,10 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
-#include "BRDF.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
+#include "renderprogs/BRDF.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map
@@ -103,7 +105,7 @@ void main( PS_IN fragment, out PS_OUT result )
const half roughness = specMapSRGB.r;
const half glossiness = 1.0 - roughness;
- // the vast majority of real-world materials (anything not metal or gems) have F(0°)
+ // the vast majority of real-world materials (anything not metal or gems) have F(0�)
// values in a very narrow range (~0.02 - 0.08)
// approximate non-metals with linear RGB 0.04 which is 0.08 * 0.5 (default in UE4)
diff --git a/base/renderprogs/interaction.vs.hlsl b/base/renderprogs/builtin/lighting/interaction.vs.hlsl
similarity index 99%
rename from base/renderprogs/interaction.vs.hlsl
rename to base/renderprogs/builtin/lighting/interaction.vs.hlsl
index 7fd920a2..3cc5c2d1 100644
--- a/base/renderprogs/interaction.vs.hlsl
+++ b/base/renderprogs/builtin/lighting/interaction.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
#if defined( USE_GPU_SKINNING )
uniform matrices_ubo { float4 matrices[408]; };
diff --git a/base/renderprogs/interactionAmbient.ps.hlsl b/base/renderprogs/builtin/lighting/interactionAmbient.ps.hlsl
similarity index 99%
rename from base/renderprogs/interactionAmbient.ps.hlsl
rename to base/renderprogs/builtin/lighting/interactionAmbient.ps.hlsl
index 9db23247..1315575e 100644
--- a/base/renderprogs/interactionAmbient.ps.hlsl
+++ b/base/renderprogs/builtin/lighting/interactionAmbient.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map
diff --git a/base/renderprogs/interactionAmbient.vs.hlsl b/base/renderprogs/builtin/lighting/interactionAmbient.vs.hlsl
similarity index 99%
rename from base/renderprogs/interactionAmbient.vs.hlsl
rename to base/renderprogs/builtin/lighting/interactionAmbient.vs.hlsl
index 87b213f9..0dbe9644 100644
--- a/base/renderprogs/interactionAmbient.vs.hlsl
+++ b/base/renderprogs/builtin/lighting/interactionAmbient.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/interactionAmbient_skinned.ps.hlsl b/base/renderprogs/builtin/lighting/interactionAmbient_skinned.ps.hlsl
similarity index 99%
rename from base/renderprogs/interactionAmbient_skinned.ps.hlsl
rename to base/renderprogs/builtin/lighting/interactionAmbient_skinned.ps.hlsl
index 9db23247..1315575e 100644
--- a/base/renderprogs/interactionAmbient_skinned.ps.hlsl
+++ b/base/renderprogs/builtin/lighting/interactionAmbient_skinned.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map
diff --git a/base/renderprogs/interactionAmbient_skinned.vs.hlsl b/base/renderprogs/builtin/lighting/interactionAmbient_skinned.vs.hlsl
similarity index 99%
rename from base/renderprogs/interactionAmbient_skinned.vs.hlsl
rename to base/renderprogs/builtin/lighting/interactionAmbient_skinned.vs.hlsl
index df7ad214..1e72d695 100644
--- a/base/renderprogs/interactionAmbient_skinned.vs.hlsl
+++ b/base/renderprogs/builtin/lighting/interactionAmbient_skinned.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
uniform matrices_ubo { float4 matrices[408]; };
diff --git a/base/renderprogs/interactionSM.ps.hlsl b/base/renderprogs/builtin/lighting/interactionSM.ps.hlsl
similarity index 99%
rename from base/renderprogs/interactionSM.ps.hlsl
rename to base/renderprogs/builtin/lighting/interactionSM.ps.hlsl
index 8bb2dca6..f77a74bc 100644
--- a/base/renderprogs/interactionSM.ps.hlsl
+++ b/base/renderprogs/builtin/lighting/interactionSM.ps.hlsl
@@ -28,8 +28,10 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
-#include "BRDF.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
+#include "renderprogs/BRDF.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map
@@ -394,7 +396,7 @@ void main( PS_IN fragment, out PS_OUT result )
const half roughness = specMapSRGB.r;
const half glossiness = 1.0 - roughness;
- // the vast majority of real-world materials (anything not metal or gems) have F(0°)
+ // the vast majority of real-world materials (anything not metal or gems) have F(0�)
// values in a very narrow range (~0.02 - 0.08)
// approximate non-metals with linear RGB 0.04 which is 0.08 * 0.5 (default in UE4)
diff --git a/base/renderprogs/interactionSM.vs.hlsl b/base/renderprogs/builtin/lighting/interactionSM.vs.hlsl
similarity index 99%
rename from base/renderprogs/interactionSM.vs.hlsl
rename to base/renderprogs/builtin/lighting/interactionSM.vs.hlsl
index 7747510d..18f58003 100644
--- a/base/renderprogs/interactionSM.vs.hlsl
+++ b/base/renderprogs/builtin/lighting/interactionSM.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
#if defined( USE_GPU_SKINNING )
uniform matrices_ubo { float4 matrices[408]; };
diff --git a/base/renderprogs/shadow.ps.hlsl b/base/renderprogs/builtin/lighting/shadow.ps.hlsl
similarity index 97%
rename from base/renderprogs/shadow.ps.hlsl
rename to base/renderprogs/builtin/lighting/shadow.ps.hlsl
index 3251a234..17a4d39f 100644
--- a/base/renderprogs/shadow.ps.hlsl
+++ b/base/renderprogs/builtin/lighting/shadow.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/shadow.vs.hlsl b/base/renderprogs/builtin/lighting/shadow.vs.hlsl
similarity index 98%
rename from base/renderprogs/shadow.vs.hlsl
rename to base/renderprogs/builtin/lighting/shadow.vs.hlsl
index 58aed0dd..24aacd4e 100644
--- a/base/renderprogs/shadow.vs.hlsl
+++ b/base/renderprogs/builtin/lighting/shadow.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/shadow_skinned.ps.hlsl b/base/renderprogs/builtin/lighting/shadow_skinned.ps.hlsl
similarity index 97%
rename from base/renderprogs/shadow_skinned.ps.hlsl
rename to base/renderprogs/builtin/lighting/shadow_skinned.ps.hlsl
index 3251a234..17a4d39f 100644
--- a/base/renderprogs/shadow_skinned.ps.hlsl
+++ b/base/renderprogs/builtin/lighting/shadow_skinned.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/shadow_skinned.vs.hlsl b/base/renderprogs/builtin/lighting/shadow_skinned.vs.hlsl
similarity index 98%
rename from base/renderprogs/shadow_skinned.vs.hlsl
rename to base/renderprogs/builtin/lighting/shadow_skinned.vs.hlsl
index a6c73ea4..445fa4d1 100644
--- a/base/renderprogs/shadow_skinned.vs.hlsl
+++ b/base/renderprogs/builtin/lighting/shadow_skinned.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform matrices_ubo { float4 matrices[408]; };
diff --git a/base/renderprogs/SMAA.inc.hlsl b/base/renderprogs/builtin/post/SMAA.inc.hlsl
similarity index 100%
rename from base/renderprogs/SMAA.inc.hlsl
rename to base/renderprogs/builtin/post/SMAA.inc.hlsl
diff --git a/base/renderprogs/SMAA_blending_weight_calc.ps.hlsl b/base/renderprogs/builtin/post/SMAA_blending_weight_calc.ps.hlsl
similarity index 98%
rename from base/renderprogs/SMAA_blending_weight_calc.ps.hlsl
rename to base/renderprogs/builtin/post/SMAA_blending_weight_calc.ps.hlsl
index 86a20b29..fca0703a 100644
--- a/base/renderprogs/SMAA_blending_weight_calc.ps.hlsl
+++ b/base/renderprogs/builtin/post/SMAA_blending_weight_calc.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
#define SMAA_INCLUDE_VS 0
#define SMAA_INCLUDE_PS 1
diff --git a/base/renderprogs/SMAA_blending_weight_calc.vs.hlsl b/base/renderprogs/builtin/post/SMAA_blending_weight_calc.vs.hlsl
similarity index 98%
rename from base/renderprogs/SMAA_blending_weight_calc.vs.hlsl
rename to base/renderprogs/builtin/post/SMAA_blending_weight_calc.vs.hlsl
index 0bb9882d..9e9c536b 100644
--- a/base/renderprogs/SMAA_blending_weight_calc.vs.hlsl
+++ b/base/renderprogs/builtin/post/SMAA_blending_weight_calc.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
#define SMAA_INCLUDE_VS 1
#define SMAA_INCLUDE_PS 0
diff --git a/base/renderprogs/SMAA_edge_detection.ps.hlsl b/base/renderprogs/builtin/post/SMAA_edge_detection.ps.hlsl
similarity index 98%
rename from base/renderprogs/SMAA_edge_detection.ps.hlsl
rename to base/renderprogs/builtin/post/SMAA_edge_detection.ps.hlsl
index 9801984d..886a5b37 100644
--- a/base/renderprogs/SMAA_edge_detection.ps.hlsl
+++ b/base/renderprogs/builtin/post/SMAA_edge_detection.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
#define SMAA_INCLUDE_VS 0
#define SMAA_INCLUDE_PS 1
diff --git a/base/renderprogs/SMAA_edge_detection.vs.hlsl b/base/renderprogs/builtin/post/SMAA_edge_detection.vs.hlsl
similarity index 98%
rename from base/renderprogs/SMAA_edge_detection.vs.hlsl
rename to base/renderprogs/builtin/post/SMAA_edge_detection.vs.hlsl
index ce802173..1fc8c4c2 100644
--- a/base/renderprogs/SMAA_edge_detection.vs.hlsl
+++ b/base/renderprogs/builtin/post/SMAA_edge_detection.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
#define SMAA_INCLUDE_VS 1
#define SMAA_INCLUDE_PS 0
diff --git a/base/renderprogs/SMAA_final.ps.hlsl b/base/renderprogs/builtin/post/SMAA_final.ps.hlsl
similarity index 98%
rename from base/renderprogs/SMAA_final.ps.hlsl
rename to base/renderprogs/builtin/post/SMAA_final.ps.hlsl
index 353dfabb..5bba4729 100644
--- a/base/renderprogs/SMAA_final.ps.hlsl
+++ b/base/renderprogs/builtin/post/SMAA_final.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
#define SMAA_INCLUDE_VS 0
#define SMAA_INCLUDE_PS 1
diff --git a/base/renderprogs/SMAA_final.vs.hlsl b/base/renderprogs/builtin/post/SMAA_final.vs.hlsl
similarity index 98%
rename from base/renderprogs/SMAA_final.vs.hlsl
rename to base/renderprogs/builtin/post/SMAA_final.vs.hlsl
index d63eb676..3f658623 100644
--- a/base/renderprogs/SMAA_final.vs.hlsl
+++ b/base/renderprogs/builtin/post/SMAA_final.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
#define SMAA_INCLUDE_VS 1
#define SMAA_INCLUDE_PS 0
diff --git a/base/renderprogs/fxaa.ps.hlsl b/base/renderprogs/builtin/post/fxaa.ps.hlsl
similarity index 99%
rename from base/renderprogs/fxaa.ps.hlsl
rename to base/renderprogs/builtin/post/fxaa.ps.hlsl
index 7df020fd..e7aca66c 100644
--- a/base/renderprogs/fxaa.ps.hlsl
+++ b/base/renderprogs/builtin/post/fxaa.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
#define FXAA_GREEN_AS_LUMA 1
#define FXAA_EARLY_EXIT 0
#include "Fxaa3_11.h"
diff --git a/base/renderprogs/fxaa.vs.hlsl b/base/renderprogs/builtin/post/fxaa.vs.hlsl
similarity index 98%
rename from base/renderprogs/fxaa.vs.hlsl
rename to base/renderprogs/builtin/post/fxaa.vs.hlsl
index 0687ba0f..74262be2 100644
--- a/base/renderprogs/fxaa.vs.hlsl
+++ b/base/renderprogs/builtin/post/fxaa.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/hdr_glare_chromatic.ps.hlsl b/base/renderprogs/builtin/post/hdr_glare_chromatic.ps.hlsl
similarity index 99%
rename from base/renderprogs/hdr_glare_chromatic.ps.hlsl
rename to base/renderprogs/builtin/post/hdr_glare_chromatic.ps.hlsl
index c2c3c176..b9282b07 100644
--- a/base/renderprogs/hdr_glare_chromatic.ps.hlsl
+++ b/base/renderprogs/builtin/post/hdr_glare_chromatic.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/hdr_glare_chromatic.vs.hlsl b/base/renderprogs/builtin/post/hdr_glare_chromatic.vs.hlsl
similarity index 98%
rename from base/renderprogs/hdr_glare_chromatic.vs.hlsl
rename to base/renderprogs/builtin/post/hdr_glare_chromatic.vs.hlsl
index 38ff6db5..5830cc1b 100644
--- a/base/renderprogs/hdr_glare_chromatic.vs.hlsl
+++ b/base/renderprogs/builtin/post/hdr_glare_chromatic.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/motionBlur.ps.hlsl b/base/renderprogs/builtin/post/motionBlur.ps.hlsl
similarity index 98%
rename from base/renderprogs/motionBlur.ps.hlsl
rename to base/renderprogs/builtin/post/motionBlur.ps.hlsl
index 40d1be0b..8cc951db 100644
--- a/base/renderprogs/motionBlur.ps.hlsl
+++ b/base/renderprogs/builtin/post/motionBlur.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); // view color
diff --git a/base/renderprogs/motionBlur.vs.hlsl b/base/renderprogs/builtin/post/motionBlur.vs.hlsl
similarity index 97%
rename from base/renderprogs/motionBlur.vs.hlsl
rename to base/renderprogs/builtin/post/motionBlur.vs.hlsl
index 5810eb11..1cba163f 100644
--- a/base/renderprogs/motionBlur.vs.hlsl
+++ b/base/renderprogs/builtin/post/motionBlur.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/postprocess.ps.hlsl b/base/renderprogs/builtin/post/postprocess.ps.hlsl
similarity index 99%
rename from base/renderprogs/postprocess.ps.hlsl
rename to base/renderprogs/builtin/post/postprocess.ps.hlsl
index 1c086cc2..5342785d 100644
--- a/base/renderprogs/postprocess.ps.hlsl
+++ b/base/renderprogs/builtin/post/postprocess.ps.hlsl
@@ -29,7 +29,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/postprocess.vs.hlsl b/base/renderprogs/builtin/post/postprocess.vs.hlsl
similarity index 98%
rename from base/renderprogs/postprocess.vs.hlsl
rename to base/renderprogs/builtin/post/postprocess.vs.hlsl
index 38ff6db5..5830cc1b 100644
--- a/base/renderprogs/postprocess.vs.hlsl
+++ b/base/renderprogs/builtin/post/postprocess.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/screen.ps.hlsl b/base/renderprogs/builtin/post/screen.ps.hlsl
similarity index 98%
rename from base/renderprogs/screen.ps.hlsl
rename to base/renderprogs/builtin/post/screen.ps.hlsl
index d6544af7..2760cdde 100644
--- a/base/renderprogs/screen.ps.hlsl
+++ b/base/renderprogs/builtin/post/screen.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/screen.vs.hlsl b/base/renderprogs/builtin/post/screen.vs.hlsl
similarity index 98%
rename from base/renderprogs/screen.vs.hlsl
rename to base/renderprogs/builtin/post/screen.vs.hlsl
index 38ff6db5..5830cc1b 100644
--- a/base/renderprogs/screen.vs.hlsl
+++ b/base/renderprogs/builtin/post/screen.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/tonemap.ps.hlsl b/base/renderprogs/builtin/post/tonemap.ps.hlsl
similarity index 99%
rename from base/renderprogs/tonemap.ps.hlsl
rename to base/renderprogs/builtin/post/tonemap.ps.hlsl
index 1184ff76..d0d6d1e2 100644
--- a/base/renderprogs/tonemap.ps.hlsl
+++ b/base/renderprogs/builtin/post/tonemap.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); // texture 0 is _currentRender
diff --git a/base/renderprogs/tonemap.vs.hlsl b/base/renderprogs/builtin/post/tonemap.vs.hlsl
similarity index 98%
rename from base/renderprogs/tonemap.vs.hlsl
rename to base/renderprogs/builtin/post/tonemap.vs.hlsl
index 38ff6db5..5830cc1b 100644
--- a/base/renderprogs/tonemap.vs.hlsl
+++ b/base/renderprogs/builtin/post/tonemap.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/texture.ps.hlsl b/base/renderprogs/builtin/texture.ps.hlsl
similarity index 98%
rename from base/renderprogs/texture.ps.hlsl
rename to base/renderprogs/builtin/texture.ps.hlsl
index 9c301df2..c368628b 100644
--- a/base/renderprogs/texture.ps.hlsl
+++ b/base/renderprogs/builtin/texture.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/texture.vs.hlsl b/base/renderprogs/builtin/texture.vs.hlsl
similarity index 98%
rename from base/renderprogs/texture.vs.hlsl
rename to base/renderprogs/builtin/texture.vs.hlsl
index d15c952f..a8aca020 100644
--- a/base/renderprogs/texture.vs.hlsl
+++ b/base/renderprogs/builtin/texture.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/texture_color.ps.hlsl b/base/renderprogs/builtin/texture_color.ps.hlsl
similarity index 98%
rename from base/renderprogs/texture_color.ps.hlsl
rename to base/renderprogs/builtin/texture_color.ps.hlsl
index f946e43b..c3103eee 100644
--- a/base/renderprogs/texture_color.ps.hlsl
+++ b/base/renderprogs/builtin/texture_color.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/texture_color.vs.hlsl b/base/renderprogs/builtin/texture_color.vs.hlsl
similarity index 98%
rename from base/renderprogs/texture_color.vs.hlsl
rename to base/renderprogs/builtin/texture_color.vs.hlsl
index 75a83d6c..f431b112 100644
--- a/base/renderprogs/texture_color.vs.hlsl
+++ b/base/renderprogs/builtin/texture_color.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/texture_color_skinned.ps.hlsl b/base/renderprogs/builtin/texture_color_skinned.ps.hlsl
similarity index 98%
rename from base/renderprogs/texture_color_skinned.ps.hlsl
rename to base/renderprogs/builtin/texture_color_skinned.ps.hlsl
index f946e43b..c3103eee 100644
--- a/base/renderprogs/texture_color_skinned.ps.hlsl
+++ b/base/renderprogs/builtin/texture_color_skinned.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/texture_color_skinned.vs.hlsl b/base/renderprogs/builtin/texture_color_skinned.vs.hlsl
similarity index 99%
rename from base/renderprogs/texture_color_skinned.vs.hlsl
rename to base/renderprogs/builtin/texture_color_skinned.vs.hlsl
index efd15a0a..c57d8715 100644
--- a/base/renderprogs/texture_color_skinned.vs.hlsl
+++ b/base/renderprogs/builtin/texture_color_skinned.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
uniform matrices_ubo { float4 matrices[408]; };
diff --git a/base/renderprogs/texture_color_texgen.ps.hlsl b/base/renderprogs/builtin/texture_color_texgen.ps.hlsl
similarity index 98%
rename from base/renderprogs/texture_color_texgen.ps.hlsl
rename to base/renderprogs/builtin/texture_color_texgen.ps.hlsl
index d6aa1906..4391b609 100644
--- a/base/renderprogs/texture_color_texgen.ps.hlsl
+++ b/base/renderprogs/builtin/texture_color_texgen.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
uniform sampler2D samp0 :
register( s0 );
diff --git a/base/renderprogs/texture_color_texgen.vs.hlsl b/base/renderprogs/builtin/texture_color_texgen.vs.hlsl
similarity index 98%
rename from base/renderprogs/texture_color_texgen.vs.hlsl
rename to base/renderprogs/builtin/texture_color_texgen.vs.hlsl
index f1ae40f6..71b10bf5 100644
--- a/base/renderprogs/texture_color_texgen.vs.hlsl
+++ b/base/renderprogs/builtin/texture_color_texgen.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/vertex_color.ps.hlsl b/base/renderprogs/builtin/vertex_color.ps.hlsl
similarity index 97%
rename from base/renderprogs/vertex_color.ps.hlsl
rename to base/renderprogs/builtin/vertex_color.ps.hlsl
index 39b8620a..6977a517 100644
--- a/base/renderprogs/vertex_color.ps.hlsl
+++ b/base/renderprogs/builtin/vertex_color.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/vertex_color.vs.hlsl b/base/renderprogs/builtin/vertex_color.vs.hlsl
similarity index 98%
rename from base/renderprogs/vertex_color.vs.hlsl
rename to base/renderprogs/builtin/vertex_color.vs.hlsl
index 8fe784ee..ffa15799 100644
--- a/base/renderprogs/vertex_color.vs.hlsl
+++ b/base/renderprogs/builtin/vertex_color.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN
diff --git a/base/renderprogs/bink.ps.hlsl b/base/renderprogs/builtin/video/bink.ps.hlsl
similarity index 98%
rename from base/renderprogs/bink.ps.hlsl
rename to base/renderprogs/builtin/video/bink.ps.hlsl
index 89cd689a..a0e236fc 100644
--- a/base/renderprogs/bink.ps.hlsl
+++ b/base/renderprogs/builtin/video/bink.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); // Y
diff --git a/base/renderprogs/bink.vs.hlsl b/base/renderprogs/builtin/video/bink.vs.hlsl
similarity index 98%
rename from base/renderprogs/bink.vs.hlsl
rename to base/renderprogs/builtin/video/bink.vs.hlsl
index 8188818b..edf787ef 100644
--- a/base/renderprogs/bink.vs.hlsl
+++ b/base/renderprogs/builtin/video/bink.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/bink_gui.ps.hlsl b/base/renderprogs/builtin/video/bink_gui.ps.hlsl
similarity index 98%
rename from base/renderprogs/bink_gui.ps.hlsl
rename to base/renderprogs/builtin/video/bink_gui.ps.hlsl
index 5a7a3d82..8adf8f41 100644
--- a/base/renderprogs/bink_gui.ps.hlsl
+++ b/base/renderprogs/builtin/video/bink_gui.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); // Y
diff --git a/base/renderprogs/bink_gui.vs.hlsl b/base/renderprogs/builtin/video/bink_gui.vs.hlsl
similarity index 98%
rename from base/renderprogs/bink_gui.vs.hlsl
rename to base/renderprogs/builtin/video/bink_gui.vs.hlsl
index f0c0501d..673ae1fe 100644
--- a/base/renderprogs/bink_gui.vs.hlsl
+++ b/base/renderprogs/builtin/video/bink_gui.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
struct VS_IN {
diff --git a/base/renderprogs/colorProcess.ps.hlsl b/base/renderprogs/colorProcess.ps.hlsl
index 1f6510a8..417f0cf2 100644
--- a/base/renderprogs/colorProcess.ps.hlsl
+++ b/base/renderprogs/colorProcess.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0);
diff --git a/base/renderprogs/colorProcess.vs.hlsl b/base/renderprogs/colorProcess.vs.hlsl
index 9844effc..e9f657a1 100644
--- a/base/renderprogs/colorProcess.vs.hlsl
+++ b/base/renderprogs/colorProcess.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform float4 rpUser0 : register(c128); //rpFraction
diff --git a/base/renderprogs/enviroSuit.ps.hlsl b/base/renderprogs/enviroSuit.ps.hlsl
index 061c2356..a1040bc9 100644
--- a/base/renderprogs/enviroSuit.ps.hlsl
+++ b/base/renderprogs/enviroSuit.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); // texture 0 is _current Render
diff --git a/base/renderprogs/enviroSuit.vs.hlsl b/base/renderprogs/enviroSuit.vs.hlsl
index b14a2a64..fdb79b35 100644
--- a/base/renderprogs/enviroSuit.vs.hlsl
+++ b/base/renderprogs/enviroSuit.vs.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// User Renderparms start at 128 as per renderprogs.h
diff --git a/base/renderprogs/global.inc.hlsl b/base/renderprogs/global.inc.hlsl
index 3c10a87b..6177467d 100644
--- a/base/renderprogs/global.inc.hlsl
+++ b/base/renderprogs/global.inc.hlsl
@@ -205,8 +205,49 @@ float4 LinearRGBToSRGB( float4 c )
#endif
}
+/** Efficient GPU implementation of the octahedral unit vector encoding from
+
+ Cigolle, Donow, Evangelakos, Mara, McGuire, Meyer,
+ A Survey of Efficient Representations for Independent Unit Vectors, Journal of Computer Graphics Techniques (JCGT), vol. 3, no. 2, 1-30, 2014
+
+ Available online http://jcgt.org/published/0003/02/01/
+*/
+
+float signNotZeroFloat( float k )
+{
+ return ( k >= 0.0 ) ? 1.0 : -1.0;
+}
+float2 signNotZero( float2 v )
+{
+ return float2( signNotZeroFloat( v.x ), signNotZeroFloat( v.y ) );
+}
+
+/** Assumes that v is a unit vector. The result is an octahedral vector on the [-1, +1] square. */
+float2 octEncode( float3 v )
+{
+ float l1norm = abs( v.x ) + abs( v.y ) + abs( v.z );
+ float2 oct = v.xy * ( 1.0 / l1norm );
+ if( v.z < 0.0 )
+ {
+ oct = ( 1.0 - abs( oct.yx ) ) * signNotZero( oct.xy );
+ }
+ return oct;
+}
+
+
+/** Returns a unit vector. Argument o is an octahedral vector packed via octEncode,
+ on the [-1, +1] square*/
+float3 octDecode( float2 o )
+{
+ float3 v = float3( o.x, o.y, 1.0 - abs( o.x ) - abs( o.y ) );
+ if( v.z < 0.0 )
+ {
+ v.xy = ( 1.0 - abs( v.yx ) ) * signNotZero( v.xy );
+ }
+ return normalize( v );
+}
// RB end
diff --git a/base/renderprogs/heatHazeWithMask.ps.hlsl b/base/renderprogs/heatHazeWithMask.ps.hlsl
index 53db287f..63206168 100644
--- a/base/renderprogs/heatHazeWithMask.ps.hlsl
+++ b/base/renderprogs/heatHazeWithMask.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); // texture 0 is _current Render
diff --git a/base/renderprogs/heatHazeWithMask.vs.hlsl b/base/renderprogs/heatHazeWithMask.vs.hlsl
index 0e5e1615..158f2a39 100644
--- a/base/renderprogs/heatHazeWithMask.vs.hlsl
+++ b/base/renderprogs/heatHazeWithMask.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// RB: no GPU skinning with ES 2.0
#if defined(USE_GPU_SKINNING)
@@ -59,7 +60,8 @@ struct VS_OUT {
void main( VS_IN vertex, out VS_OUT result )
{
-#include "skinning.inc.hlsl"
+#include "renderprogs/skinning.inc.hlsl"
+
// texture 0 takes the texture coordinates unmodified
result.texcoord0 = float4( vertex.texcoord.xy, 0, 0 );
diff --git a/base/renderprogs/heatHazeWithMaskAndVertex.ps.hlsl b/base/renderprogs/heatHazeWithMaskAndVertex.ps.hlsl
index c4f58130..1c60f2f3 100644
--- a/base/renderprogs/heatHazeWithMaskAndVertex.ps.hlsl
+++ b/base/renderprogs/heatHazeWithMaskAndVertex.ps.hlsl
@@ -26,7 +26,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); // texture 0 is _current Render
diff --git a/base/renderprogs/heatHazeWithMaskAndVertex.vs.hlsl b/base/renderprogs/heatHazeWithMaskAndVertex.vs.hlsl
index c965b849..9b0898fd 100644
--- a/base/renderprogs/heatHazeWithMaskAndVertex.vs.hlsl
+++ b/base/renderprogs/heatHazeWithMaskAndVertex.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// RB: no GPU skinning with ES 2.0
#if defined(USE_GPU_SKINNING)
@@ -60,7 +61,8 @@ struct VS_OUT {
void main( VS_IN vertex, out VS_OUT result )
{
-#include "skinning.inc.hlsl"
+#include "renderprogs/skinning.inc.hlsl"
+
// texture 0 takes the texture coordinates unmodified
result.texcoord0 = float4( vertex.texcoord, 0 , 0 );
diff --git a/base/renderprogs/heathaze.ps.hlsl b/base/renderprogs/heathaze.ps.hlsl
index 41c7add3..c99e86af 100644
--- a/base/renderprogs/heathaze.ps.hlsl
+++ b/base/renderprogs/heathaze.ps.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// *INDENT-OFF*
uniform sampler2D samp0 : register(s0); // texture 0 is _current Render
diff --git a/base/renderprogs/heathaze.vs.hlsl b/base/renderprogs/heathaze.vs.hlsl
index dd00de1d..081c6878 100644
--- a/base/renderprogs/heathaze.vs.hlsl
+++ b/base/renderprogs/heathaze.vs.hlsl
@@ -27,7 +27,8 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "global.inc.hlsl"
+#include "renderprogs/global.inc.hlsl"
+
// User Renderparms start at 128 as per renderprogs.h
@@ -60,7 +61,8 @@ struct VS_OUT {
void main( VS_IN vertex, out VS_OUT result )
{
-#include "skinning.inc.hlsl"
+#include "renderprogs/skinning.inc.hlsl"
+
//texture 0 takes the texture coordinates and adds a scroll
const float4 textureScroll = rpUser0;
diff --git a/base/renderprogs/simpleshade.ps.hlsl b/base/renderprogs/simpleshade.ps.hlsl
deleted file mode 100644
index 7129cbee..00000000
--- a/base/renderprogs/simpleshade.ps.hlsl
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-===========================================================================
-
-Doom 3 BFG Edition GPL Source Code
-Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
-
-This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
-
-Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Doom 3 BFG Edition Source Code. If not, see .
-
-In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
-
-If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
-
-===========================================================================
-*/
-
-#include "global.inc.hlsl"
-
-// *INDENT-OFF*
-uniform sampler2D samp0 : register(s0);
-
-struct PS_IN {
- float4 position : VPOS;
- float4 texcoord0 : TEXCOORD0_centroid;
-};
-
-struct PS_OUT {
- float4 color : COLOR;
-};
-// *INDENT-OFF*
-
-static float2 screenPosToTexcoord( float2 pos, float4 bias_scale ) { return ( pos * bias_scale.zw + bias_scale.xy ); }
-
-void main( PS_IN fragment, out PS_OUT result ) {
- const float renderWidth = 1280.0f;
- const float renderHeight = 720.0f;
- const float4 positionToViewTexture = float4( 0.5f / renderWidth, 0.5f / renderHeight, 1.0f / renderWidth, 1.0f / renderHeight );
-
- float interpolatedZOverW = ( 1.0 - ( fragment.texcoord0.z / fragment.texcoord0.w ) );
-
- float3 pos;
- pos.z = 1.0 / interpolatedZOverW;
- pos.xy = pos.z * ( 2.0 * screenPosToTexcoord( fragment.position.xy, positionToViewTexture ) - 1.0 );
-
- float3 normal = normalize( cross( ddy( pos ), ddx( pos ) ) );
-
- // light is above and to the right in the eye plane
- float3 L = normalize( float3( 1.0, 1.0, 0.0 ) - pos );
-
- result.color.xyz = _float3( dot3( normal, L ) * 0.75 );
- result.color.w = 1.0;
-}
\ No newline at end of file
diff --git a/base/renderprogs/simpleshade.vs.hlsl b/base/renderprogs/simpleshade.vs.hlsl
deleted file mode 100644
index e0d60bf2..00000000
--- a/base/renderprogs/simpleshade.vs.hlsl
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-===========================================================================
-
-Doom 3 BFG Edition GPL Source Code
-Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
-
-This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
-
-Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Doom 3 BFG Edition Source Code. If not, see .
-
-In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
-
-If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
-
-===========================================================================
-*/
-
-#include "global.inc.hlsl"
-
-// *INDENT-OFF*
-struct VS_IN {
- float4 position : POSITION;
- float2 texcoord : TEXCOORD0;
- float4 normal : NORMAL;
- float4 tangent : TANGENT;
- float4 color : COLOR0;
-};
-
-struct VS_OUT {
- float4 position : POSITION;
- float4 texcoord0 : TEXCOORD0;
-};
-// *INDENT-ON*
-
-void main( VS_IN vertex, out VS_OUT result )
-{
- float4 position;
- position.x = dot4( vertex.position, rpMVPmatrixX );
- position.y = dot4( vertex.position, rpMVPmatrixY );
- position.z = dot4( vertex.position, rpMVPmatrixZ );
- position.w = dot4( vertex.position, rpMVPmatrixW );
-
- result.position = position;
- result.texcoord0 = position;
-}
\ No newline at end of file
diff --git a/base/renderprogs/zcullReconstruct.vs.hlsl b/base/renderprogs/zcullReconstruct.vs.hlsl
deleted file mode 100644
index ea5e5534..00000000
--- a/base/renderprogs/zcullReconstruct.vs.hlsl
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-===========================================================================
-
-Doom 3 BFG Edition GPL Source Code
-Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
-
-This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
-
-Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Doom 3 BFG Edition Source Code. If not, see .
-
-In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
-
-If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
-
-===========================================================================
-*/
-
-#include "global.inc.hlsl"
-
-// *INDENT-OFF*
-struct VS_IN {
- float4 position : POSITION;
-};
-
-struct VS_OUT {
- float4 position : POSITION;
-};
-// *INDENT-ON*
-
-void main( VS_IN vertex, out VS_OUT result )
-{
- result.position = vertex.position;
- result.position.z = -1.0;
-}
\ No newline at end of file
diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt
index e533ce79..26f912d1 100644
--- a/neo/CMakeLists.txt
+++ b/neo/CMakeLists.txt
@@ -468,6 +468,16 @@ file(GLOB RENDERER_VULKAN_INCLUDES renderer/Vulkan/*.h)
file(GLOB RENDERER_VULKAN_SOURCES renderer/Vulkan/*.cpp)
file(GLOB SHADERS ../base/renderprogs/*.hlsl ../base/renderprogs/*.inc )
+file(GLOB SHADERS_BUILTIN ../base/renderprogs/builtin/*.hlsl )
+file(GLOB SHADERS_BUILTIN_DEBUG ../base/renderprogs/builtin/debug/*.hlsl )
+file(GLOB SHADERS_BUILTIN_FOG ../base/renderprogs/builtin/fog/*.hlsl )
+file(GLOB SHADERS_BUILTIN_LEGACY ../base/renderprogs/builtin/legacy/*.hlsl )
+file(GLOB SHADERS_BUILTIN_LIGHTING ../base/renderprogs/builtin/lighting/*.hlsl )
+file(GLOB SHADERS_BUILTIN_POST ../base/renderprogs/builtin/post/*.hlsl )
+file(GLOB SHADERS_BUILTIN_SSAO ../base/renderprogs/builtin/SSAO/*.hlsl )
+file(GLOB SHADERS_BUILTIN_SSGI ../base/renderprogs/builtin/SSGI/*.hlsl )
+file(GLOB SHADERS_BUILTIN_VIDEO ../base/renderprogs/builtin/video/*.hlsl )
+file(GLOB SHADERS_BUILTIN_VR ../base/renderprogs/builtin/VR/*.hlsl )
file(GLOB IRRXML_INCLUDES libs/irrxml/src/*.h)
file(GLOB IRRXML_SOURCES libs/irrxml/src/*.cpp)
@@ -1080,6 +1090,16 @@ source_group("renderer\\Vulkan" FILES ${RENDERER_VULKAN_SOURCES})
source_group("renderer\\SMAA" FILES ${RENDERER_SMAA_INCLUDES})
source_group("renderer\\Shaders" FILES ${SHADERS})
+source_group("renderer\\Shaders\\builtin" FILES ${SHADERS_BUILTIN})
+source_group("renderer\\Shaders\\builtin\\debug" FILES ${SHADERS_BUILTIN_DEBUG})
+source_group("renderer\\Shaders\\builtin\\fog" FILES ${SHADERS_BUILTIN_FOG})
+source_group("renderer\\Shaders\\builtin\\legacy" FILES ${SHADERS_BUILTIN_LEGACY})
+source_group("renderer\\Shaders\\builtin\\lighting" FILES ${SHADERS_BUILTIN_LIGHTING})
+source_group("renderer\\Shaders\\builtin\\post" FILES ${SHADERS_BUILTIN_POST})
+source_group("renderer\\Shaders\\builtin\\SSAO" FILES ${SHADERS_BUILTIN_SSAO})
+source_group("renderer\\Shaders\\builtin\\SSGI" FILES ${SHADERS_BUILTIN_SSGI})
+source_group("renderer\\Shaders\\builtin\\video" FILES ${SHADERS_BUILTIN_VIDEO})
+source_group("renderer\\Shaders\\builtin\\VR" FILES ${SHADERS_BUILTIN_VR})
source_group("libs\\irrxml" FILES ${IRRXML_INCLUDES})
source_group("libs\\irrxml" FILES ${IRRXML_SOURCES})
@@ -1261,6 +1281,17 @@ set(RBDOOM3_INCLUDES
${RENDERER_JOBS_STATICSHADOWVOLUME_INCLUDES}
${SHADERS}
+ ${SHADERS_BUILTIN}
+ ${SHADERS_BUILTIN_DEBUG}
+ ${SHADERS_BUILTIN_FOG}
+ ${SHADERS_BUILTIN_LEGACY}
+ ${SHADERS_BUILTIN_LIGHTING}
+ ${SHADERS_BUILTIN_POST}
+ ${SHADERS_BUILTIN_SSAO}
+ ${SHADERS_BUILTIN_SSGI}
+ ${SHADERS_BUILTIN_VIDEO}
+ ${SHADERS_BUILTIN_VR}
+
${RENDERER_SMAA_INCLUDES}
${IRRXML_INCLUDES}
${FRAMEWORK_IMGUI_INCLUDES}
@@ -1535,6 +1566,16 @@ if(MSVC)
endif()
set_source_files_properties( ${SHADERS} PROPERTIES VS_TOOL_OVERRIDE "None" )
+ set_source_files_properties( ${SHADERS_BUILTIN} PROPERTIES VS_TOOL_OVERRIDE "None" )
+ set_source_files_properties( ${SHADERS_BUILTIN_DEBUG} PROPERTIES VS_TOOL_OVERRIDE "None" )
+ set_source_files_properties( ${SHADERS_BUILTIN_FOG} PROPERTIES VS_TOOL_OVERRIDE "None" )
+ set_source_files_properties( ${SHADERS_BUILTIN_LEGACY} PROPERTIES VS_TOOL_OVERRIDE "None" )
+ set_source_files_properties( ${SHADERS_BUILTIN_LIGHTING} PROPERTIES VS_TOOL_OVERRIDE "None" )
+ set_source_files_properties( ${SHADERS_BUILTIN_POST} PROPERTIES VS_TOOL_OVERRIDE "None" )
+ set_source_files_properties( ${SHADERS_BUILTIN_SSAO} PROPERTIES VS_TOOL_OVERRIDE "None" )
+ set_source_files_properties( ${SHADERS_BUILTIN_SSGI} PROPERTIES VS_TOOL_OVERRIDE "None" )
+ set_source_files_properties( ${SHADERS_BUILTIN_VIDEO} PROPERTIES VS_TOOL_OVERRIDE "None" )
+ set_source_files_properties( ${SHADERS_BUILTIN_VR} PROPERTIES VS_TOOL_OVERRIDE "None" )
list(APPEND RBDOOM3_SOURCES ${WIN32_RESOURCES})
diff --git a/neo/astyle-code.bat b/neo/astyle-code.bat
index d4f5218a..4ed11ba9 100644
--- a/neo/astyle-code.bat
+++ b/neo/astyle-code.bat
@@ -4,6 +4,6 @@ astyle.exe -v --formatted --options=astyle-options.ini --exclude="libs" --exclud
astyle.exe -v --formatted --options=astyle-options.ini --recursive libs/imgui/*.h
astyle.exe -v --formatted --options=astyle-options.ini --recursive libs/imgui/*.cpp
-astyle.exe -v -Q --options=astyle-options.ini ../base/renderprogs/*.hlsl
+astyle.exe -v -Q --options=astyle-options.ini --recursive ../base/renderprogs/*.hlsl
pause
\ No newline at end of file
diff --git a/neo/d3xp/Game_local.cpp b/neo/d3xp/Game_local.cpp
index 31c5a534..d9a1c00c 100644
--- a/neo/d3xp/Game_local.cpp
+++ b/neo/d3xp/Game_local.cpp
@@ -1257,6 +1257,71 @@ void idGameLocal::MapPopulate()
SetScriptFPS( com_engineHz_latched );
}
+/*
+===================
+RB idGameLocal::PopulateEnvironmentProbes
+===================
+*/
+void idGameLocal::PopulateEnvironmentProbes()
+{
+ idEntity* ent;
+
+ // check if there are already environment probes defined by the artist
+ int numEnvprobes = 0;
+
+ for( ent = spawnedEntities.Next(); ent != NULL; ent = ent->spawnNode.Next() )
+ {
+ if( !ent->IsType( EnvironmentProbe::Type ) )
+ {
+ continue;
+ }
+
+ numEnvprobes++;
+ }
+
+ if( numEnvprobes > 0 )
+ {
+ return;
+ }
+
+ const idDict* envProbeDef = gameLocal.FindEntityDefDict( "env_probe", false );
+ if( !envProbeDef )
+ {
+ return;
+ }
+
+ // naive approach: place an env probe into the center of each BSP area
+
+ int numAreas = gameRenderWorld->NumAreas();
+
+ for( int i = 0 ; i < numAreas ; i++ )
+ {
+ idBounds areaBounds = gameRenderWorld->AreaBounds( i );
+
+ idVec3 point = areaBounds.GetCenter();
+
+ int areaNum = gameRenderWorld->PointInArea( point );
+ if( areaNum < 0 )
+ {
+ Warning( "PopulateEnvironmentProbes: location '%i' is not in a valid area\n", i );
+ continue;
+ }
+
+ idDict args;
+ args.Set( "classname", "env_probe" );
+ args.Set( "origin", point.ToString() );
+
+ gameLocal.SpawnEntityDef( args, &ent );
+ if( !ent )
+ {
+ gameLocal.Error( "Couldn't spawn 'env_probe'" );
+ }
+
+ //environmentProbes.Append( probe );
+ }
+}
+// RB end
+
/*
===================
idGameLocal::InitFromNewMap
@@ -1294,6 +1359,9 @@ void idGameLocal::InitFromNewMap( const char* mapName, idRenderWorld* renderWorl
MapPopulate();
+ // RB
+ PopulateEnvironmentProbes();
+
mpGame.Reset();
mpGame.Precache();
@@ -1564,7 +1632,6 @@ bool idGameLocal::InitFromSaveGame( const char* mapName, idRenderWorld* renderWo
savegame.RestoreObjects();
mpGame.Reset();
-
mpGame.Precache();
// free up any unused animations
@@ -3990,7 +4057,6 @@ void idGameLocal::SpawnMapEntities()
{
common->UpdateLevelLoadPacifier();
-
mapEnt = mapFile->GetEntity( i );
args = mapEnt->epairs;
diff --git a/neo/d3xp/Game_local.h b/neo/d3xp/Game_local.h
index 59c81f6f..4cd346f3 100644
--- a/neo/d3xp/Game_local.h
+++ b/neo/d3xp/Game_local.h
@@ -68,6 +68,7 @@ class idThread;
class idEditEntities;
class idLocationEntity;
class idMenuHandler_Shell;
+class EnvironmentProbe; // RB
const int MAX_CLIENTS = MAX_PLAYERS;
const int MAX_CLIENTS_IN_PVS = MAX_CLIENTS >> 3;
@@ -638,6 +639,8 @@ private:
idLocationEntity** locationEntities; // for location names, etc
+ idList environmentProbes; // RB
+
idCamera* camera;
const idMaterial* globalMaterial; // for overriding everything
@@ -704,6 +707,9 @@ private:
void MapPopulate();
void MapClear( bool clearClients );
+ // RB: spawn environment probes if there aren't any by default
+ void PopulateEnvironmentProbes();
+
pvsHandle_t GetClientPVS( idPlayer* player, pvsType_t type );
void SetupPlayerPVS();
void FreePlayerPVS();
diff --git a/neo/d3xp/menus/MenuScreen.h b/neo/d3xp/menus/MenuScreen.h
index 228ab71b..4a89f3ea 100644
--- a/neo/d3xp/menus/MenuScreen.h
+++ b/neo/d3xp/menus/MenuScreen.h
@@ -1362,10 +1362,9 @@ public:
SYSTEM_FIELD_FRAMERATE,
SYSTEM_FIELD_VSYNC,
SYSTEM_FIELD_ANTIALIASING,
- SYSTEM_FIELD_MOTIONBLUR,
// RB begin
+ SYSTEM_FIELD_POSTFX,
SYSTEM_FIELD_SHADOWMAPPING,
- //SYSTEM_FIELD_LODBIAS,
// RB end
SYSTEM_FIELD_BRIGHTNESS,
SYSTEM_FIELD_VOLUME,
@@ -1394,7 +1393,7 @@ public:
private:
int originalFramerate;
int originalAntialias;
- int originalMotionBlur;
+ int originalPostProcessing;
int originalVsync;
float originalBrightness;
float originalVolume;
diff --git a/neo/d3xp/menus/MenuScreen_Shell_SystemOptions.cpp b/neo/d3xp/menus/MenuScreen_Shell_SystemOptions.cpp
index 869b25e6..8ed0a2ef 100644
--- a/neo/d3xp/menus/MenuScreen_Shell_SystemOptions.cpp
+++ b/neo/d3xp/menus/MenuScreen_Shell_SystemOptions.cpp
@@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms
const static int NUM_SYSTEM_OPTIONS_OPTIONS = 8;
extern idCVar r_antiAliasing;
-extern idCVar r_motionBlur;
+extern idCVar r_useFilmicPostProcessing;
extern idCVar r_swapInterval;
extern idCVar s_volume_dB;
extern idCVar r_exposure; // RB: use this to control HDR exposure or brightness in LDR mode
@@ -106,10 +106,10 @@ void idMenuScreen_Shell_SystemOptions::Initialize( idMenuHandler* data )
control = new( TAG_SWF ) idMenuWidget_ControlButton();
control->SetOptionType( OPTION_SLIDER_TEXT );
- control->SetLabel( "#str_swf_motionblur" );
- control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_MOTIONBLUR );
+ control->SetLabel( "Filmic VFX" );
+ control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_POSTFX );
control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
- control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_MOTIONBLUR );
+ control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_POSTFX );
options->AddChild( control );
// RB begin
@@ -392,7 +392,7 @@ void idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::LoadData
{
originalFramerate = com_engineHz.GetInteger();
originalAntialias = r_antiAliasing.GetInteger();
- originalMotionBlur = r_motionBlur.GetInteger();
+ originalPostProcessing = r_useFilmicPostProcessing.GetInteger();
originalVsync = r_swapInterval.GetInteger();
originalBrightness = r_exposure.GetFloat();
originalVolume = s_volume_dB.GetFloat();
@@ -522,11 +522,12 @@ void idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::AdjustFi
r_antiAliasing.SetInteger( AdjustOption( r_antiAliasing.GetInteger(), values, numValues, adjustAmount ) );
break;
}
- case SYSTEM_FIELD_MOTIONBLUR:
+ case SYSTEM_FIELD_POSTFX:
{
- static const int numValues = 5;
- static const int values[numValues] = { 0, 2, 3, 4, 5 };
- r_motionBlur.SetInteger( AdjustOption( r_motionBlur.GetInteger(), values, numValues, adjustAmount ) );
+ static const int numValues = 2;
+ static const int values[numValues] = { 0, 1 };
+ //static const int values[numValues] = { 0, 2, 3, 4, 5 };
+ r_useFilmicPostProcessing.SetInteger( AdjustOption( r_useFilmicPostProcessing.GetInteger(), values, numValues, adjustAmount ) );
break;
}
// RB begin
@@ -634,12 +635,16 @@ idSWFScriptVar idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings
return values[ r_antiAliasing.GetInteger() ];
}
- case SYSTEM_FIELD_MOTIONBLUR:
- if( r_motionBlur.GetInteger() == 0 )
+ case SYSTEM_FIELD_POSTFX:
+ if( r_useFilmicPostProcessing.GetInteger() > 0 )
+ {
+ return "#str_swf_enabled";
+ }
+ else
{
return "#str_swf_disabled";
}
- return va( "%dx", idMath::IPow( 2, r_motionBlur.GetInteger() ) );
+ //return va( "%dx", idMath::IPow( 2, r_motionBlur.GetInteger() ) );
// RB begin
case SYSTEM_FIELD_SHADOWMAPPING:
if( r_useShadowMapping.GetInteger() == 1 )
@@ -678,7 +683,7 @@ bool idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::IsDataCh
{
return true;
}
- if( originalMotionBlur != r_motionBlur.GetInteger() )
+ if( originalPostProcessing != r_useFilmicPostProcessing.GetInteger() )
{
return true;
}
diff --git a/neo/idlib/math/Vector.cpp b/neo/idlib/math/Vector.cpp
index 9d19d4ca..3f0b03f5 100644
--- a/neo/idlib/math/Vector.cpp
+++ b/neo/idlib/math/Vector.cpp
@@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
+Copyright (C) 2020 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@@ -352,6 +353,52 @@ void idVec3::ProjectSelfOntoSphere( const float radius )
}
+// RB: more about this
+// Cigolle, Donow, Evangelakos, Mara, McGuire, Meyer,
+// A Survey of Efficient Representations for Independent Unit Vectors, Journal of Computer Graphics Techniques (JCGT), vol. 3, no. 2, 1-30, 2014
+// Available online http://jcgt.org/published/0003/02/01/
+
+inline float signNotZero( float k )
+{
+ return ( k >= 0.0f ) ? 1.0f : -1.0f;
+}
+
+idVec2 idVec3::ToOctahedral() const
+{
+ const float L1norm = idMath::Fabs( x ) + idMath::Fabs( x ) + idMath::Fabs( x );
+
+ idVec2 result;
+ if( z < 0.0f )
+ {
+ result.x = ( 1.0f - idMath::Fabs( y ) ) * signNotZero( x );
+ result.y = ( 1.0f - idMath::Fabs( x ) ) * signNotZero( y );
+ }
+ else
+ {
+ result.x = x * ( 1.0f / L1norm );
+ result.y = y * ( 1.0f / L1norm );
+ }
+
+ return result;
+}
+
+void idVec3::FromOctahedral( const idVec2& o )
+{
+ x = o.x;
+ y = o.y;
+ z = 1.0f - ( idMath::Fabs( o.x ) + idMath::Fabs( o.y ) );
+
+ if( z < 0.0f )
+ {
+ float oldX = x;
+ x = ( 1.0f - idMath::Fabs( y ) ) * signNotZero( oldX );
+ y = ( 1.0f - idMath::Fabs( oldX ) ) * signNotZero( y );
+ }
+
+ Normalize();
+}
+// RB end
+
//===============================================================
//
diff --git a/neo/idlib/math/Vector.h b/neo/idlib/math/Vector.h
index 8e89051e..362b35c1 100644
--- a/neo/idlib/math/Vector.h
+++ b/neo/idlib/math/Vector.h
@@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
+Copyright (C) 2020 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@@ -430,6 +431,13 @@ public:
float* ToFloatPtr();
const char* ToString( int precision = 2 ) const;
+ // RB: assumes to be normalized, result is an octrahedral vector on the [-1, +1] square
+ idVec2 ToOctahedral() const;
+
+ // builds a 3D unit vector from an an octrahedral vector on the [-1, +1] square
+ void FromOctahedral( const idVec2& v );
+ // RB end
+
void NormalVectors( idVec3& left, idVec3& down ) const; // vector should be normalized
void OrthogonalBasis( idVec3& left, idVec3& up ) const;
diff --git a/neo/renderer/Image_intrinsic.cpp b/neo/renderer/Image_intrinsic.cpp
index 8de03c4d..aca556e9 100644
--- a/neo/renderer/Image_intrinsic.cpp
+++ b/neo/renderer/Image_intrinsic.cpp
@@ -1041,8 +1041,8 @@ void idImageManager::CreateIntrinsicImages()
hellLoadingIconImage = ImageFromFile( "textures/loadingicon3", TF_DEFAULT, TR_CLAMP, TD_DEFAULT, CF_2D );
// RB begin
- defaultUACIrradianceCube = ImageFromFile( "env/testmap_1_amb", TF_DEFAULT, TR_CLAMP, TD_HIGHQUALITY_CUBE, CF_NATIVE );
- defaultUACRadianceCube = ImageFromFile( "env/testmap_1_spec", TF_DEFAULT, TR_CLAMP, TD_HIGHQUALITY_CUBE, CF_NATIVE );
+ defaultUACIrradianceCube = ImageFromFile( "env/UAC2_amb", TF_DEFAULT, TR_CLAMP, TD_LOOKUP_TABLE_RGB1, CF_2D );
+ defaultUACRadianceCube = ImageFromFile( "env/UAC2_spec", TF_DEFAULT, TR_CLAMP, TD_LOOKUP_TABLE_RGB1, CF_2D );
// RB end
release_assert( loadingIconImage->referencedOutsideLevelLoad );
diff --git a/neo/renderer/OpenGL/RenderDebug_GL.cpp b/neo/renderer/OpenGL/RenderDebug_GL.cpp
index 1ce1d701..3ea18f27 100644
--- a/neo/renderer/OpenGL/RenderDebug_GL.cpp
+++ b/neo/renderer/OpenGL/RenderDebug_GL.cpp
@@ -1714,7 +1714,7 @@ void idRenderBackend::DBG_ShowViewEnvprobes()
GL_State( GLS_DEFAULT | GLS_CULL_TWOSIDED );
- renderProgManager.BindShader_Environment();
+ renderProgManager.BindShader_Octahedron();
int count = 0;
for( viewEnvprobe_t* vProbe = viewDef->viewEnvprobes; vProbe != NULL; vProbe = vProbe->next )
diff --git a/neo/renderer/RenderBackend.cpp b/neo/renderer/RenderBackend.cpp
index 8c3b68f1..aca76fb8 100644
--- a/neo/renderer/RenderBackend.cpp
+++ b/neo/renderer/RenderBackend.cpp
@@ -6003,7 +6003,7 @@ void idRenderBackend::PostProcess( const void* data )
{
// only do the post process step if resolution scaling is enabled. Prevents the unnecessary copying of the framebuffer and
// corresponding full screen quad pass.
- if( rs_enable.GetInteger() == 0 && !r_useFilmicPostProcessEffects.GetBool() && r_antiAliasing.GetInteger() == 0 )
+ if( rs_enable.GetInteger() == 0 && !r_useFilmicPostProcessing.GetBool() && r_antiAliasing.GetInteger() == 0 )
{
return;
}
@@ -6113,7 +6113,7 @@ void idRenderBackend::PostProcess( const void* data )
#endif
}
- if( r_useFilmicPostProcessEffects.GetBool() )
+ if( r_useFilmicPostProcessing.GetBool() )
{
globalImages->currentRenderImage->CopyFramebuffer( viewport.x1, viewport.y1, viewport.GetWidth(), viewport.GetHeight() );
diff --git a/neo/renderer/RenderCommon.h b/neo/renderer/RenderCommon.h
index 3e12952b..47a76d35 100644
--- a/neo/renderer/RenderCommon.h
+++ b/neo/renderer/RenderCommon.h
@@ -1133,7 +1133,7 @@ extern idCVar r_hdrDebug;
extern idCVar r_ldrContrastThreshold;
extern idCVar r_ldrContrastOffset;
-extern idCVar r_useFilmicPostProcessEffects;
+extern idCVar r_useFilmicPostProcessing;
extern idCVar r_forceAmbient;
extern idCVar r_useSSGI;
diff --git a/neo/renderer/RenderProgs.cpp b/neo/renderer/RenderProgs.cpp
index b5e3619a..d3aadac4 100644
--- a/neo/renderer/RenderProgs.cpp
+++ b/neo/renderer/RenderProgs.cpp
@@ -102,109 +102,112 @@ void idRenderProgManager::Init()
vertexLayoutType_t layout;
} builtins[] =
{
- { BUILTIN_GUI, "gui", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_COLOR, "color", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_GUI, "builtin/gui", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_COLOR, "builtin/color", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
// RB begin
- { BUILTIN_COLOR_SKINNED, "color", "_skinned", BIT( USE_GPU_SKINNING ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_VERTEX_COLOR, "vertex_color", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_AMBIENT_LIGHTING, "ambient_lighting", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_AMBIENT_LIGHTING_SKINNED, "ambient_lighting", "_skinned", BIT( USE_GPU_SKINNING ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_AMBIENT_LIGHTING_IBL, "ambient_lighting_IBL", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_AMBIENT_LIGHTING_IBL_SKINNED, "ambient_lighting_IBL", "_skinned", BIT( USE_GPU_SKINNING ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_AMBIENT_LIGHTING_IBL_PBR, "ambient_lighting_IBL", "_PBR", BIT( USE_PBR ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_AMBIENT_LIGHTING_IBL_PBR_SKINNED, "ambient_lighting_IBL", "_PBR_skinned", BIT( USE_GPU_SKINNING | USE_PBR ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_SMALL_GEOMETRY_BUFFER, "gbuffer", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_SMALL_GEOMETRY_BUFFER_SKINNED, "gbuffer", "_skinned", BIT( USE_GPU_SKINNING ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_COLOR_SKINNED, "builtin/color", "_skinned", BIT( USE_GPU_SKINNING ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_VERTEX_COLOR, "builtin/vertex_color", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_AMBIENT_LIGHTING, "builtin/lighting/ambient_lighting", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_AMBIENT_LIGHTING_SKINNED, "builtin/lighting/ambient_lighting", "_skinned", BIT( USE_GPU_SKINNING ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_AMBIENT_LIGHTING_IBL, "builtin/lighting/ambient_lighting_IBL", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_AMBIENT_LIGHTING_IBL_SKINNED, "builtin/lighting/ambient_lighting_IBL", "_skinned", BIT( USE_GPU_SKINNING ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_AMBIENT_LIGHTING_IBL_PBR, "builtin/lighting/ambient_lighting_IBL", "_PBR", BIT( USE_PBR ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_AMBIENT_LIGHTING_IBL_PBR_SKINNED, "builtin/lighting/ambient_lighting_IBL", "_PBR_skinned", BIT( USE_GPU_SKINNING | USE_PBR ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_SMALL_GEOMETRY_BUFFER, "builtin/gbuffer", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_SMALL_GEOMETRY_BUFFER_SKINNED, "builtin/gbuffer", "_skinned", BIT( USE_GPU_SKINNING ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
// RB end
- { BUILTIN_TEXTURED, "texture", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_TEXTURE_VERTEXCOLOR, "texture_color", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_TEXTURE_VERTEXCOLOR_SRGB, "texture_color", "_sRGB", BIT( USE_SRGB ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_TEXTURE_VERTEXCOLOR_SKINNED, "texture_color_skinned", "", 0, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_TEXTURE_TEXGEN_VERTEXCOLOR, "texture_color_texgen", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_TEXTURED, "builtin/texture", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_TEXTURE_VERTEXCOLOR, "builtin/texture_color", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_TEXTURE_VERTEXCOLOR_SRGB, "builtin/texture_color", "_sRGB", BIT( USE_SRGB ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_TEXTURE_VERTEXCOLOR_SKINNED, "builtin/texture_color_skinned", "", 0, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_TEXTURE_TEXGEN_VERTEXCOLOR, "builtin/texture_color_texgen", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
// RB begin
- { BUILTIN_INTERACTION, "interaction", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_INTERACTION_SKINNED, "interaction", "_skinned", BIT( USE_GPU_SKINNING ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_INTERACTION, "builtin/lighting/interaction", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_INTERACTION_SKINNED, "builtin/lighting/interaction", "_skinned", BIT( USE_GPU_SKINNING ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_INTERACTION_AMBIENT, "interactionAmbient", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_INTERACTION_AMBIENT_SKINNED, "interactionAmbient_skinned", "", 0, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_INTERACTION_AMBIENT, "builtin/lighting/interactionAmbient", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_INTERACTION_AMBIENT_SKINNED, "builtin/lighting/interactionAmbient_skinned", "", 0, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_INTERACTION_SHADOW_MAPPING_SPOT, "interactionSM", "_spot", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_INTERACTION_SHADOW_MAPPING_SPOT_SKINNED, "interactionSM", "_spot_skinned", BIT( USE_GPU_SKINNING ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_INTERACTION_SHADOW_MAPPING_SPOT, "builtin/lighting/interactionSM", "_spot", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_INTERACTION_SHADOW_MAPPING_SPOT_SKINNED, "builtin/lighting/interactionSM", "_spot_skinned", BIT( USE_GPU_SKINNING ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_INTERACTION_SHADOW_MAPPING_POINT, "interactionSM", "_point", BIT( LIGHT_POINT ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_INTERACTION_SHADOW_MAPPING_POINT_SKINNED, "interactionSM", "_point_skinned", BIT( USE_GPU_SKINNING ) | BIT( LIGHT_POINT ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_INTERACTION_SHADOW_MAPPING_POINT, "builtin/lighting/interactionSM", "_point", BIT( LIGHT_POINT ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_INTERACTION_SHADOW_MAPPING_POINT_SKINNED, "builtin/lighting/interactionSM", "_point_skinned", BIT( USE_GPU_SKINNING ) | BIT( LIGHT_POINT ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_INTERACTION_SHADOW_MAPPING_PARALLEL, "interactionSM", "_parallel", BIT( LIGHT_PARALLEL ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED, "interactionSM", "_parallel_skinned", BIT( USE_GPU_SKINNING ) | BIT( LIGHT_PARALLEL ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_INTERACTION_SHADOW_MAPPING_PARALLEL, "builtin/lighting/interactionSM", "_parallel", BIT( LIGHT_PARALLEL ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED, "builtin/lighting/interactionSM", "_parallel_skinned", BIT( USE_GPU_SKINNING ) | BIT( LIGHT_PARALLEL ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
// PBR variants
- { BUILTIN_PBR_INTERACTION, "interaction", "_PBR", BIT( USE_PBR ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_PBR_INTERACTION_SKINNED, "interaction", "_skinned_PBR", BIT( USE_GPU_SKINNING ) | BIT( USE_PBR ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_PBR_INTERACTION, "builtin/lighting/interaction", "_PBR", BIT( USE_PBR ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_PBR_INTERACTION_SKINNED, "builtin/lighting/interaction", "_skinned_PBR", BIT( USE_GPU_SKINNING ) | BIT( USE_PBR ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_PBR_INTERACTION_AMBIENT, "interactionAmbient", "_PBR", BIT( USE_PBR ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_PBR_INTERACTION_AMBIENT_SKINNED, "interactionAmbient_skinned", "_PBR", BIT( USE_PBR ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_PBR_INTERACTION_AMBIENT, "builtin/lighting/interactionAmbient", "_PBR", BIT( USE_PBR ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_PBR_INTERACTION_AMBIENT_SKINNED, "builtin/lighting/interactionAmbient_skinned", "_PBR", BIT( USE_PBR ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_SPOT, "interactionSM", "_spot_PBR", BIT( USE_PBR ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_SPOT_SKINNED, "interactionSM", "_spot_skinned_PBR", BIT( USE_GPU_SKINNING ) | BIT( USE_PBR ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_SPOT, "builtin/lighting/interactionSM", "_spot_PBR", BIT( USE_PBR ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_SPOT_SKINNED, "builtin/lighting/interactionSM", "_spot_skinned_PBR", BIT( USE_GPU_SKINNING ) | BIT( USE_PBR ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_POINT, "interactionSM", "_point_PBR", BIT( LIGHT_POINT ) | BIT( USE_PBR ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_POINT_SKINNED, "interactionSM", "_point_skinned_PBR", BIT( USE_GPU_SKINNING ) | BIT( LIGHT_POINT ) | BIT( USE_PBR ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_POINT, "builtin/lighting/interactionSM", "_point_PBR", BIT( LIGHT_POINT ) | BIT( USE_PBR ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_POINT_SKINNED, "builtin/lighting/interactionSM", "_point_skinned_PBR", BIT( USE_GPU_SKINNING ) | BIT( LIGHT_POINT ) | BIT( USE_PBR ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL, "interactionSM", "_parallel_PBR", BIT( LIGHT_PARALLEL ) | BIT( USE_PBR ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED, "interactionSM", "_parallel_skinned_PBR", BIT( USE_GPU_SKINNING ) | BIT( LIGHT_PARALLEL ) | BIT( USE_PBR ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL, "builtin/lighting/interactionSM", "_parallel_PBR", BIT( LIGHT_PARALLEL ) | BIT( USE_PBR ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED, "builtin/lighting/interactionSM", "_parallel_skinned_PBR", BIT( USE_GPU_SKINNING ) | BIT( LIGHT_PARALLEL ) | BIT( USE_PBR ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+
+ { BUILTIN_OCTAHEDRON, "builtin/debug/octahedron", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_OCTAHEDRON_SKINNED, "builtin/debug/octahedron", "_skinned", BIT( USE_GPU_SKINNING ), true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
// RB end
- { BUILTIN_ENVIRONMENT, "environment", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_ENVIRONMENT_SKINNED, "environment_skinned", "", 0, true , SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT},
- { BUILTIN_BUMPY_ENVIRONMENT, "bumpyenvironment", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_BUMPY_ENVIRONMENT_SKINNED, "bumpyenvironment_skinned", "", 0, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_ENVIRONMENT, "builtin/legacy/environment", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_ENVIRONMENT_SKINNED, "builtin/legacy/environment_skinned", "", 0, true , SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT},
+ { BUILTIN_BUMPY_ENVIRONMENT, "builtin/legacy/bumpyenvironment", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_BUMPY_ENVIRONMENT_SKINNED, "builtin/legacy/bumpyenvironment_skinned", "", 0, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_DEPTH, "depth", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_DEPTH_SKINNED, "depth_skinned", "", 0, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_DEPTH, "builtin/depth", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_DEPTH_SKINNED, "builtin/depth_skinned", "", 0, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_SHADOW, "shadow", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_SHADOW_VERT },
- { BUILTIN_SHADOW_SKINNED, "shadow_skinned", "", 0, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_SHADOW_VERT_SKINNED },
+ { BUILTIN_SHADOW, "builtin/lighting/shadow", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_SHADOW_VERT },
+ { BUILTIN_SHADOW_SKINNED, "builtin/lighting/shadow_skinned", "", 0, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_SHADOW_VERT_SKINNED },
- { BUILTIN_SHADOW_DEBUG, "shadowDebug", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_SHADOW_DEBUG_SKINNED, "shadowDebug_skinned", "", 0, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_SHADOW_DEBUG, "builtin/debug/shadowDebug", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_SHADOW_DEBUG_SKINNED, "builtin/debug/shadowDebug_skinned", "", 0, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_BLENDLIGHT, "blendlight", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_FOG, "fog", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_FOG_SKINNED, "fog_skinned", "", 0, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_SKYBOX, "skybox", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_WOBBLESKY, "wobblesky", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_POSTPROCESS, "postprocess", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_BLENDLIGHT, "builtin/fog/blendlight", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_FOG, "builtin/fog/fog", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_FOG_SKINNED, "builtin/fog/fog_skinned", "", 0, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_SKYBOX, "builtin/legacy/skybox", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_WOBBLESKY, "builtin/legacy/wobblesky", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_POSTPROCESS, "builtin/post/postprocess", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
// RB begin
- { BUILTIN_SCREEN, "screen", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_TONEMAP, "tonemap", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_BRIGHTPASS, "tonemap", "_brightpass", BIT( BRIGHTPASS ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_HDR_GLARE_CHROMATIC, "hdr_glare_chromatic", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_HDR_DEBUG, "tonemap", "_debug", BIT( HDR_DEBUG ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_SCREEN, "builtin/post/screen", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_TONEMAP, "builtin/post/tonemap", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_BRIGHTPASS, "builtin/post/tonemap", "_brightpass", BIT( BRIGHTPASS ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_HDR_GLARE_CHROMATIC, "builtin/post/hdr_glare_chromatic", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_HDR_DEBUG, "builtin/post/tonemap", "_debug", BIT( HDR_DEBUG ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_SMAA_EDGE_DETECTION, "SMAA_edge_detection", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_SMAA_BLENDING_WEIGHT_CALCULATION, "SMAA_blending_weight_calc", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_SMAA_NEIGHBORHOOD_BLENDING, "SMAA_final", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_SMAA_EDGE_DETECTION, "builtin/post/SMAA_edge_detection", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_SMAA_BLENDING_WEIGHT_CALCULATION, "builtin/post/SMAA_blending_weight_calc", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_SMAA_NEIGHBORHOOD_BLENDING, "builtin/post/SMAA_final", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_AMBIENT_OCCLUSION, "AmbientOcclusion_AO", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_AMBIENT_OCCLUSION_AND_OUTPUT, "AmbientOcclusion_AO", "_write", BIT( BRIGHTPASS ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_AMBIENT_OCCLUSION_BLUR, "AmbientOcclusion_blur", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_AMBIENT_OCCLUSION_BLUR_AND_OUTPUT, "AmbientOcclusion_blur", "_write", BIT( BRIGHTPASS ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_AMBIENT_OCCLUSION_MINIFY, "AmbientOcclusion_minify", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_AMBIENT_OCCLUSION_RECONSTRUCT_CSZ, "AmbientOcclusion_minify", "_mip0", BIT( BRIGHTPASS ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_DEEP_GBUFFER_RADIOSITY_SSGI, "DeepGBufferRadiosity_radiosity", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_DEEP_GBUFFER_RADIOSITY_BLUR, "DeepGBufferRadiosity_blur", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_DEEP_GBUFFER_RADIOSITY_BLUR_AND_OUTPUT, "DeepGBufferRadiosity_blur", "_write", BIT( BRIGHTPASS ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_AMBIENT_OCCLUSION, "builtin/SSAO/AmbientOcclusion_AO", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_AMBIENT_OCCLUSION_AND_OUTPUT, "builtin/SSAO/AmbientOcclusion_AO", "_write", BIT( BRIGHTPASS ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_AMBIENT_OCCLUSION_BLUR, "builtin/SSAO/AmbientOcclusion_blur", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_AMBIENT_OCCLUSION_BLUR_AND_OUTPUT, "builtin/SSAO/AmbientOcclusion_blur", "_write", BIT( BRIGHTPASS ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_AMBIENT_OCCLUSION_MINIFY, "builtin/SSAO/AmbientOcclusion_minify", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_AMBIENT_OCCLUSION_RECONSTRUCT_CSZ, "builtin/SSAO/AmbientOcclusion_minify", "_mip0", BIT( BRIGHTPASS ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_DEEP_GBUFFER_RADIOSITY_SSGI, "builtin/SSGI/DeepGBufferRadiosity_radiosity", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_DEEP_GBUFFER_RADIOSITY_BLUR, "builtin/SSGI/DeepGBufferRadiosity_blur", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_DEEP_GBUFFER_RADIOSITY_BLUR_AND_OUTPUT, "builtin/SSGI/DeepGBufferRadiosity_blur", "_write", BIT( BRIGHTPASS ), false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
// RB end
- { BUILTIN_STEREO_DEGHOST, "stereoDeGhost", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_STEREO_WARP, "stereoWarp", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_BINK, "bink", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_BINK_GUI, "bink_gui", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_STEREO_INTERLACE, "stereoInterlace", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
- { BUILTIN_MOTION_BLUR, "motionBlur", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_STEREO_DEGHOST, "builtin/VR/stereoDeGhost", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_STEREO_WARP, "builtin/VR/stereoWarp", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_BINK, "builtin/video/bink", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_BINK_GUI, "builtin/video/bink_gui", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_STEREO_INTERLACE, "builtin/VR/stereoInterlace", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_MOTION_BLUR, "builtin/post/motionBlur", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
// RB begin
- { BUILTIN_DEBUG_SHADOWMAP, "debug_shadowmap", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
+ { BUILTIN_DEBUG_SHADOWMAP, "builtin/debug/debug_shadowmap", "", 0, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT },
// RB end
};
int numBuiltins = sizeof( builtins ) / sizeof( builtins[0] );
@@ -269,6 +272,7 @@ void idRenderProgManager::Init()
renderProgs[builtinShaders[BUILTIN_SHADOW_DEBUG_SKINNED]].usesJoints = true;
renderProgs[builtinShaders[BUILTIN_FOG_SKINNED]].usesJoints = true;
// RB begin
+ renderProgs[builtinShaders[BUILTIN_OCTAHEDRON_SKINNED]].usesJoints = true;
renderProgs[builtinShaders[BUILTIN_AMBIENT_LIGHTING_SKINNED]].usesJoints = true;
renderProgs[builtinShaders[BUILTIN_AMBIENT_LIGHTING_IBL_SKINNED]].usesJoints = true;
renderProgs[builtinShaders[BUILTIN_AMBIENT_LIGHTING_IBL_PBR_SKINNED]].usesJoints = true;
diff --git a/neo/renderer/RenderProgs.h b/neo/renderer/RenderProgs.h
index f027136b..f6bdc335 100644
--- a/neo/renderer/RenderProgs.h
+++ b/neo/renderer/RenderProgs.h
@@ -449,6 +449,16 @@ public:
{
BindShader_Builtin( BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED );
}
+
+ void BindShader_Octahedron()
+ {
+ BindShader_Builtin( BUILTIN_OCTAHEDRON );
+ }
+
+ void BindShader_OctahedronSkinned()
+ {
+ BindShader_Builtin( BUILTIN_OCTAHEDRON_SKINNED );
+ }
// RB end
void BindShader_Environment()
@@ -755,6 +765,9 @@ private:
BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_POINT_SKINNED,
BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL,
BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED,
+
+ BUILTIN_OCTAHEDRON,
+ BUILTIN_OCTAHEDRON_SKINNED,
// RB end
BUILTIN_ENVIRONMENT,
BUILTIN_ENVIRONMENT_SKINNED,
diff --git a/neo/renderer/RenderProgs_embedded.h b/neo/renderer/RenderProgs_embedded.h
index 7be966d0..da7d9ce4 100644
--- a/neo/renderer/RenderProgs_embedded.h
+++ b/neo/renderer/RenderProgs_embedded.h
@@ -2483,8 +2483,8 @@ static const cgShaderDef_t cg_renderprogs[] =
"uniform sampler2D samp3 : register(s3); // texture 3 is the BRDF LUT\n"
"uniform sampler2D samp4 : register(s4); // texture 4 is SSAO\n"
"\n"
- "uniform samplerCUBE samp7 : register(s7); // texture 7 is the irradiance cube map\n"
- "uniform samplerCUBE samp8 : register(s8); // texture 8 is the radiance cube map\n"
+ "uniform sampler2D samp7 : register(s7); // texture 7 is the irradiance cube map\n"
+ "uniform sampler2D samp8 : register(s8); // texture 8 is the radiance cube map\n"
"\n"
"struct PS_IN \n"
"{\n"
@@ -2505,6 +2505,52 @@ static const cgShaderDef_t cg_renderprogs[] =
"};\n"
"// *INDENT-ON*\n"
"\n"
+ "\n"
+ "\n"
+ "/** Efficient GPU implementation of the octahedral unit vector encoding from\n"
+ "\n"
+ " Cigolle, Donow, Evangelakos, Mara, McGuire, Meyer,\n"
+ " A Survey of Efficient Representations for Independent Unit Vectors, Journal of Computer Graphics Techniques (JCGT), vol. 3, no. 2, 1-30, 2014\n"
+ "\n"
+ " Available online http://jcgt.org/published/0003/02/01/\n"
+ "*/\n"
+ "\n"
+ "float signNotZeroFloat( float k )\n"
+ "{\n"
+ " return ( k >= 0.0 ) ? 1.0 : -1.0;\n"
+ "}\n"
+ "\n"
+ "\n"
+ "float2 signNotZero( float2 v )\n"
+ "{\n"
+ " return float2( signNotZeroFloat( v.x ), signNotZeroFloat( v.y ) );\n"
+ "}\n"
+ "\n"
+ "/** Assumes that v is a unit vector. The result is an octahedral vector on the [-1, +1] square. */\n"
+ "float2 octEncode( float3 v )\n"
+ "{\n"
+ " float l1norm = abs( v.x ) + abs( v.y ) + abs( v.z );\n"
+ " float2 oct = v.xy * ( 1.0 / l1norm );\n"
+ " if( v.z < 0.0 )\n"
+ " {\n"
+ " oct = ( 1.0 - abs( oct.yx ) ) * signNotZero( oct.xy );\n"
+ " }\n"
+ " return oct;\n"
+ "}\n"
+ "\n"
+ "\n"
+ "/** Returns a unit vector. Argument o is an octahedral vector packed via octEncode,\n"
+ " on the [-1, +1] square*/\n"
+ "float3 octDecode( float2 o )\n"
+ "{\n"
+ " float3 v = float3( o.x, o.y, 1.0 - abs( o.x ) - abs( o.y ) );\n"
+ " if( v.z < 0.0 )\n"
+ " {\n"
+ " v.xy = ( 1.0 - abs( v.yx ) ) * signNotZero( v.xy );\n"
+ " }\n"
+ " return normalize( v );\n"
+ "}\n"
+ "\n"
"void main( PS_IN fragment, out PS_OUT result )\n"
"{\n"
" half4 bumpMap = tex2D( samp0, fragment.texcoord0.xy );\n"
@@ -2527,11 +2573,12 @@ static const cgShaderDef_t cg_renderprogs[] =
" globalNormal.x = dot3( localNormal, fragment.texcoord4 );\n"
" globalNormal.y = dot3( localNormal, fragment.texcoord5 );\n"
" globalNormal.z = dot3( localNormal, fragment.texcoord6 );\n"
+ " globalNormal = normalize( globalNormal );\n"
"\n"
" float3 globalEye = normalize( fragment.texcoord3.xyz );\n"
"\n"
" float3 reflectionVector = globalNormal * dot3( globalEye, globalNormal );\n"
- " reflectionVector = ( reflectionVector * 2.0f ) - globalEye;\n"
+ " reflectionVector = normalize( ( reflectionVector * 2.0f ) - globalEye );\n"
"\n"
" half vDotN = saturate( dot3( globalEye, globalNormal ) );\n"
"\n"
@@ -2596,7 +2643,10 @@ static const cgShaderDef_t cg_renderprogs[] =
"\n"
" // evaluate diffuse IBL\n"
"\n"
- " float3 irradiance = texCUBE( samp7, globalNormal ).rgb;\n"
+ " float2 normalizedOctCoord = octEncode( globalNormal );\n"
+ " float2 normalizedOctCoordZeroOne = ( normalizedOctCoord + float2( 1.0 ) ) * 0.5;\n"
+ "\n"
+ " float3 irradiance = tex2D( samp7, normalizedOctCoordZeroOne ).rgb;\n"
" float3 diffuseLight = ( kD * irradiance * diffuseColor ) * ao * ( rpDiffuseModifier.xyz * 1.0 );\n"
"\n"
" // evaluate specular IBL\n"
@@ -2605,7 +2655,12 @@ static const cgShaderDef_t cg_renderprogs[] =
" const float MAX_REFLECTION_LOD = 10.0;\n"
" float mip = clamp( ( roughness * MAX_REFLECTION_LOD ), 0.0, MAX_REFLECTION_LOD );\n"
" //float mip = 0.0;\n"
- " float3 radiance = textureLod( samp8, reflectionVector, mip ).rgb;\n"
+ "\n"
+ " normalizedOctCoord = octEncode( reflectionVector );\n"
+ " normalizedOctCoordZeroOne = ( normalizedOctCoord + float2( 1.0 ) ) * 0.5;\n"
+ "\n"
+ " float3 radiance = textureLod( samp8, normalizedOctCoordZeroOne, mip ).rgb;\n"
+ " //radiance = float3( 0.0 );\n"
"\n"
" float2 envBRDF = texture( samp3, float2( max( vDotN, 0.0 ), roughness ) ).rg;\n"
"\n"
diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp
index bcc85783..e0a7731c 100644
--- a/neo/renderer/RenderSystem_init.cpp
+++ b/neo/renderer/RenderSystem_init.cpp
@@ -280,7 +280,7 @@ idCVar r_hdrDebug( "r_hdrDebug", "0", CVAR_RENDERER | CVAR_FLOAT, "show scene lu
idCVar r_ldrContrastThreshold( "r_ldrContrastThreshold", "1.1", CVAR_RENDERER | CVAR_FLOAT, "" );
idCVar r_ldrContrastOffset( "r_ldrContrastOffset", "3", CVAR_RENDERER | CVAR_FLOAT, "" );
-idCVar r_useFilmicPostProcessEffects( "r_useFilmicPostProcessEffects", "1", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "apply several post process effects to mimic a filmic look" );
+idCVar r_useFilmicPostProcessing( "r_useFilmicPostProcessing", "1", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "apply several post process effects to mimic a filmic look" );
#if defined( USE_VULKAN )
idCVar r_forceAmbient( "r_forceAmbient", "0.2", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_FLOAT, "render additional ambient pass to make the game less dark", 0.0f, 0.75f );
@@ -299,7 +299,7 @@ idCVar r_useHierarchicalDepthBuffer( "r_useHierarchicalDepthBuffer", "1", CVAR_R
idCVar r_usePBR( "r_usePBR", "1", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "use PBR and Image Based Lighting instead of old Quake 4 style ambient lighting" );
idCVar r_pbrDebug( "r_pbrDebug", "0", CVAR_RENDERER | CVAR_INTEGER, "show which materials have PBR support (green = PBR, red = oldschool D3)" );
-idCVar r_showViewEnvprobes( "r_showViewEnvprobes", "1", CVAR_RENDERER | CVAR_INTEGER, "1 = displays the bounding boxes of all view environment probes, 2 = show irradiance" );
+idCVar r_showViewEnvprobes( "r_showViewEnvprobes", "0", CVAR_RENDERER | CVAR_INTEGER, "1 = displays the bounding boxes of all view environment probes, 2 = show irradiance" );
idCVar r_exposure( "r_exposure", "0.5", CVAR_ARCHIVE | CVAR_RENDERER | CVAR_FLOAT, "HDR exposure or LDR brightness [0.0 .. 1.0]", 0.0f, 1.0f );
// RB end
diff --git a/neo/renderer/RenderWorld.cpp b/neo/renderer/RenderWorld.cpp
index ecf46857..39094c97 100644
--- a/neo/renderer/RenderWorld.cpp
+++ b/neo/renderer/RenderWorld.cpp
@@ -1241,6 +1241,23 @@ exitPortal_t idRenderWorldLocal::GetPortal( int areaNum, int portalNum )
return ret;
}
+/*
+===================
+RB: idRenderWorldLocal::AreaBounds
+===================
+*/
+idBounds idRenderWorldLocal::AreaBounds( int areaNum ) const
+{
+ if( areaNum < 0 || areaNum > numPortalAreas )
+ {
+ common->Error( "idRenderWorld::GetPortal: areaNum > numAreas" );
+ }
+
+ portalArea_t* area = &portalAreas[areaNum];
+
+ return area->globalBounds;
+}
+
/*
===============
idRenderWorldLocal::PointInAreaNum
diff --git a/neo/renderer/RenderWorld.h b/neo/renderer/RenderWorld.h
index 3949ed63..072e817a 100644
--- a/neo/renderer/RenderWorld.h
+++ b/neo/renderer/RenderWorld.h
@@ -415,6 +415,9 @@ public:
// returns one portal from an area
virtual exitPortal_t GetPortal( int areaNum, int portalNum ) = 0;
+ // RB: returns the AABB of a BSP area
+ virtual idBounds AreaBounds( int areaNum ) const = 0;
+
//-------------- Tracing -----------------
// Checks a ray trace against any gui surfaces in an entity, returning the
diff --git a/neo/renderer/RenderWorld_defs.cpp b/neo/renderer/RenderWorld_defs.cpp
index b7fe2bbb..e85cdbf7 100644
--- a/neo/renderer/RenderWorld_defs.cpp
+++ b/neo/renderer/RenderWorld_defs.cpp
@@ -760,19 +760,19 @@ ENVPROBE DEFS
void R_DeriveEnvprobeData( RenderEnvprobeLocal* probe )
{
- idStr basename = tr.primaryWorld->mapName;
+ idStr basename = probe->world->mapName;
basename.StripFileExtension();
idStr fullname;
- int probeIndex = tr.primaryWorld->envprobeDefs.Num() - 1;
+ int probeIndex = probe->world->envprobeDefs.Num() - 1;
// TODO get preconvolved cubemaps
fullname.Format( "env/%s/envprobe%i_amb", basename.c_str(), probeIndex );
- probe->irradianceImage = globalImages->ImageFromFile( fullname, TF_DEFAULT, TR_CLAMP, TD_HIGHQUALITY_CUBE, CF_NATIVE );
+ probe->irradianceImage = globalImages->ImageFromFile( fullname, TF_DEFAULT, TR_CLAMP, TD_LOOKUP_TABLE_RGB1, CF_2D );
fullname.Format( "env/%s/envprobe%i_spec", basename.c_str(), probeIndex );
- probe->radianceImage = globalImages->ImageFromFile( fullname, TF_DEFAULT, TR_CLAMP, TD_HIGHQUALITY_CUBE, CF_NATIVE );
+ probe->radianceImage = globalImages->ImageFromFile( fullname, TF_DEFAULT, TR_CLAMP, TD_LOOKUP_TABLE_RGB1, CF_2D );
// ------------------------------------
// compute the light projection matrix
diff --git a/neo/renderer/RenderWorld_envprobes.cpp b/neo/renderer/RenderWorld_envprobes.cpp
index 045d02c4..7f9f011f 100644
--- a/neo/renderer/RenderWorld_envprobes.cpp
+++ b/neo/renderer/RenderWorld_envprobes.cpp
@@ -198,6 +198,7 @@ void idRenderWorldLocal::AddAreaViewEnvprobes( int areaNum, const portalStack_t*
continue;
}
+#if 0
// check for being closed off behind a door
// a light that doesn't cast shadows will still light even if it is behind a door
if( r_useLightAreaCulling.GetBool() //&& !envprobe->LightCastsShadows()
@@ -213,6 +214,7 @@ void idRenderWorldLocal::AddAreaViewEnvprobes( int areaNum, const portalStack_t*
// still be visible through others
continue;
}
+#endif
viewEnvprobe_t* vProbe = R_SetEnvprobeDefViewEnvprobe( probe );
@@ -594,6 +596,20 @@ static const unsigned char brfLutTexBytes[] =
Mem_Free( hdrBuffer );
}
+
+// Compute normalized oct coord, mapping top left of top left pixel to (-1,-1)
+idVec2 NormalizedOctCoord( int x, int y, const int probeSideLength )
+{
+ const int margin = 0;
+
+ int probeWithBorderSide = probeSideLength + margin;
+
+ idVec2 octFragCoord = idVec2( ( x - margin ) % probeWithBorderSide, ( y - margin ) % probeWithBorderSide );
+
+ // Add back the half pixel to get pixel center normalized coordinates
+ return ( idVec2( octFragCoord ) + idVec2( 0.5f, 0.5f ) ) * ( 2.0f / float( probeSideLength ) ) - idVec2( 1.0f, 1.0f );
+}
+
/*
==================
R_MakeAmbientMap_f
@@ -640,13 +656,14 @@ void R_MakeAmbientMap( const char* baseName, const char* suffix, int outSize, fl
for( int i = 0 ; i < 6 ; i++ )
{
fullname.Format( "env/%s%s.png", baseName, envDirection[i] );
- common->Printf( "loading %s\n", fullname.c_str() );
+
const bool captureToImage = false;
common->UpdateScreen( captureToImage );
+
R_LoadImage( fullname, &buffers[i], &width, &height, NULL, true, NULL );
if( !buffers[i] )
{
- common->Printf( "failed.\n" );
+ common->Printf( "loading %s failed.\n", fullname.c_str() );
for( i-- ; i >= 0 ; i-- )
{
Mem_Free( buffers[i] );
@@ -662,7 +679,7 @@ void R_MakeAmbientMap( const char* baseName, const char* suffix, int outSize, fl
byte* outBuffer = ( byte* )_alloca( outSize * outSize * 4 );
- //for( int map = 0 ; map < 2 ; map++ )
+#if 0
{
CommandlineProgressBar progressBar( outSize * outSize * 6 );
@@ -719,6 +736,81 @@ void R_MakeAmbientMap( const char* baseName, const char* suffix, int outSize, fl
common->Printf( "env/%s convolved in %5.1f seconds\n\n", baseName, ( end - start ) * 0.001f );
}
+#else
+ {
+
+ // output an octahedron probe
+
+ CommandlineProgressBar progressBar( outSize * outSize );
+
+ int start = Sys_Milliseconds();
+
+ const float invDstSize = 1.0f / float( outSize );
+
+ for( int x = 0 ; x < outSize ; x++ )
+ {
+ for( int y = 0 ; y < outSize ; y++ )
+ {
+ idVec3 dir;
+ float total[3];
+
+ // convert UV coord from [0, 1] to [-1, 1] space
+ const float u = 2.0f * x * invDstSize - 1.0f;
+ const float v = 2.0f * y * invDstSize - 1.0f;
+
+ idVec2 octCoord = NormalizedOctCoord( x, y, outSize );
+
+ // convert UV coord to 3D direction
+ dir.FromOctahedral( octCoord );
+
+ total[0] = total[1] = total[2] = 0;
+
+ //float roughness = map ? 0.1 : 0.95; // small for specular, almost hemisphere for ambient
+
+ for( int s = 0 ; s < samples ; s++ )
+ {
+ idVec2 Xi = Hammersley2D( s, samples );
+ idVec3 test = ImportanceSampleGGX( Xi, dir, roughness );
+
+ byte result[4];
+ //test = dir;
+ R_SampleCubeMap( test, width, buffers, result );
+ total[0] += result[0];
+ total[1] += result[1];
+ total[2] += result[2];
+ }
+
+#if 1
+ outBuffer[( y * outSize + x ) * 4 + 0] = total[0] / samples;
+ outBuffer[( y * outSize + x ) * 4 + 1] = total[1] / samples;
+ outBuffer[( y * outSize + x ) * 4 + 2] = total[2] / samples;
+ outBuffer[( y * outSize + x ) * 4 + 3] = 255;
+#else
+ outBuffer[( y * outSize + x ) * 4 + 0] = byte( ( dir.x * 0.5f + 0.5f ) * 255 );
+ outBuffer[( y * outSize + x ) * 4 + 1] = byte( ( dir.y * 0.5f + 0.5f ) * 255 );
+ outBuffer[( y * outSize + x ) * 4 + 2] = byte( ( dir.z * 0.5f + 0.5f ) * 255 );
+ outBuffer[( y * outSize + x ) * 4 + 3] = 255;
+#endif
+
+ progressBar.Increment();
+ }
+ }
+
+
+ fullname.Format( "env/%s%s.png", baseName, suffix );
+ //common->Printf( "writing %s\n", fullname.c_str() );
+
+ const bool captureToImage = false;
+ common->UpdateScreen( captureToImage );
+
+ //R_WriteTGA( fullname, outBuffer, outSize, outSize, false, "fs_basepath" );
+ R_WritePNG( fullname, outBuffer, 4, outSize, outSize, true, "fs_basepath" );
+
+ int end = Sys_Milliseconds();
+
+ common->Printf( "env/%s convolved in %5.1f seconds\n\n", baseName, ( end - start ) * 0.001f );
+ }
+#endif
for( int i = 0 ; i < 6 ; i++ )
{
@@ -752,7 +844,7 @@ CONSOLE_COMMAND( makeAmbientMap, "Saves out env/_amb_ft.tga, etc", NUL
}
baseName = args.Argv( 1 );
- if( args.Argc() == 3 )
+ if( args.Argc() >= 3 )
{
outSize = atoi( args.Argv( 2 ) );
}
@@ -845,7 +937,7 @@ CONSOLE_COMMAND( generateEnvironmentProbes, "Generate environment probes", NULL
axis[5][2][1] = 1;
//--------------------------------------------
- // CAPTURE SCENE LIGHTING
+ // CAPTURE SCENE LIGHTING TO CUBEMAPS
//--------------------------------------------
// let's get the game window to a "size" resolution
@@ -882,6 +974,7 @@ CONSOLE_COMMAND( generateEnvironmentProbes, "Generate environment probes", NULL
ref.viewaxis = axis[j];
fullname.Format( "env/%s/envprobe%i%s", baseName.c_str(), i, extension );
+ // TODO capture resolved HDR data without bloom aka _currentRender in 16bit float HDR RGB
tr.TakeScreenshot( size, size, fullname, blends, &ref, PNG );
//tr.CaptureRenderToFile( fullname, false );
}
@@ -901,6 +994,9 @@ CONSOLE_COMMAND( generateEnvironmentProbes, "Generate environment probes", NULL
//--------------------------------------------
// CONVOLVE CUBEMAPS
//--------------------------------------------
+
+ int start = Sys_Milliseconds();
+
for( int i = 0; i < tr.primaryWorld->envprobeDefs.Num(); i++ )
{
RenderEnvprobeLocal* def = tr.primaryWorld->envprobeDefs[i];
@@ -914,5 +1010,9 @@ CONSOLE_COMMAND( generateEnvironmentProbes, "Generate environment probes", NULL
R_MakeAmbientMap( fullname.c_str(), "_amb", IRRADIANCE_CUBEMAP_SIZE, 0.95f );
R_MakeAmbientMap( fullname.c_str(), "_spec", RADIANCE_CUBEMAP_SIZE, 0.1f );
}
+
+ int end = Sys_Milliseconds();
+
+ common->Printf( "convolved probes in %5.1f seconds\n\n", ( end - start ) * 0.001f );
}
diff --git a/neo/renderer/RenderWorld_load.cpp b/neo/renderer/RenderWorld_load.cpp
index a645c284..8fd2de60 100644
--- a/neo/renderer/RenderWorld_load.cpp
+++ b/neo/renderer/RenderWorld_load.cpp
@@ -1090,7 +1090,6 @@ void idRenderWorldLocal::AddWorldModelEntities()
{
common->UpdateLevelLoadPacifier();
-
idRenderEntityLocal* def = new( TAG_RENDER_ENTITY ) idRenderEntityLocal;
// try and reuse a free spot
@@ -1142,7 +1141,11 @@ void idRenderWorldLocal::AddWorldModelEntities()
R_DeriveEntityData( def );
- AddEntityRefToArea( def, &portalAreas[i] );
+ portalArea_t* area = &portalAreas[i];
+ AddEntityRefToArea( def, area );
+
+ // RB: remember BSP area AABB for quick lookup later
+ area->globalBounds = def->globalReferenceBounds;
}
}
diff --git a/neo/renderer/RenderWorld_local.h b/neo/renderer/RenderWorld_local.h
index 67ed1f32..7881eb8f 100644
--- a/neo/renderer/RenderWorld_local.h
+++ b/neo/renderer/RenderWorld_local.h
@@ -65,6 +65,9 @@ typedef struct portalArea_s
int areaNum;
int connectedAreaNum[NUM_PORTAL_ATTRIBUTES]; // if two areas have matching connectedAreaNum, they are
// not separated by a portal with the apropriate PS_BLOCK_* blockingBits
+
+ idBounds globalBounds; // RB: AABB of the BSP area used for light grid density
+
int viewCount; // set by R_FindViewLightsAndEntities
portal_t* portals; // never changes after load
areaReference_t entityRefs; // head/tail of doubly linked list, may change
@@ -143,6 +146,7 @@ public:
virtual int BoundsInAreas( const idBounds& bounds, int* areas, int maxAreas ) const;
virtual int NumPortalsInArea( int areaNum );
virtual exitPortal_t GetPortal( int areaNum, int portalNum );
+ virtual idBounds AreaBounds( int areaNum ) const; // RB
virtual guiPoint_t GuiTrace( qhandle_t entityHandle, const idVec3 start, const idVec3 end ) const;
virtual bool ModelTrace( modelTrace_t& trace, qhandle_t entityHandle, const idVec3& start, const idVec3& end, const float radius ) const;
diff --git a/neo/renderer/tr_frontend_main.cpp b/neo/renderer/tr_frontend_main.cpp
index 54e104fa..c3d01322 100644
--- a/neo/renderer/tr_frontend_main.cpp
+++ b/neo/renderer/tr_frontend_main.cpp
@@ -542,11 +542,11 @@ void R_RenderView( viewDef_t* parms )
// RB: find closest environment probe
if( tr.viewDef->areaNum != -1 && !tr.viewDef->isSubview )
{
- float bestDist = 90000.0f;
+ float bestDist = 900000.0f;
for( viewEnvprobe_t* vProbe = tr.viewDef->viewEnvprobes; vProbe != NULL; vProbe = vProbe->next )
{
- float dist = ( tr.viewDef->renderView.vieworg - vProbe->globalOrigin ).LengthSqr();
+ float dist = ( tr.viewDef->renderView.vieworg - vProbe->globalOrigin ).Length();
if( dist < bestDist )
{
tr.viewDef->irradianceImage = vProbe->irradianceImage;