diff --git a/base/renderprogs/_manifest.lua b/base/renderprogs/_manifest.lua
index e4213eea..649b8590 100644
--- a/base/renderprogs/_manifest.lua
+++ b/base/renderprogs/_manifest.lua
@@ -9,8 +9,8 @@ return
-- shaders
"ambient_lighting.ps.hlsl",
"ambient_lighting.vs.hlsl",
- "ambient_lighting_IBL.pixel",
- "ambient_lighting_IBL.vertex",
+ "ambient_lighting_IBL.ps.hlsl",
+ "ambient_lighting_IBL.vs.hlsl",
"AmbientOcclusion_AO.ps.hlsl",
"AmbientOcclusion_AO.vs.hlsl",
"AmbientOcclusion_blur.ps.hlsl",
diff --git a/base/renderprogs/ambient_lighting.pixel b/base/renderprogs/ambient_lighting.pixel
deleted file mode 100644
index 38db99e3..00000000
--- a/base/renderprogs/ambient_lighting.pixel
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
-===========================================================================
-
-Doom 3 BFG Edition GPL Source Code
-Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
-Copyright (C) 2013-2015 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"
-
-uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface bump map
-uniform sampler2D samp1 : register(s1); // texture 2 is the light falloff texture
-uniform sampler2D samp2 : register(s2); // texture 3 is the light projection texture
-uniform sampler2D samp3 : register(s3); // texture 4 is the per-surface diffuse map
-uniform sampler2D samp4 : register(s4); // texture 5 is the per-surface specular map
-
-struct PS_IN {
- half4 position : VPOS;
- half4 texcoord0 : TEXCOORD0_centroid;
- half4 texcoord1 : TEXCOORD1_centroid;
-// half4 texcoord2 : TEXCOORD2_centroid;
-// half4 texcoord3 : TEXCOORD3_centroid;
- half4 texcoord4 : TEXCOORD4_centroid;
- half4 texcoord5 : TEXCOORD5_centroid;
- half4 texcoord6 : TEXCOORD6_centroid;
- half4 color : COLOR0;
-};
-
-struct PS_OUT {
- half4 color : COLOR;
-};
-
-void main( PS_IN fragment, out PS_OUT result ) {
- half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );
-// half4 lightFalloff = idtex2Dproj( samp1, fragment.texcoord2 );
-// half4 lightProj = idtex2Dproj( samp2, fragment.texcoord3 );
- half4 YCoCG = tex2D( samp3, fragment.texcoord4.xy );
- half4 specMap = tex2D( samp4, fragment.texcoord5.xy );
-
- half3 lightVector = normalize( fragment.texcoord0.xyz );
- half3 diffuseMap = ConvertYCoCgToRGB( YCoCG );
-
- half3 localNormal;
-#if defined(USE_NORMAL_FMT_RGB8)
- localNormal.xy = bumpMap.rg - 0.5;
-#else
- localNormal.xy = bumpMap.wy - 0.5;
-#endif
- localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );
- localNormal = normalize( localNormal );
-
- const half specularPower = 10.0f;
- half hDotN = dot3( normalize( fragment.texcoord6.xyz ), localNormal );
- // RB: added abs
- half3 specularContribution = _half3( pow( abs( hDotN ), specularPower ) );
-
- half3 diffuseColor = diffuseMap * rpDiffuseModifier.xyz * 1.5f;
- half3 specularColor = specMap.xyz * specularContribution * rpSpecularModifier.xyz;
-
- // RB: http://developer.valvesoftware.com/wiki/Half_Lambert
- float halfLdotN = dot3( localNormal, lightVector ) * 0.5 + 0.5;
- halfLdotN *= halfLdotN;
-
- // traditional very dark Lambert light model used in Doom 3
- float ldotN = dot3( localNormal, lightVector );
-
- half3 lightColor = rpAmbientColor.rgb;
-
- half rim = 1.0f - saturate( hDotN );
- half rimPower = 8.0;
- half3 rimColor = half3( 0.125 ) * 1.2 * lightColor * pow( rim, rimPower );
-
- //result.color.rgb = localNormal.xyz * 0.5 + 0.5;
- result.color.xyz = ( ( diffuseColor + specularColor ) * halfLdotN * lightColor + rimColor ) * fragment.color.rgb;;
- result.color.w = 1.0;
-}
diff --git a/base/renderprogs/ambient_lighting.vertex b/base/renderprogs/ambient_lighting.vertex
deleted file mode 100644
index c6473cd7..00000000
--- a/base/renderprogs/ambient_lighting.vertex
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
-===========================================================================
-
-Doom 3 BFG Edition GPL Source Code
-Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
-Copyright (C) 2013-2015 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"
-
-#if defined( USE_GPU_SKINNING )
-uniform matrices_ubo { float4 matrices[408]; };
-#endif
-
-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;
- float4 texcoord0 : TEXCOORD0;
- float4 texcoord1 : TEXCOORD1;
-// float4 texcoord2 : TEXCOORD2;
-// float4 texcoord3 : TEXCOORD3;
- float4 texcoord4 : TEXCOORD4;
- float4 texcoord5 : TEXCOORD5;
- float4 texcoord6 : TEXCOORD6;
- float4 color : COLOR0;
-};
-
-void main( VS_IN vertex, out VS_OUT result ) {
-
- float4 vNormal = vertex.normal * 2.0 - 1.0;
- float4 vTangent = vertex.tangent * 2.0 - 1.0;
- float3 vBitangent = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w;
-
-#if defined( USE_GPU_SKINNING )
- //--------------------------------------------------------------
- // GPU transformation of the normal / tangent / 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 );
-
- float3 tangent;
- tangent.x = dot3( matX, vTangent );
- tangent.y = dot3( matY, vTangent );
- tangent.z = dot3( matZ, vTangent );
- tangent = normalize( tangent );
-
- float3 bitangent;
- bitangent.x = dot3( matX, vBitangent );
- bitangent.y = dot3( matY, vBitangent );
- bitangent.z = dot3( matZ, vBitangent );
- bitangent = normalize( bitangent );
-
- 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;
- float3 normal = vNormal.xyz;
- float3 tangent = vTangent.xyz;
- float3 bitangent = vBitangent.xyz;
-#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 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f );
-
- //calculate vector to light
- //float4 toLight = rpLocalLightOrigin;
- float4 toLight = normalize( float4( 0.0f, 0.5f, 1.0f, 1.0f ) );
-
- //--------------------------------------------------------------
-
- //result.texcoord0 is the direction to the light in tangent space
- result.texcoord0.x = dot3( tangent, toLight );
- result.texcoord0.y = dot3( bitangent, toLight );
- result.texcoord0.z = dot3( normal, toLight );
- result.texcoord0.w = 1.0f;
-
- //textures 1 takes the base coordinates by the texture matrix
- result.texcoord1 = defaultTexCoord;
- result.texcoord1.x = dot4( vertex.texcoord.xy, rpBumpMatrixS );
- result.texcoord1.y = dot4( vertex.texcoord.xy, rpBumpMatrixT );
-
- //# texture 2 has one texgen
- //result.texcoord2 = defaultTexCoord;
- //result.texcoord2.x = dot4( vertex.position, rpLightFalloffS );
-
- //# texture 3 has three texgens
- //result.texcoord3.x = dot4( vertex.position, rpLightProjectionS );
- //result.texcoord3.y = dot4( vertex.position, rpLightProjectionT );
- //result.texcoord3.z = 0.0f;
- //result.texcoord3.w = dot4( vertex.position, rpLightProjectionQ );
-
- //# textures 4 takes the base coordinates by the texture matrix
- result.texcoord4 = defaultTexCoord;
- result.texcoord4.x = dot4( vertex.texcoord.xy, rpDiffuseMatrixS );
- result.texcoord4.y = dot4( vertex.texcoord.xy, rpDiffuseMatrixT );
-
- //# textures 5 takes the base coordinates by the texture matrix
- result.texcoord5 = defaultTexCoord;
- result.texcoord5.x = dot4( vertex.texcoord.xy, rpSpecularMatrixS );
- result.texcoord5.y = dot4( vertex.texcoord.xy, rpSpecularMatrixT );
-
- //# texture 6's texcoords will be the halfangle in texture space
-
- //# calculate normalized vector to light in R0
- toLight = normalize( toLight );
-
- //# calculate normalized vector to viewer in R1
- float4 toView = normalize( rpLocalViewOrigin - modelPosition );
-
- //# add together to become the half angle vector in object space (non-normalized)
- float4 halfAngleVector = toLight + toView;
-
- //# put into texture space
- result.texcoord6.x = dot3( tangent, halfAngleVector );
- result.texcoord6.y = dot3( bitangent, halfAngleVector );
- result.texcoord6.z = dot3( normal, halfAngleVector );
- result.texcoord6.w = 1.0f;
-
-#if defined( USE_GPU_SKINNING )
- // for joint transformation of the tangent space, we use color and
- // color2 for weighting information, so hopefully there aren't any
- // effects that need vertex color...
- result.color = float4( 1.0f, 1.0f, 1.0f, 1.0f );
-#else
- //# generate the vertex color, which can be 1.0, color, or 1.0 - color
- //# for 1.0 : env[16] = 0, env[17] = 1
- //# for color : env[16] = 1, env[17] = 0
- //# for 1.0-color : env[16] = -1, env[17] = 1
- result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
-#endif
-}
\ No newline at end of file
diff --git a/base/renderprogs/ambient_lighting_IBL.pixel b/base/renderprogs/ambient_lighting_IBL.ps.hlsl
similarity index 83%
rename from base/renderprogs/ambient_lighting_IBL.pixel
rename to base/renderprogs/ambient_lighting_IBL.ps.hlsl
index ad314c7b..ccd8a849 100644
--- a/base/renderprogs/ambient_lighting_IBL.pixel
+++ b/base/renderprogs/ambient_lighting_IBL.ps.hlsl
@@ -3,7 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
-Copyright (C) 2013-2016 Robert Beckebans
+Copyright (C) 2013-2019 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@@ -27,14 +27,14 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "renderprogs/global.inc"
-#include "renderprogs/BRDF.inc"
+#include "global.inc.hlsl"
+#include "BRDF.inc.hlsl"
-uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface bump map
-uniform sampler2D samp1 : register(s1); // texture 2 is the light falloff texture
-uniform sampler2D samp2 : register(s2); // texture 3 is the light projection texture
-uniform sampler2D samp3 : register(s3); // texture 4 is the per-surface diffuse map
-uniform sampler2D samp4 : register(s4); // texture 5 is the per-surface specular map
+uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map
+uniform sampler2D samp1 : register(s1); // texture 3 is the per-surface specular or roughness/metallic/AO mixer map
+uniform sampler2D samp2 : register(s2); // texture 2 is the per-surface baseColor map
+uniform sampler2D samp3 : register(s3); // texture 4 is the light falloff texture
+uniform sampler2D samp4 : register(s4); // texture 5 is the light projection texture
uniform samplerCUBE samp7 : register(s7); // texture 0 is the cube map
uniform samplerCUBE samp8 : register(s8); // texture 0 is the cube map
@@ -59,8 +59,8 @@ void main( PS_IN fragment, out PS_OUT result ) {
half4 bumpMap = tex2D( samp0, fragment.texcoord0.xy );
// half4 lightFalloff = idtex2Dproj( samp1, fragment.texcoord2 );
// half4 lightProj = idtex2Dproj( samp2, fragment.texcoord3 );
- half4 YCoCG = tex2D( samp3, fragment.texcoord1.xy );
- half4 specMap = tex2D( samp4, fragment.texcoord2.xy );
+ half4 YCoCG = tex2D( samp2, fragment.texcoord1.xy );
+ half4 specMap = tex2D( samp1, fragment.texcoord2.xy );
//half3 lightVector = normalize( fragment.texcoord0.xyz );
half3 diffuseMap = sRGBToLinearRGB( ConvertYCoCgToRGB( YCoCG ) );
@@ -118,12 +118,12 @@ void main( PS_IN fragment, out PS_OUT result ) {
half3 specularColor = lerp( dielectricColor, baseColor, metallic );
//diffuseColor = half3( 1.0 );
- float3 diffuseLight = sRGBToLinearRGB( texCUBE( samp7, globalNormal ).rgb ) * diffuseColor * ( rpDiffuseModifier.xyz ) * 1.5f;
+ float3 diffuseLight = ( texCUBE( samp7, globalNormal ).rgb ) * diffuseColor * ( rpDiffuseModifier.xyz ) * 1.5f;
//specularColor = half3( 0.0 );
float mip = clamp( ( roughness * 7.0 ) + 3.0, 0.0, 10.0 );
- float3 envColor = sRGBToLinearRGB( texCUBElod( samp8, float4( reflectionVector, mip ) ).rgb ) * ( rpSpecularModifier.xyz ) * 1.0f;
+ float3 envColor = ( textureLod( samp8, reflectionVector, mip ).rgb ) * ( rpSpecularModifier.xyz ) * 1.0f;
float3 specularLight = envColor * specularColor;
@@ -132,8 +132,9 @@ void main( PS_IN fragment, out PS_OUT result ) {
half4 specMapSRGB = specMap;
specMap = sRGBAToLinearRGBA( specMap );
- //float3 diffuseLight = sRGBToLinearRGB( texCUBE( samp7, globalNormal ).rgb ) * diffuseMap.rgb * ( rpDiffuseModifier.xyz ) * 1.5f;
- float3 diffuseLight = diffuseMap.rgb * ( rpDiffuseModifier.xyz ) * 1.5f;
+ //float3 diffuseLight = sRGBToLinearRGB( texCUBE( samp7, globalNormal ).rgb ) * diffuseMap.rgb * ( rpDiffuseModifier.xyz ) * 3.5f;
+ float3 diffuseLight = ( texCUBE( samp7, globalNormal ).rgb ) * diffuseMap.rgb * ( rpDiffuseModifier.xyz ) * 3.5f;
+ //float3 diffuseLight = diffuseMap.rgb * ( rpDiffuseModifier.xyz ) * 1.5f;
// HACK calculate roughness from D3 gloss maps
float Y = dot( LUMINANCE_SRGB.rgb, specMapSRGB.rgb );
@@ -144,7 +145,7 @@ void main( PS_IN fragment, out PS_OUT result ) {
const float roughness = 1.0 - glossiness;
float mip = clamp( ( roughness * 7.0 ) + 0.0, 0.0, 10.0 );
- float3 envColor = sRGBToLinearRGB( texCUBElod( samp8, float4( reflectionVector, mip ) ).rgb ) * ( rpSpecularModifier.xyz ) * 1.0f;
+ float3 envColor = ( textureLod( samp8, reflectionVector, mip ).rgb ) * ( rpSpecularModifier.xyz ) * 0.5f;
float3 specularLight = envColor * specMap.rgb;
diff --git a/base/renderprogs/ambient_lighting_IBL.vertex b/base/renderprogs/ambient_lighting_IBL.vs.hlsl
similarity index 99%
rename from base/renderprogs/ambient_lighting_IBL.vertex
rename to base/renderprogs/ambient_lighting_IBL.vs.hlsl
index 8d2007fa..e44f360f 100644
--- a/base/renderprogs/ambient_lighting_IBL.vertex
+++ b/base/renderprogs/ambient_lighting_IBL.vs.hlsl
@@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
-#include "renderprogs/global.inc"
+#include "global.inc.hlsl"
#if defined( USE_GPU_SKINNING )
uniform matrices_ubo { float4 matrices[408]; };
diff --git a/base/renderprogs/postprocess.ps.hlsl b/base/renderprogs/postprocess.ps.hlsl
index 969079e5..9dbfcc31 100644
--- a/base/renderprogs/postprocess.ps.hlsl
+++ b/base/renderprogs/postprocess.ps.hlsl
@@ -47,7 +47,7 @@ struct PS_OUT
#define USE_TECHNICOLOR 1 // [0 or 1]
-#define Technicolor_Amount 0.6 // [0.00 to 1.00]
+#define Technicolor_Amount 0.5 // [0.00 to 1.00]
#define Technicolor_Power 4.0 // [0.00 to 8.00]
#define Technicolor_RedNegativeAmount 0.88 // [0.00 to 1.00]
#define Technicolor_GreenNegativeAmount 0.88 // [0.00 to 1.00]
diff --git a/neo/renderer/RenderBackend.cpp b/neo/renderer/RenderBackend.cpp
index 64f21fce..041c4bf0 100644
--- a/neo/renderer/RenderBackend.cpp
+++ b/neo/renderer/RenderBackend.cpp
@@ -5890,7 +5890,7 @@ void idRenderBackend::PostProcess( const void* data )
/*
* The shader has three passes, chained together as follows:
*
- * |input|------------------�
+ * |input|------------------·
* v |
* [ SMAA*EdgeDetection ] |
* v |
@@ -5900,7 +5900,7 @@ void idRenderBackend::PostProcess( const void* data )
* v |
* |blendTex| |
* v |
- * [ SMAANeighborhoodBlending ] <------�
+ * [ SMAANeighborhoodBlending ] <------·
* v
* |output|
*/
diff --git a/neo/renderer/RenderBackend.h b/neo/renderer/RenderBackend.h
index 7119b7a1..1f9484e1 100644
--- a/neo/renderer/RenderBackend.h
+++ b/neo/renderer/RenderBackend.h
@@ -242,12 +242,6 @@ all state modified by the back end is separated from the front end state
===========================================================================
*/
-//namespace ImGui
-//{
-//
-//}
-
-//#include "../libs/imgui/imgui.h"
struct ImDrawData;
class idRenderBackend
diff --git a/neo/renderer/RenderProgs.cpp b/neo/renderer/RenderProgs.cpp
index b4cf3853..8dbd7579 100644
--- a/neo/renderer/RenderProgs.cpp
+++ b/neo/renderer/RenderProgs.cpp
@@ -111,8 +111,8 @@ void idRenderProgManager::Init()
{ 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_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 },
// RB end
diff --git a/neo/renderer/RenderProgs_embedded.h b/neo/renderer/RenderProgs_embedded.h
index 457dc176..d0450507 100644
--- a/neo/renderer/RenderProgs_embedded.h
+++ b/neo/renderer/RenderProgs_embedded.h
@@ -396,7 +396,7 @@ static const cgShaderDef_t cg_renderprogs[] =
" *\n"
" * The shader has three passes, chained together as follows:\n"
" *\n"
- " * |input|------------------�\n"
+ " * |input|------------------·\n"
" * v |\n"
" * [ SMAA*EdgeDetection ] |\n"
" * v |\n"
@@ -406,7 +406,7 @@ static const cgShaderDef_t cg_renderprogs[] =
" * v |\n"
" * |blendTex| |\n"
" * v |\n"
- " * [ SMAANeighborhoodBlending ] <------�\n"
+ " * [ SMAANeighborhoodBlending ] <------·\n"
" * v\n"
" * |output|\n"
" *\n"
@@ -1794,12 +1794,17 @@ static const cgShaderDef_t cg_renderprogs[] =
"}\n"
"\n"
"// Fresnel term F( v, h )\n"
- "// Fnone( v, h ) = F(0�) = specularColor\n"
+ "// Fnone( v, h ) = F(0°) = specularColor\n"
"half3 Fresnel_Schlick( half3 specularColor, half vdotH )\n"
"{\n"
" return specularColor + ( 1.0 - specularColor ) * pow( 1.0 - vdotH, 5.0 );\n"
"}\n"
"\n"
+ "half3 Fresnel_Glossy( half3 specularColor, half roughness, half vdotH )\n"
+ "{\n"
+ " return specularColor + ( max( half3( 1.0 - roughness ), specularColor ) - specularColor ) * pow( 1.0 - vdotH, 5.0 );\n"
+ "}\n"
+ "\n"
"// Visibility term G( l, v, h )\n"
"// Very similar to Marmoset Toolbag 2 and gives almost the same results as Smith GGX\n"
"float Visibility_Schlick( half vdotN, half ldotN, float alpha )\n"
@@ -2185,6 +2190,382 @@ static const cgShaderDef_t cg_renderprogs[] =
},
+ {
+ "renderprogs/ambient_lighting_IBL.ps.hlsl",
+ "/*\n"
+ "===========================================================================\n"
+ "\n"
+ "Doom 3 BFG Edition GPL Source Code\n"
+ "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n"
+ "Copyright (C) 2013-2019 Robert Beckebans\n"
+ "\n"
+ "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\"). \n"
+ "\n"
+ "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n"
+ "it under the terms of the GNU General Public License as published by\n"
+ "the Free Software Foundation, either version 3 of the License, or\n"
+ "(at your option) any later version.\n"
+ "\n"
+ "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n"
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
+ "GNU General Public License for more details.\n"
+ "\n"
+ "You should have received a copy of the GNU General Public License\n"
+ "along with Doom 3 BFG Edition Source Code. If not, see .\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "===========================================================================\n"
+ "*/\n"
+ "\n"
+ "#include \"global.inc.hlsl\"\n"
+ "#include \"BRDF.inc.hlsl\"\n"
+ "\n"
+ "uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map\n"
+ "uniform sampler2D samp1 : register(s1); // texture 3 is the per-surface specular or roughness/metallic/AO mixer map\n"
+ "uniform sampler2D samp2 : register(s2); // texture 2 is the per-surface baseColor map \n"
+ "uniform sampler2D samp3 : register(s3); // texture 4 is the light falloff texture\n"
+ "uniform sampler2D samp4 : register(s4); // texture 5 is the light projection texture\n"
+ "\n"
+ "uniform samplerCUBE samp7 : register(s7); // texture 0 is the cube map\n"
+ "uniform samplerCUBE samp8 : register(s8); // texture 0 is the cube map\n"
+ "\n"
+ "struct PS_IN {\n"
+ " half4 position : VPOS;\n"
+ " half4 texcoord0 : TEXCOORD0_centroid;\n"
+ " half4 texcoord1 : TEXCOORD1_centroid;\n"
+ " half4 texcoord2 : TEXCOORD2_centroid;\n"
+ " half4 texcoord3 : TEXCOORD3_centroid;\n"
+ " half4 texcoord4 : TEXCOORD4_centroid;\n"
+ " half4 texcoord5 : TEXCOORD5_centroid;\n"
+ " half4 texcoord6 : TEXCOORD6_centroid;\n"
+ " half4 color : COLOR0;\n"
+ "};\n"
+ "\n"
+ "struct PS_OUT {\n"
+ " half4 color : COLOR;\n"
+ "};\n"
+ "\n"
+ "void main( PS_IN fragment, out PS_OUT result ) {\n"
+ " half4 bumpMap = tex2D( samp0, fragment.texcoord0.xy );\n"
+ "// half4 lightFalloff = idtex2Dproj( samp1, fragment.texcoord2 );\n"
+ "// half4 lightProj = idtex2Dproj( samp2, fragment.texcoord3 );\n"
+ " half4 YCoCG = tex2D( samp2, fragment.texcoord1.xy );\n"
+ " half4 specMap = tex2D( samp1, fragment.texcoord2.xy );\n"
+ "\n"
+ " //half3 lightVector = normalize( fragment.texcoord0.xyz );\n"
+ " half3 diffuseMap = sRGBToLinearRGB( ConvertYCoCgToRGB( YCoCG ) );\n"
+ "\n"
+ " half3 localNormal;\n"
+ "#if defined(USE_NORMAL_FMT_RGB8)\n"
+ " localNormal.xy = bumpMap.rg - 0.5;\n"
+ "#else\n"
+ " localNormal.xy = bumpMap.wy - 0.5;\n"
+ "#endif\n"
+ " localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );\n"
+ " localNormal = normalize( localNormal );\n"
+ "\n"
+ " //const half specularPower = 10.0f;\n"
+ " //half hDotN = dot3( normalize( fragment.texcoord6.xyz ), localNormal );\n"
+ " // RB: added abs\n"
+ " //half3 specularContribution = _half3( pow( abs( hDotN ), specularPower ) );\n"
+ "\n"
+ " //half3 diffuseColor = diffuseMap * ( rpDiffuseModifier.xyz ) * 1.5f;\n"
+ " //half3 specularColor = specMap.xyz * specularContribution * ( rpSpecularModifier.xyz ); \n"
+ " \n"
+ " // RB: http://developer.valvesoftware.com/wiki/Half_Lambert\n"
+ " //float halfLdotN = dot3( localNormal, lightVector ) * 0.5 + 0.5;\n"
+ " //halfLdotN *= halfLdotN;\n"
+ " \n"
+ " // traditional very dark Lambert light model used in Doom 3\n"
+ " //float ldotN = dot3( localNormal, lightVector );\n"
+ " \n"
+ " float3 globalNormal;\n"
+ " globalNormal.x = dot3( localNormal, fragment.texcoord4 );\n"
+ " globalNormal.y = dot3( localNormal, fragment.texcoord5 );\n"
+ " globalNormal.z = dot3( localNormal, fragment.texcoord6 );\n"
+ "\n"
+ " float3 globalEye = normalize( fragment.texcoord3.xyz );\n"
+ "\n"
+ " float3 reflectionVector = globalNormal * dot3( globalEye, globalNormal );\n"
+ " reflectionVector = ( reflectionVector * 2.0f ) - globalEye;\n"
+ " \n"
+ "#if defined(USE_PBR)\n"
+ " \n"
+ " const half metallic = specMap.g;\n"
+ " const half roughness = specMap.r;\n"
+ " const half glossiness = 1.0 - roughness;\n"
+ "\n"
+ " // the vast majority of real-world materials (anything not metal or gems) have F(0°)\n"
+ " // values in a very narrow range (~0.02 - 0.08)\n"
+ " \n"
+ " // approximate non-metals with linear RGB 0.04 which is 0.08 * 0.5 (default in UE4)\n"
+ " const half3 dielectricColor = half3( 0.04 );\n"
+ " \n"
+ " // derive diffuse and specular from albedo(m) base color\n"
+ " const half3 baseColor = diffuseMap;\n"
+ " \n"
+ " half3 diffuseColor = baseColor * ( 1.0 - metallic );\n"
+ " half3 specularColor = lerp( dielectricColor, baseColor, metallic );\n"
+ " \n"
+ " //diffuseColor = half3( 1.0 );\n"
+ " float3 diffuseLight = ( texCUBE( samp7, globalNormal ).rgb ) * diffuseColor * ( rpDiffuseModifier.xyz ) * 1.5f;\n"
+ " \n"
+ " //specularColor = half3( 0.0 );\n"
+ " \n"
+ " float mip = clamp( ( roughness * 7.0 ) + 3.0, 0.0, 10.0 );\n"
+ " float3 envColor = ( textureLod( samp8, reflectionVector, mip ).rgb ) * ( rpSpecularModifier.xyz ) * 1.0f;\n"
+ " \n"
+ " float3 specularLight = envColor * specularColor;\n"
+ " \n"
+ "#else\n"
+ " \n"
+ " half4 specMapSRGB = specMap;\n"
+ " specMap = sRGBAToLinearRGBA( specMap );\n"
+ " \n"
+ " //float3 diffuseLight = sRGBToLinearRGB( texCUBE( samp7, globalNormal ).rgb ) * diffuseMap.rgb * ( rpDiffuseModifier.xyz ) * 3.5f;\n"
+ " float3 diffuseLight = ( texCUBE( samp7, globalNormal ).rgb ) * diffuseMap.rgb * ( rpDiffuseModifier.xyz ) * 3.5f;\n"
+ " //float3 diffuseLight = diffuseMap.rgb * ( rpDiffuseModifier.xyz ) * 1.5f;\n"
+ "\n"
+ " // HACK calculate roughness from D3 gloss maps\n"
+ " float Y = dot( LUMINANCE_SRGB.rgb, specMapSRGB.rgb );\n"
+ " \n"
+ " //const float glossiness = clamp( 1.0 - specMapSRGB.r, 0.0, 0.98 );\n"
+ " const float glossiness = clamp( pow( Y, 1.0 / 2.0 ), 0.0, 0.98 );\n"
+ " \n"
+ " const float roughness = 1.0 - glossiness;\n"
+ " \n"
+ " float mip = clamp( ( roughness * 7.0 ) + 0.0, 0.0, 10.0 );\n"
+ " float3 envColor = ( textureLod( samp8, reflectionVector, mip ).rgb ) * ( rpSpecularModifier.xyz ) * 0.5f;\n"
+ " \n"
+ " float3 specularLight = envColor * specMap.rgb;\n"
+ " \n"
+ "#endif\n"
+ "\n"
+ " // add glossy fresnel\n"
+ " half hDotN = saturate( dot3( globalEye, globalNormal ) );\n"
+ " \n"
+ " half3 specularColor2 = half3( 0.0 );\n"
+ " float3 glossyFresnel = Fresnel_Glossy( specularColor2, roughness, hDotN );\n"
+ " \n"
+ " // horizon fade\n"
+ " const half horizonFade = 1.3;\n"
+ " half horiz = saturate( 1.0 + horizonFade * saturate( dot3( reflectionVector, globalNormal ) ) );\n"
+ " horiz *= horiz;\n"
+ " //horiz = clamp( horiz, 0.0, 1.0 );\n"
+ " \n"
+ " //specularLight = glossyFresnel * envColor;\n"
+ " specularLight += glossyFresnel * envColor * ( rpSpecularModifier.xyz ) * 0.9 * horiz;\n"
+ "\n"
+ " half3 lightColor = sRGBToLinearRGB( rpAmbientColor.rgb );\n"
+ " \n"
+ " //result.color.rgb = diffuseLight;\n"
+ " //result.color.rgb = diffuseLight * lightColor;\n"
+ " //result.color.rgb = specularLight;\n"
+ " result.color.rgb = ( diffuseLight + specularLight ) * lightColor * fragment.color.rgb;\n"
+ " //result.color.rgb = localNormal.xyz * 0.5 + 0.5;\n"
+ " //result.color.xyz = ( ( diffuseColor + specularColor ) * halfLdotN * lightColor ) * fragment.color.rgb;\n"
+ " //result.color = ( ( diffuseColor + specularColor ) * halfLdotN * lightColor + rimColor ) * fragment.color.rgba;\n"
+ " result.color.w = fragment.color.a;\n"
+ "}\n"
+ "\n"
+
+ },
+
+ {
+ "renderprogs/ambient_lighting_IBL.vs.hlsl",
+ "/*\n"
+ "===========================================================================\n"
+ "\n"
+ "Doom 3 BFG Edition GPL Source Code\n"
+ "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n"
+ "Copyright (C) 2013-2015 Robert Beckebans\n"
+ "\n"
+ "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\"). \n"
+ "\n"
+ "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n"
+ "it under the terms of the GNU General Public License as published by\n"
+ "the Free Software Foundation, either version 3 of the License, or\n"
+ "(at your option) any later version.\n"
+ "\n"
+ "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n"
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
+ "GNU General Public License for more details.\n"
+ "\n"
+ "You should have received a copy of the GNU General Public License\n"
+ "along with Doom 3 BFG Edition Source Code. If not, see .\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "===========================================================================\n"
+ "*/\n"
+ "\n"
+ "#include \"global.inc.hlsl\"\n"
+ "\n"
+ "#if defined( USE_GPU_SKINNING )\n"
+ "uniform matrices_ubo { float4 matrices[408]; };\n"
+ "#endif\n"
+ "\n"
+ "struct VS_IN {\n"
+ " float4 position : POSITION;\n"
+ " float2 texcoord : TEXCOORD0;\n"
+ " float4 normal : NORMAL;\n"
+ " float4 tangent : TANGENT;\n"
+ " float4 color : COLOR0;\n"
+ " float4 color2 : COLOR1;\n"
+ "};\n"
+ "\n"
+ "struct VS_OUT {\n"
+ " float4 position : POSITION;\n"
+ " float4 texcoord0 : TEXCOORD0;\n"
+ " float4 texcoord1 : TEXCOORD1;\n"
+ " float4 texcoord2 : TEXCOORD2;\n"
+ " float4 texcoord3 : TEXCOORD3;\n"
+ " float4 texcoord4 : TEXCOORD4;\n"
+ " float4 texcoord5 : TEXCOORD5;\n"
+ " float4 texcoord6 : TEXCOORD6;\n"
+ " float4 color : COLOR0;\n"
+ "};\n"
+ "\n"
+ "void main( VS_IN vertex, out VS_OUT result ) {\n"
+ "\n"
+ " float4 vNormal = vertex.normal * 2.0 - 1.0;\n"
+ " float4 vTangent = vertex.tangent * 2.0 - 1.0;\n"
+ " float3 vBitangent = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w;\n"
+ "\n"
+ "#if defined( USE_GPU_SKINNING )\n"
+ " //--------------------------------------------------------------\n"
+ " // GPU transformation of the normal / tangent / bitangent\n"
+ " //\n"
+ " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n"
+ " //--------------------------------------------------------------\n"
+ " const float w0 = vertex.color2.x;\n"
+ " const float w1 = vertex.color2.y;\n"
+ " const float w2 = vertex.color2.z;\n"
+ " const float w3 = vertex.color2.w;\n"
+ "\n"
+ " float4 matX, matY, matZ; // must be float4 for vec4\n"
+ " int joint = int(vertex.color.x * 255.1 * 3.0);\n"
+ " matX = matrices[int(joint+0)] * w0;\n"
+ " matY = matrices[int(joint+1)] * w0;\n"
+ " matZ = matrices[int(joint+2)] * w0;\n"
+ "\n"
+ " joint = int(vertex.color.y * 255.1 * 3.0);\n"
+ " matX += matrices[int(joint+0)] * w1;\n"
+ " matY += matrices[int(joint+1)] * w1;\n"
+ " matZ += matrices[int(joint+2)] * w1;\n"
+ "\n"
+ " joint = int(vertex.color.z * 255.1 * 3.0);\n"
+ " matX += matrices[int(joint+0)] * w2;\n"
+ " matY += matrices[int(joint+1)] * w2;\n"
+ " matZ += matrices[int(joint+2)] * w2;\n"
+ "\n"
+ " joint = int(vertex.color.w * 255.1 * 3.0);\n"
+ " matX += matrices[int(joint+0)] * w3;\n"
+ " matY += matrices[int(joint+1)] * w3;\n"
+ " matZ += matrices[int(joint+2)] * w3;\n"
+ "\n"
+ " float3 normal;\n"
+ " normal.x = dot3( matX, vNormal );\n"
+ " normal.y = dot3( matY, vNormal );\n"
+ " normal.z = dot3( matZ, vNormal );\n"
+ " normal = normalize( normal );\n"
+ "\n"
+ " float3 tangent;\n"
+ " tangent.x = dot3( matX, vTangent );\n"
+ " tangent.y = dot3( matY, vTangent );\n"
+ " tangent.z = dot3( matZ, vTangent );\n"
+ " tangent = normalize( tangent );\n"
+ "\n"
+ " float3 bitangent;\n"
+ " bitangent.x = dot3( matX, vBitangent );\n"
+ " bitangent.y = dot3( matY, vBitangent );\n"
+ " bitangent.z = dot3( matZ, vBitangent );\n"
+ " bitangent = normalize( bitangent );\n"
+ "\n"
+ " float4 modelPosition;\n"
+ " modelPosition.x = dot4( matX, vertex.position );\n"
+ " modelPosition.y = dot4( matY, vertex.position );\n"
+ " modelPosition.z = dot4( matZ, vertex.position );\n"
+ " modelPosition.w = 1.0;\n"
+ "\n"
+ "#else\n"
+ " float4 modelPosition = vertex.position;\n"
+ " float3 normal = vNormal.xyz;\n"
+ " float3 tangent = vTangent.xyz;\n"
+ " float3 bitangent = vBitangent.xyz;\n"
+ "#endif\n"
+ "\n"
+ " result.position.x = dot4( modelPosition, rpMVPmatrixX );\n"
+ " result.position.y = dot4( modelPosition, rpMVPmatrixY );\n"
+ " result.position.z = dot4( modelPosition, rpMVPmatrixZ );\n"
+ " result.position.w = dot4( modelPosition, rpMVPmatrixW );\n"
+ "\n"
+ " float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f );\n"
+ "\n"
+ " //calculate vector to light\n"
+ " //float4 toLight = rpLocalLightOrigin;\n"
+ " float4 toLight = normalize( float4( 0.0f, 0.5f, 1.0f, 1.0f ) );\n"
+ "\n"
+ " //--------------------------------------------------------------\n"
+ "\n"
+ "\n"
+ " //# textures 0 takes the base coordinates by the texture matrix\n"
+ " result.texcoord0 = defaultTexCoord;\n"
+ " result.texcoord0.x = dot4( vertex.texcoord.xy, rpBumpMatrixS );\n"
+ " result.texcoord0.y = dot4( vertex.texcoord.xy, rpBumpMatrixT );\n"
+ "\n"
+ " //# textures 1 takes the base coordinates by the texture matrix\n"
+ " result.texcoord1 = defaultTexCoord;\n"
+ " result.texcoord1.x = dot4( vertex.texcoord.xy, rpDiffuseMatrixS );\n"
+ " result.texcoord1.y = dot4( vertex.texcoord.xy, rpDiffuseMatrixT );\n"
+ "\n"
+ " //# textures 2 takes the base coordinates by the texture matrix\n"
+ " result.texcoord2 = defaultTexCoord;\n"
+ " result.texcoord2.x = dot4( vertex.texcoord.xy, rpSpecularMatrixS );\n"
+ " result.texcoord2.y = dot4( vertex.texcoord.xy, rpSpecularMatrixT );\n"
+ "\n"
+ " //# calculate normalized vector to viewer in R1\n"
+ " float4 toEye = normalize( rpLocalViewOrigin - modelPosition );\n"
+ "\n"
+ " result.texcoord3.x = dot3( toEye, rpModelMatrixX );\n"
+ " result.texcoord3.y = dot3( toEye, rpModelMatrixY );\n"
+ " result.texcoord3.z = dot3( toEye, rpModelMatrixZ );\n"
+ " \n"
+ " result.texcoord4.x = dot3( tangent, rpModelMatrixX );\n"
+ " result.texcoord5.x = dot3( tangent, rpModelMatrixY );\n"
+ " result.texcoord6.x = dot3( tangent, rpModelMatrixZ );\n"
+ "\n"
+ " result.texcoord4.y = dot3( bitangent, rpModelMatrixX );\n"
+ " result.texcoord5.y = dot3( bitangent, rpModelMatrixY );\n"
+ " result.texcoord6.y = dot3( bitangent, rpModelMatrixZ );\n"
+ "\n"
+ " result.texcoord4.z = dot3( normal, rpModelMatrixX );\n"
+ " result.texcoord5.z = dot3( normal, rpModelMatrixY );\n"
+ " result.texcoord6.z = dot3( normal, rpModelMatrixZ );\n"
+ "\n"
+ "#if defined( USE_GPU_SKINNING )\n"
+ " // for joint transformation of the tangent space, we use color and\n"
+ " // color2 for weighting information, so hopefully there aren't any\n"
+ " // effects that need vertex color...\n"
+ " result.color = float4( 1.0f, 1.0f, 1.0f, 1.0f );\n"
+ "#else\n"
+ " //# generate the vertex color, which can be 1.0, color, or 1.0 - color\n"
+ " //# for 1.0 : env[16] = 0, env[17] = 1\n"
+ " //# for color : env[16] = 1, env[17] = 0\n"
+ " //# for 1.0-color : env[16] = -1, env[17] = 1 \n"
+ " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n"
+ "#endif\n"
+ "}\n"
+
+ },
+
{
"renderprogs/AmbientOcclusion_AO.ps.hlsl",
"/**\n"
@@ -8279,7 +8660,7 @@ static const cgShaderDef_t cg_renderprogs[] =
" const half roughness = specMapSRGB.r;\n"
" const half glossiness = 1.0 - roughness;\n"
"\n"
- " // the vast majority of real-world materials (anything not metal or gems) have F(0�)\n"
+ " // the vast majority of real-world materials (anything not metal or gems) have F(0°)\n"
" // values in a very narrow range (~0.02 - 0.08)\n"
" \n"
" // approximate non-metals with linear RGB 0.04 which is 0.08 * 0.5 (default in UE4)\n"
@@ -9364,7 +9745,7 @@ static const cgShaderDef_t cg_renderprogs[] =
" const half roughness = specMapSRGB.r;\n"
" const half glossiness = 1.0 - roughness;\n"
"\n"
- " // the vast majority of real-world materials (anything not metal or gems) have F(0�)\n"
+ " // the vast majority of real-world materials (anything not metal or gems) have F(0°)\n"
" // values in a very narrow range (~0.02 - 0.08)\n"
" \n"
" // approximate non-metals with linear RGB 0.04 which is 0.08 * 0.5 (default in UE4)\n"
@@ -12313,7 +12694,11 @@ static const cgShaderDef_t cg_renderprogs[] =
" \n"
"#if OPERATOR == 0\n"
" // advanced Reinhard operator, artistically desirable to burn out bright areas\n"
- " float L = Yr * ( 1.0 + Yr / ( Ymax * Ymax ) ) / ( 1.0 + Yr );\n"
+ " //float L = Yr * ( 1.0 + Yr / ( Ymax * Ymax ) ) / ( 1.0 + Yr );\n"
+ " \n"
+ " // exponential tone mapper that is very similar to the Uncharted one\n"
+ " // very good in keeping the colors natural\n"
+ " float L = 1.0 - exp( -Yr );\n"
" color.rgb *= L;\n"
"\n"
"#elif OPERATOR == 1\n"