diff --git a/base/renderprogs/_manifest.lua b/base/renderprogs/_manifest.lua index 58f18bfc..e4213eea 100644 --- a/base/renderprogs/_manifest.lua +++ b/base/renderprogs/_manifest.lua @@ -9,6 +9,8 @@ return -- shaders "ambient_lighting.ps.hlsl", "ambient_lighting.vs.hlsl", + "ambient_lighting_IBL.pixel", + "ambient_lighting_IBL.vertex", "AmbientOcclusion_AO.ps.hlsl", "AmbientOcclusion_AO.vs.hlsl", "AmbientOcclusion_blur.ps.hlsl", diff --git a/base/renderprogs/ambient_lighting_IBL.pixel b/base/renderprogs/ambient_lighting_IBL.pixel new file mode 100644 index 00000000..8de07c84 --- /dev/null +++ b/base/renderprogs/ambient_lighting_IBL.pixel @@ -0,0 +1,127 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2013-2016 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 + +uniform samplerCUBE samp7 : register(s7); // texture 0 is the cube map +uniform samplerCUBE samp8 : register(s8); // texture 0 is the cube 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.texcoord0.xy ); +// half4 lightFalloff = idtex2Dproj( samp1, fragment.texcoord2 ); +// half4 lightProj = idtex2Dproj( samp2, fragment.texcoord3 ); + half4 YCoCG = tex2D( samp3, fragment.texcoord1.xy ); + half4 specMapSRGB = tex2D( samp4, fragment.texcoord2.xy ); + half4 specMap = sRGBAToLinearRGBA( specMapSRGB ); + + //half3 lightVector = normalize( fragment.texcoord0.xyz ); + half3 diffuseMap = sRGBToLinearRGB( 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 ); + + float3 globalNormal; + globalNormal.x = dot3( localNormal, fragment.texcoord4 ); + globalNormal.y = dot3( localNormal, fragment.texcoord5 ); + globalNormal.z = dot3( localNormal, fragment.texcoord6 ); + + float3 globalEye = normalize( fragment.texcoord3.xyz ); + + float3 reflectionVector = globalNormal * dot3( globalEye, globalNormal ); + reflectionVector = ( reflectionVector * 2.0f ) - globalEye; + + //half rim = 1.0f - saturate( hDotN ); + //half rimPower = 8.0; + //half3 rimColor = sRGBToLinearRGB( half3( 0.125 ) * 1.2 ) * lightColor * pow( rim, rimPower ); + + float3 diffuseLight = sRGBToLinearRGB( texCUBE( samp7, globalNormal ).rgb ) * diffuseMap.rgb * ( rpDiffuseModifier.xyz ) * 1.0f; + + // HACK calculate roughness from D3 gloss maps + float Y = dot( LUMINANCE_SRGB.rgb, specMapSRGB.rgb ); + + //const float glossiness = clamp( 1.0 - specMapSRGB.r, 0.0, 0.98 ); + const float glossiness = clamp( pow( Y, 1.0 / 2.0 ), 0.0, 0.98 ); + + const float roughness = 1.0 - glossiness; + + float mip = roughness * 7.0; + float3 specularLight = sRGBToLinearRGB( texCUBEbias( samp8, float4( reflectionVector, mip ) ).rgb ) * specMap.rgb * ( rpSpecularModifier.xyz ) * 1.0f; + + half3 lightColor = sRGBToLinearRGB( rpAmbientColor.rgb ); + + //result.color.rgb = specularLight; + result.color.rgb = ( diffuseLight + specularLight ) * lightColor * fragment.color.rgb; + //result.color.rgb = localNormal.xyz * 0.5 + 0.5; + //result.color.xyz = ( ( diffuseColor + specularColor ) * halfLdotN * lightColor ) * fragment.color.rgb; + //result.color = ( ( diffuseColor + specularColor ) * halfLdotN * lightColor + rimColor ) * fragment.color.rgba; + result.color.w = fragment.color.a; +} diff --git a/base/renderprogs/ambient_lighting_IBL.vertex b/base/renderprogs/ambient_lighting_IBL.vertex new file mode 100644 index 00000000..8d2007fa --- /dev/null +++ b/base/renderprogs/ambient_lighting_IBL.vertex @@ -0,0 +1,186 @@ +/* +=========================================================================== + +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 ) ); + + //-------------------------------------------------------------- + + + //# textures 0 takes the base coordinates by the texture matrix + result.texcoord0 = defaultTexCoord; + result.texcoord0.x = dot4( vertex.texcoord.xy, rpBumpMatrixS ); + result.texcoord0.y = dot4( vertex.texcoord.xy, rpBumpMatrixT ); + + //# textures 1 takes the base coordinates by the texture matrix + result.texcoord1 = defaultTexCoord; + result.texcoord1.x = dot4( vertex.texcoord.xy, rpDiffuseMatrixS ); + result.texcoord1.y = dot4( vertex.texcoord.xy, rpDiffuseMatrixT ); + + //# textures 2 takes the base coordinates by the texture matrix + result.texcoord2 = defaultTexCoord; + result.texcoord2.x = dot4( vertex.texcoord.xy, rpSpecularMatrixS ); + result.texcoord2.y = dot4( vertex.texcoord.xy, rpSpecularMatrixT ); + + //# calculate normalized vector to viewer in R1 + float4 toEye = normalize( rpLocalViewOrigin - modelPosition ); + + result.texcoord3.x = dot3( toEye, rpModelMatrixX ); + result.texcoord3.y = dot3( toEye, rpModelMatrixY ); + result.texcoord3.z = dot3( toEye, rpModelMatrixZ ); + + result.texcoord4.x = dot3( tangent, rpModelMatrixX ); + result.texcoord5.x = dot3( tangent, rpModelMatrixY ); + result.texcoord6.x = dot3( tangent, rpModelMatrixZ ); + + result.texcoord4.y = dot3( bitangent, rpModelMatrixX ); + result.texcoord5.y = dot3( bitangent, rpModelMatrixY ); + result.texcoord6.y = dot3( bitangent, rpModelMatrixZ ); + + result.texcoord4.z = dot3( normal, rpModelMatrixX ); + result.texcoord5.z = dot3( normal, rpModelMatrixY ); + result.texcoord6.z = dot3( normal, rpModelMatrixZ ); + +#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/neo/renderer/BinaryImage.cpp b/neo/renderer/BinaryImage.cpp index 0c7b1516..70a92fb0 100644 --- a/neo/renderer/BinaryImage.cpp +++ b/neo/renderer/BinaryImage.cpp @@ -44,7 +44,7 @@ If you have questions concerning this license or the applicable additional terms #include "Color/ColorSpace.h" idCVar image_highQualityCompression( "image_highQualityCompression", "0", CVAR_BOOL, "Use high quality (slow) compression" ); -idCVar r_useHighQualitySky( "r_useHighQualitySky", "0", CVAR_BOOL | CVAR_ARCHIVE, "Use high quality skyboxes" ); +idCVar r_useHighQualitySky( "r_useHighQualitySky", "1", CVAR_BOOL | CVAR_ARCHIVE, "Use high quality skyboxes" ); /* ======================== @@ -360,13 +360,37 @@ void idBinaryImage::LoadCubeFromMemory( int width, const byte* pics[6], int numL { img.Alloc( padSize * padSize / 2 ); idDxtEncoder dxt; - dxt.CompressImageDXT1Fast( padSrc, img.data, padSize, padSize ); + + if( image_highQualityCompression.GetBool() ) + { + commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT1HQ", width, width ) ); + + dxt.CompressImageDXT1HQ( padSrc, img.data, padSize, padSize ); + } + else + { + commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT1Fast", width, width ) ); + + dxt.CompressImageDXT1Fast( padSrc, img.data, padSize, padSize ); + } } else if( textureFormat == FMT_DXT5 ) { img.Alloc( padSize * padSize ); idDxtEncoder dxt; - dxt.CompressImageDXT5Fast( padSrc, img.data, padSize, padSize ); + + if( image_highQualityCompression.GetBool() ) + { + commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT5HQ", width, width ) ); + + dxt.CompressImageDXT5HQ( padSrc, img.data, padSize, padSize ); + } + else + { + commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT5Fast", width, width ) ); + + dxt.CompressImageDXT5Fast( padSrc, img.data, padSize, padSize ); + } } else { diff --git a/neo/renderer/Image.h b/neo/renderer/Image.h index 0ea1827b..a4879de7 100644 --- a/neo/renderer/Image.h +++ b/neo/renderer/Image.h @@ -216,6 +216,8 @@ typedef enum TD_COVERAGE, // coverage map for fill depth pass when YCoCG is used TD_DEPTH, // depth buffer copy for motion blur // RB begin + TD_HIGHQUALITY_CUBE, // motorsep - Uncompressed cubemap texture (RGB colorspace) + TD_LOWQUALITY_CUBE, // motorsep - Compressed cubemap texture (RGB colorspace DXT5) TD_SHADOW_ARRAY, // 2D depth buffer array for shadow mapping TD_RGBA16F, TD_RGBA32F, @@ -545,6 +547,9 @@ public: idImage* currentNormalsImage; // cheap G-Buffer replacement, holds normals and surface roughness idImage* ambientOcclusionImage[2]; // contain AO and bilateral filtering keys idImage* hierarchicalZbufferImage; // zbuffer with mip maps to accelerate screen space ray tracing + + idImage* defaultUACIrradianceCube; + idImage* defaultUACRadianceCube; // RB end idImage* scratchImage; idImage* scratchImage2; @@ -553,7 +558,7 @@ public: idImage* currentDepthImage; // for motion blur idImage* originalCurrentRenderImage; // currentRenderImage before any changes for stereo rendering idImage* loadingIconImage; // loading icon must exist always - idImage* hellLoadingIconImage; // loading icon must exist always + idImage* hellLoadingIconImage; // loading icon must exist always //-------------------------------------------------------- diff --git a/neo/renderer/Image_intrinsic.cpp b/neo/renderer/Image_intrinsic.cpp index c2456b6c..8978c9b5 100644 --- a/neo/renderer/Image_intrinsic.cpp +++ b/neo/renderer/Image_intrinsic.cpp @@ -891,6 +891,9 @@ void idImageManager::CreateIntrinsicImages() loadingIconImage = ImageFromFile( "textures/loadingicon2", TF_DEFAULT, TR_CLAMP, TD_DEFAULT, CF_2D ); hellLoadingIconImage = ImageFromFile( "textures/loadingicon3", TF_DEFAULT, TR_CLAMP, TD_DEFAULT, CF_2D ); + 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 ); + release_assert( loadingIconImage->referencedOutsideLevelLoad ); release_assert( hellLoadingIconImage->referencedOutsideLevelLoad ); } diff --git a/neo/renderer/Image_load.cpp b/neo/renderer/Image_load.cpp index 49e1b705..2f518a4e 100644 --- a/neo/renderer/Image_load.cpp +++ b/neo/renderer/Image_load.cpp @@ -169,6 +169,17 @@ ID_INLINE void idImage::DeriveOpts() case TD_LOOKUP_TABLE_RGBA: opts.format = FMT_RGBA8; break; + // motorsep 05-17-2015; added this for uncompressed cubemap/skybox textures + case TD_HIGHQUALITY_CUBE: + opts.colorFormat = CFM_DEFAULT; + opts.format = FMT_RGBA8; + opts.gammaMips = true; + break; + case TD_LOWQUALITY_CUBE: + opts.colorFormat = CFM_DEFAULT; // CFM_YCOCG_DXT5; + opts.format = FMT_DXT5; + opts.gammaMips = true; + break; default: assert( false ); opts.format = FMT_RGBA8; diff --git a/neo/renderer/Material.cpp b/neo/renderer/Material.cpp index 4d75c2c2..c55f7615 100644 --- a/neo/renderer/Material.cpp +++ b/neo/renderer/Material.cpp @@ -72,6 +72,8 @@ typedef struct mtrParsingData_s bool forceOverlays; } mtrParsingData_t; +extern idCVar r_useHighQualitySky; + idCVar r_forceSoundOpAmplitude( "r_forceSoundOpAmplitude", "0", CVAR_FLOAT, "Don't call into the sound system for amplitudes" ); /* @@ -1555,8 +1557,16 @@ void idMaterial::ParseStage( idLexer& src, const textureRepeat_t trpDefault ) { continue; } - if( !token.Icmp( "uncompressed" ) ) + if( !token.Icmp( "uncompressedCubeMap" ) ) { + if( r_useHighQualitySky.GetBool() ) + { + td = TD_HIGHQUALITY_CUBE; // motorsep 05-17-2015; token to mark cubemap/skybox to be uncompressed texture + } + else + { + td = TD_LOWQUALITY_CUBE; + } continue; } if( !token.Icmp( "nopicmip" ) ) diff --git a/neo/renderer/RenderBackend.cpp b/neo/renderer/RenderBackend.cpp index 502e3c1b..3a270d2c 100644 --- a/neo/renderer/RenderBackend.cpp +++ b/neo/renderer/RenderBackend.cpp @@ -687,9 +687,7 @@ void idRenderBackend::PrepareStageTexturing( const shaderStage_t* pStage, const } else if( pStage->texture.texgen == TG_SKYBOX_CUBE ) { - renderProgManager.BindShader_SkyBox(); - } else if( pStage->texture.texgen == TG_WOBBLESKY_CUBE ) { @@ -1202,6 +1200,9 @@ const int INTERACTION_TEXUNIT_PROJECTION = 4; const int INTERACTION_TEXUNIT_SHADOWMAPS = 5; const int INTERACTION_TEXUNIT_JITTER = 6; +const int INTERACTION_TEXUNIT_AMBIENT_CUBE1 = 7; +const int INTERACTION_TEXUNIT_SPECULAR_CUBE1 = 8; + /* ================== idRenderBackend::SetupInteractionStage @@ -2051,6 +2052,23 @@ void idRenderBackend::AmbientPass( const drawSurf_t* const* drawSurfs, int numDr else #endif { +#if 1 + // draw Quake 4 style ambient + if( drawSurf->jointCache ) + { + renderProgManager.BindShader_ImageBasedLightingSkinned(); + } + else + { + renderProgManager.BindShader_ImageBasedLighting(); + } + + GL_SelectTexture( INTERACTION_TEXUNIT_AMBIENT_CUBE1 ); + globalImages->defaultUACIrradianceCube->Bind(); + + GL_SelectTexture( INTERACTION_TEXUNIT_SPECULAR_CUBE1 ); + globalImages->defaultUACRadianceCube->Bind(); +#else // draw Quake 4 style ambient if( drawSurf->jointCache ) { @@ -2060,6 +2078,7 @@ void idRenderBackend::AmbientPass( const drawSurf_t* const* drawSurfs, int numDr { renderProgManager.BindShader_AmbientLighting(); } +#endif } } diff --git a/neo/renderer/RenderProgs.cpp b/neo/renderer/RenderProgs.cpp index cc63a2a4..c32a69e0 100644 --- a/neo/renderer/RenderProgs.cpp +++ b/neo/renderer/RenderProgs.cpp @@ -109,6 +109,8 @@ void idRenderProgManager::Init() { BUILTIN_VERTEX_COLOR, "vertex_color.vfp", "", 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 false, SHADER_STAGE_DEFAULT, LAYOUT_DRA }, + { BUILTIN_AMBIENT_LIGHTING_IBL_SKINNED, "ambient_lighting_IBL", "_skinned", BIT( USE_GPU_SKINNING ), true false, SHADER_STAGE_DEFAULT, LAYOUT_DRA }, { 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 @@ -242,6 +244,7 @@ void idRenderProgManager::Init() renderProgs[builtinShaders[BUILTIN_FOG_SKINNED]].usesJoints = true; // RB begin renderProgs[builtinShaders[BUILTIN_AMBIENT_LIGHTING_SKINNED]].usesJoints = true; + renderProgs[builtinShaders[BUILTIN_AMBIENT_LIGHTING_IBL_SKINNED]].usesJoints = true; renderProgs[builtinShaders[BUILTIN_SMALL_GEOMETRY_BUFFER_SKINNED]].usesJoints = true; renderProgs[builtinShaders[BUILTIN_INTERACTION_SHADOW_MAPPING_SPOT_SKINNED]].usesJoints = true; renderProgs[builtinShaders[BUILTIN_INTERACTION_SHADOW_MAPPING_POINT_SKINNED]].usesJoints = true; diff --git a/neo/renderer/RenderProgs.h b/neo/renderer/RenderProgs.h index b64938aa..680bc0a5 100644 --- a/neo/renderer/RenderProgs.h +++ b/neo/renderer/RenderProgs.h @@ -290,6 +290,16 @@ public: BindShader_Builtin( BUILTIN_AMBIENT_LIGHTING_SKINNED ); } + void BindShader_ImageBasedLighting() + { + BindShader_Builtin( BUILTIN_AMBIENT_LIGHTING_IBL ); + } + + void BindShader_ImageBasedLightingSkinned() + { + BindShader_Builtin( BUILTIN_AMBIENT_LIGHTING_IBL_SKINNED ); + } + void BindShader_SmallGeometryBuffer() { BindShader_Builtin( BUILTIN_SMALL_GEOMETRY_BUFFER ); @@ -647,6 +657,8 @@ private: BUILTIN_VERTEX_COLOR, BUILTIN_AMBIENT_LIGHTING, BUILTIN_AMBIENT_LIGHTING_SKINNED, + BUILTIN_AMBIENT_LIGHTING_IBL, + BUILTIN_AMBIENT_LIGHTING_IBL_SKINNED, BUILTIN_SMALL_GEOMETRY_BUFFER, BUILTIN_SMALL_GEOMETRY_BUFFER_SKINNED, // RB end