mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-15 07:00:58 +00:00
Make shadow atlas optional for perf comparison
This commit is contained in:
parent
ca6b434a63
commit
024ad532e2
5 changed files with 372 additions and 107 deletions
|
@ -1211,6 +1211,8 @@ void idRenderBackend::DrawSingleInteraction( drawInteraction_t* din, bool useFas
|
|||
}
|
||||
else if( setInteractionShader )
|
||||
{
|
||||
// TODO extra paths for foliage, terrain and skin
|
||||
|
||||
if( specUsage == TD_SPECULAR_PBR_RMAO || specUsage == TD_SPECULAR_PBR_RMAOD )
|
||||
{
|
||||
// PBR path with roughness, metal and AO
|
||||
|
@ -1229,41 +1231,97 @@ void idRenderBackend::DrawSingleInteraction( drawInteraction_t* din, bool useFas
|
|||
}
|
||||
else
|
||||
{
|
||||
if( !r_skipShadows.GetBool() && r_useShadowMapping.GetBool() && din->vLight->globalShadows && din->vLight->ImageAtlasPlaced() )
|
||||
if( !r_skipShadows.GetBool() && r_useShadowMapping.GetBool() && din->vLight->globalShadows )
|
||||
{
|
||||
// RB: we have shadow mapping enabled and shadow maps so do a shadow compare
|
||||
|
||||
if( din->vLight->parallel )
|
||||
if( r_useShadowAtlas.GetBool() )
|
||||
{
|
||||
if( din->surf->jointCache )
|
||||
if( din->vLight->ImageAtlasPlaced() )
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowMapping_Parallel_Skinned();
|
||||
if( din->vLight->parallel )
|
||||
{
|
||||
if( din->surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowAtlas_Parallel_Skinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowAtlas_Parallel();
|
||||
}
|
||||
}
|
||||
else if( din->vLight->pointLight )
|
||||
{
|
||||
if( din->surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowAtlas_Point_Skinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowAtlas_Point();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( din->surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowAtlas_Spot_Skinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowAtlas_Spot();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowMapping_Parallel();
|
||||
}
|
||||
}
|
||||
else if( din->vLight->pointLight )
|
||||
{
|
||||
if( din->surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowMapping_Point_Skinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowMapping_Point();
|
||||
// no shadowmap allocation possible
|
||||
if( din->surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_PBR_InteractionSkinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( din->surf->jointCache )
|
||||
// regular shadow mapping
|
||||
|
||||
if( din->vLight->parallel )
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowMapping_Spot_Skinned();
|
||||
if( din->surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowMapping_Parallel_Skinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowMapping_Parallel();
|
||||
}
|
||||
}
|
||||
else if( din->vLight->pointLight )
|
||||
{
|
||||
if( din->surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowMapping_Point_Skinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowMapping_Point();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowMapping_Spot();
|
||||
if( din->surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowMapping_Spot_Skinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_PBR_Interaction_ShadowMapping_Spot();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1297,41 +1355,97 @@ void idRenderBackend::DrawSingleInteraction( drawInteraction_t* din, bool useFas
|
|||
}
|
||||
else
|
||||
{
|
||||
if( !r_skipShadows.GetBool() && r_useShadowMapping.GetBool() && din->vLight->globalShadows && din->vLight->ImageAtlasPlaced() )
|
||||
if( !r_skipShadows.GetBool() && r_useShadowMapping.GetBool() && din->vLight->globalShadows )
|
||||
{
|
||||
// RB: we have shadow mapping enabled and shadow maps so do a shadow compare
|
||||
|
||||
if( din->vLight->parallel )
|
||||
if( r_useShadowAtlas.GetBool() )
|
||||
{
|
||||
if( din->surf->jointCache )
|
||||
if( din->vLight->ImageAtlasPlaced() )
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowMapping_Parallel_Skinned();
|
||||
if( din->vLight->parallel )
|
||||
{
|
||||
if( din->surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowAtlas_Parallel_Skinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowAtlas_Parallel();
|
||||
}
|
||||
}
|
||||
else if( din->vLight->pointLight )
|
||||
{
|
||||
if( din->surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowAtlas_Point_Skinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowAtlas_Point();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( din->surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowAtlas_Spot_Skinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowAtlas_Spot();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowMapping_Parallel();
|
||||
}
|
||||
}
|
||||
else if( din->vLight->pointLight )
|
||||
{
|
||||
if( din->surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowMapping_Point_Skinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowMapping_Point();
|
||||
// no shadowmap allocation possible
|
||||
if( din->surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_InteractionSkinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_Interaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( din->surf->jointCache )
|
||||
// regular shadow mapping
|
||||
|
||||
if( din->vLight->parallel )
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowMapping_Spot_Skinned();
|
||||
if( din->surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowMapping_Parallel_Skinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowMapping_Parallel();
|
||||
}
|
||||
}
|
||||
else if( din->vLight->pointLight )
|
||||
{
|
||||
if( din->surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowMapping_Point_Skinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowMapping_Point();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowMapping_Spot();
|
||||
if( din->surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowMapping_Spot_Skinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_Interaction_ShadowMapping_Spot();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1498,7 +1612,7 @@ void idRenderBackend::RenderInteractions( const drawSurf_t* surfList, const view
|
|||
bool lightDepthBoundsDisabled = false;
|
||||
|
||||
// RB begin
|
||||
if( !r_skipShadows.GetBool() && r_useShadowMapping.GetBool() && vLight->ImageAtlasPlaced() )
|
||||
if( !r_skipShadows.GetBool() && r_useShadowMapping.GetBool() )
|
||||
{
|
||||
const static int JITTER_SIZE = 128;
|
||||
|
||||
|
@ -1506,21 +1620,6 @@ void idRenderBackend::RenderInteractions( const drawSurf_t* surfList, const view
|
|||
float jitterSampleScale = 1.0f;
|
||||
float shadowMapSamples = r_shadowMapSamples.GetInteger();
|
||||
|
||||
// screen power of two correction factor
|
||||
float screenCorrectionParm[4];
|
||||
screenCorrectionParm[0] = 1.0f / ( JITTER_SIZE * shadowMapSamples ) ;
|
||||
screenCorrectionParm[1] = 1.0f / JITTER_SIZE;
|
||||
screenCorrectionParm[2] = 1.0f / r_shadowMapAtlasSize.GetInteger(); // atlas sample scale
|
||||
screenCorrectionParm[3] = vLight->parallel ? r_shadowMapSunDepthBiasScale.GetFloat() : r_shadowMapRegularDepthBiasScale.GetFloat();
|
||||
SetFragmentParm( RENDERPARM_SCREENCORRECTIONFACTOR, screenCorrectionParm ); // rpScreenCorrectionFactor
|
||||
|
||||
float jitterTexScale[4];
|
||||
jitterTexScale[0] = r_shadowMapJitterScale.GetFloat() * jitterSampleScale; // TODO shadow buffer size fraction shadowMapSize / maxShadowMapSize
|
||||
jitterTexScale[1] = vLight->imageSize.x / float( r_shadowMapAtlasSize.GetInteger() );
|
||||
jitterTexScale[2] = -r_shadowMapBiasScale.GetFloat();
|
||||
jitterTexScale[3] = shadowMapSamples;
|
||||
SetFragmentParm( RENDERPARM_JITTERTEXSCALE, jitterTexScale ); // rpJitterTexScale
|
||||
|
||||
float jitterTexOffset[4];
|
||||
jitterTexOffset[0] = 1.0f / globalImages->blueNoiseImage256->GetUploadWidth();
|
||||
jitterTexOffset[1] = 1.0f / globalImages->blueNoiseImage256->GetUploadWidth();
|
||||
|
@ -1547,8 +1646,23 @@ void idRenderBackend::RenderInteractions( const drawSurf_t* surfList, const view
|
|||
SetFragmentParm( RENDERPARM_CASCADEDISTANCES, cascadeDistances ); // rpCascadeDistances
|
||||
}
|
||||
|
||||
if( r_useShadowAtlas.GetBool() )
|
||||
if( r_useShadowAtlas.GetBool() && vLight->ImageAtlasPlaced() )
|
||||
{
|
||||
// screen power of two correction factor
|
||||
float screenCorrectionParm[4];
|
||||
screenCorrectionParm[0] = 1.0f / ( JITTER_SIZE * shadowMapSamples ) ;
|
||||
screenCorrectionParm[1] = 1.0f / JITTER_SIZE;
|
||||
screenCorrectionParm[2] = 1.0f / r_shadowMapAtlasSize.GetInteger(); // atlas sample scale
|
||||
screenCorrectionParm[3] = vLight->parallel ? r_shadowMapSunDepthBiasScale.GetFloat() : r_shadowMapRegularDepthBiasScale.GetFloat();
|
||||
SetFragmentParm( RENDERPARM_SCREENCORRECTIONFACTOR, screenCorrectionParm ); // rpScreenCorrectionFactor
|
||||
|
||||
float jitterTexScale[4];
|
||||
jitterTexScale[0] = r_shadowMapJitterScale.GetFloat() * jitterSampleScale; // TODO shadow buffer size fraction shadowMapSize / maxShadowMapSize
|
||||
jitterTexScale[1] = vLight->imageSize.x / float( r_shadowMapAtlasSize.GetInteger() );
|
||||
jitterTexScale[2] = -r_shadowMapBiasScale.GetFloat();
|
||||
jitterTexScale[3] = shadowMapSamples;
|
||||
SetFragmentParm( RENDERPARM_JITTERTEXSCALE, jitterTexScale ); // rpJitterTexScale
|
||||
|
||||
// float4
|
||||
idVec4 shadowOffsets[6];
|
||||
|
||||
|
@ -1560,6 +1674,23 @@ void idRenderBackend::RenderInteractions( const drawSurf_t* surfList, const view
|
|||
|
||||
SetVertexParms( RENDERPARM_SHADOW_ATLAS_OFFSET_0, &shadowOffsets[0][0], 6 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// screen power of two correction factor
|
||||
float screenCorrectionParm[4];
|
||||
screenCorrectionParm[0] = 1.0f / ( JITTER_SIZE * shadowMapSamples ) ;
|
||||
screenCorrectionParm[1] = 1.0f / JITTER_SIZE;
|
||||
screenCorrectionParm[2] = 1.0f / shadowMapResolutions[vLight->shadowLOD];
|
||||
screenCorrectionParm[3] = vLight->parallel ? r_shadowMapSunDepthBiasScale.GetFloat() : r_shadowMapRegularDepthBiasScale.GetFloat();
|
||||
SetFragmentParm( RENDERPARM_SCREENCORRECTIONFACTOR, screenCorrectionParm ); // rpScreenCorrectionFactor
|
||||
|
||||
float jitterTexScale[4];
|
||||
jitterTexScale[0] = r_shadowMapJitterScale.GetFloat() * jitterSampleScale; // TODO shadow buffer size fraction shadowMapSize / maxShadowMapSize
|
||||
jitterTexScale[1] = r_shadowMapJitterScale.GetFloat() * jitterSampleScale;
|
||||
jitterTexScale[2] = -r_shadowMapBiasScale.GetFloat();
|
||||
jitterTexScale[3] = shadowMapSamples;
|
||||
SetFragmentParm( RENDERPARM_JITTERTEXSCALE, jitterTexScale ); // rpJitterTexScale
|
||||
}
|
||||
|
||||
}
|
||||
// RB end
|
||||
|
@ -3852,7 +3983,7 @@ public:
|
|||
|
||||
void idRenderBackend::ShadowAtlasPass( const viewDef_t* _viewDef )
|
||||
{
|
||||
if( r_skipShadows.GetBool() || viewDef->viewLights == NULL )
|
||||
if( r_skipShadows.GetBool() || !r_useShadowAtlas.GetBool() || viewDef->viewLights == NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -378,15 +378,6 @@ void idRenderProgManager::Init( nvrhi::IDevice* _device )
|
|||
{ BUILTIN_INTERACTION_AMBIENT, "builtin/lighting/interactionAmbient", "", { {"USE_GPU_SKINNING", "0" }, { "USE_PBR", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION },
|
||||
{ BUILTIN_INTERACTION_AMBIENT_SKINNED, "builtin/lighting/interactionAmbient", "_skinned", { {"USE_GPU_SKINNING", "1" }, { "USE_PBR", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION },
|
||||
|
||||
{ BUILTIN_INTERACTION_SHADOW_MAPPING_SPOT, "builtin/lighting/interactionSM", "_spot", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_INTERACTION_SHADOW_MAPPING_SPOT_SKINNED, "builtin/lighting/interactionSM", "_spot_skinned", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
|
||||
{ BUILTIN_INTERACTION_SHADOW_MAPPING_POINT, "builtin/lighting/interactionSM", "_point", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_INTERACTION_SHADOW_MAPPING_POINT_SKINNED, "builtin/lighting/interactionSM", "_point_skinned", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
|
||||
{ BUILTIN_INTERACTION_SHADOW_MAPPING_PARALLEL, "builtin/lighting/interactionSM", "_parallel", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED, "builtin/lighting/interactionSM", "_parallel_skinned", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
|
||||
// PBR variants
|
||||
{ BUILTIN_PBR_INTERACTION, "builtin/lighting/interaction", "_PBR", { {"USE_GPU_SKINNING", "0" }, { "USE_PBR", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION },
|
||||
{ BUILTIN_PBR_INTERACTION_SKINNED, "builtin/lighting/interaction", "_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "USE_PBR", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION },
|
||||
|
@ -394,14 +385,44 @@ void idRenderProgManager::Init( nvrhi::IDevice* _device )
|
|||
{ BUILTIN_PBR_INTERACTION_AMBIENT, "builtin/lighting/interactionAmbient", "_PBR", { {"USE_GPU_SKINNING", "0" }, { "USE_PBR", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION },
|
||||
{ BUILTIN_PBR_INTERACTION_AMBIENT_SKINNED, "builtin/lighting/interactionAmbient", "_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "USE_PBR", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION },
|
||||
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_SPOT, "builtin/lighting/interactionSM", "_spot_PBR", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_SPOT_SKINNED, "builtin/lighting/interactionSM", "_spot_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
// regular shadow mapping
|
||||
{ BUILTIN_INTERACTION_SHADOW_MAPPING_SPOT, "builtin/lighting/interactionSM", "_spot", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_INTERACTION_SHADOW_MAPPING_SPOT_SKINNED, "builtin/lighting/interactionSM", "_spot_skinned", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_POINT, "builtin/lighting/interactionSM", "_point_PBR", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_POINT_SKINNED, "builtin/lighting/interactionSM", "_point_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_INTERACTION_SHADOW_MAPPING_POINT, "builtin/lighting/interactionSM", "_point", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_INTERACTION_SHADOW_MAPPING_POINT_SKINNED, "builtin/lighting/interactionSM", "_point_skinned", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
|
||||
{ BUILTIN_INTERACTION_SHADOW_MAPPING_PARALLEL, "builtin/lighting/interactionSM", "_parallel", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED, "builtin/lighting/interactionSM", "_parallel_skinned", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_SPOT, "builtin/lighting/interactionSM", "_spot_PBR", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_SPOT_SKINNED, "builtin/lighting/interactionSM", "_spot_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_POINT, "builtin/lighting/interactionSM", "_point_PBR", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_POINT_SKINNED, "builtin/lighting/interactionSM", "_point_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL, "builtin/lighting/interactionSM", "_parallel_PBR", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED, "builtin/lighting/interactionSM", "_parallel_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
|
||||
// shadow mapping using a big atlas
|
||||
{ BUILTIN_INTERACTION_SHADOW_ATLAS_SPOT, "builtin/lighting/interactionSM", "_atlas_spot", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_INTERACTION_SHADOW_ATLAS_SPOT_SKINNED, "builtin/lighting/interactionSM", "_atlas_spot_skinned", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
|
||||
{ BUILTIN_INTERACTION_SHADOW_ATLAS_POINT, "builtin/lighting/interactionSM", "_atlas_point", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_INTERACTION_SHADOW_ATLAS_POINT_SKINNED, "builtin/lighting/interactionSM", "_atlas_point_skinned", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
|
||||
{ BUILTIN_INTERACTION_SHADOW_ATLAS_PARALLEL, "builtin/lighting/interactionSM", "_atlas_parallel", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_INTERACTION_SHADOW_ATLAS_PARALLEL_SKINNED, "builtin/lighting/interactionSM", "_atlas_parallel_skinned", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_SPOT, "builtin/lighting/interactionSM", "_atlas_spot_PBR", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_SPOT_SKINNED, "builtin/lighting/interactionSM", "_atlas_spot_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_POINT, "builtin/lighting/interactionSM", "_atlas_point_PBR", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_POINT_SKINNED, "builtin/lighting/interactionSM", "_atlas_point_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_PARALLEL, "builtin/lighting/interactionSM", "_atlas_parallel_PBR", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_PARALLEL_SKINNED, "builtin/lighting/interactionSM", "_atlas_parallel_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL, "builtin/lighting/interactionSM", "_parallel_PBR", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
{ BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED, "builtin/lighting/interactionSM", "_parallel_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM },
|
||||
|
||||
// debug stuff
|
||||
{ BUILTIN_DEBUG_LIGHTGRID, "builtin/debug/lightgrid", "", { {"USE_GPU_SKINNING", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
|
@ -556,16 +577,25 @@ void idRenderProgManager::Init( nvrhi::IDevice* _device )
|
|||
renderProgs[builtinShaders[BUILTIN_AMBIENT_LIGHTGRID_IBL_PBR_SKINNED]].usesJoints = true;
|
||||
|
||||
renderProgs[builtinShaders[BUILTIN_SMALL_GEOMETRY_BUFFER_SKINNED]].usesJoints = true;
|
||||
|
||||
renderProgs[builtinShaders[BUILTIN_PBR_INTERACTION_SKINNED]].usesJoints = true;
|
||||
renderProgs[builtinShaders[BUILTIN_PBR_INTERACTION_AMBIENT_SKINNED]].usesJoints = true;
|
||||
|
||||
renderProgs[builtinShaders[BUILTIN_INTERACTION_SHADOW_MAPPING_SPOT_SKINNED]].usesJoints = true;
|
||||
renderProgs[builtinShaders[BUILTIN_INTERACTION_SHADOW_MAPPING_POINT_SKINNED]].usesJoints = true;
|
||||
renderProgs[builtinShaders[BUILTIN_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED]].usesJoints = true;
|
||||
|
||||
// PBR variants
|
||||
renderProgs[builtinShaders[BUILTIN_PBR_INTERACTION_SKINNED]].usesJoints = true;
|
||||
renderProgs[builtinShaders[BUILTIN_PBR_INTERACTION_AMBIENT_SKINNED]].usesJoints = true;
|
||||
renderProgs[builtinShaders[BUILTIN_INTERACTION_SHADOW_ATLAS_SPOT_SKINNED]].usesJoints = true;
|
||||
renderProgs[builtinShaders[BUILTIN_INTERACTION_SHADOW_ATLAS_POINT_SKINNED]].usesJoints = true;
|
||||
renderProgs[builtinShaders[BUILTIN_INTERACTION_SHADOW_ATLAS_PARALLEL_SKINNED]].usesJoints = true;
|
||||
|
||||
renderProgs[builtinShaders[BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_SPOT_SKINNED]].usesJoints = true;
|
||||
renderProgs[builtinShaders[BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_POINT_SKINNED]].usesJoints = true;
|
||||
renderProgs[builtinShaders[BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED]].usesJoints = true;
|
||||
|
||||
renderProgs[builtinShaders[BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_SPOT_SKINNED]].usesJoints = true;
|
||||
renderProgs[builtinShaders[BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_POINT_SKINNED]].usesJoints = true;
|
||||
renderProgs[builtinShaders[BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_PARALLEL_SKINNED]].usesJoints = true;
|
||||
// RB end
|
||||
}
|
||||
|
||||
|
|
|
@ -306,11 +306,18 @@ enum
|
|||
BUILTIN_TEXTURE_VERTEXCOLOR_SRGB,
|
||||
BUILTIN_TEXTURE_VERTEXCOLOR_SKINNED,
|
||||
BUILTIN_TEXTURE_TEXGEN_VERTEXCOLOR,
|
||||
|
||||
BUILTIN_INTERACTION,
|
||||
BUILTIN_INTERACTION_SKINNED,
|
||||
BUILTIN_INTERACTION_AMBIENT,
|
||||
BUILTIN_INTERACTION_AMBIENT_SKINNED,
|
||||
|
||||
// RB begin
|
||||
BUILTIN_PBR_INTERACTION,
|
||||
BUILTIN_PBR_INTERACTION_SKINNED,
|
||||
BUILTIN_PBR_INTERACTION_AMBIENT,
|
||||
BUILTIN_PBR_INTERACTION_AMBIENT_SKINNED,
|
||||
|
||||
BUILTIN_INTERACTION_SHADOW_MAPPING_SPOT,
|
||||
BUILTIN_INTERACTION_SHADOW_MAPPING_SPOT_SKINNED,
|
||||
BUILTIN_INTERACTION_SHADOW_MAPPING_POINT,
|
||||
|
@ -318,11 +325,6 @@ enum
|
|||
BUILTIN_INTERACTION_SHADOW_MAPPING_PARALLEL,
|
||||
BUILTIN_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED,
|
||||
|
||||
BUILTIN_PBR_INTERACTION,
|
||||
BUILTIN_PBR_INTERACTION_SKINNED,
|
||||
BUILTIN_PBR_INTERACTION_AMBIENT,
|
||||
BUILTIN_PBR_INTERACTION_AMBIENT_SKINNED,
|
||||
|
||||
BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_SPOT,
|
||||
BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_SPOT_SKINNED,
|
||||
BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_POINT,
|
||||
|
@ -330,6 +332,20 @@ enum
|
|||
BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL,
|
||||
BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED,
|
||||
|
||||
BUILTIN_INTERACTION_SHADOW_ATLAS_SPOT,
|
||||
BUILTIN_INTERACTION_SHADOW_ATLAS_SPOT_SKINNED,
|
||||
BUILTIN_INTERACTION_SHADOW_ATLAS_POINT,
|
||||
BUILTIN_INTERACTION_SHADOW_ATLAS_POINT_SKINNED,
|
||||
BUILTIN_INTERACTION_SHADOW_ATLAS_PARALLEL,
|
||||
BUILTIN_INTERACTION_SHADOW_ATLAS_PARALLEL_SKINNED,
|
||||
|
||||
BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_SPOT,
|
||||
BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_SPOT_SKINNED,
|
||||
BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_POINT,
|
||||
BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_POINT_SKINNED,
|
||||
BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_PARALLEL,
|
||||
BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_PARALLEL_SKINNED,
|
||||
|
||||
BUILTIN_DEBUG_LIGHTGRID,
|
||||
BUILTIN_DEBUG_LIGHTGRID_SKINNED,
|
||||
|
||||
|
@ -559,7 +575,32 @@ public:
|
|||
BindShader_Builtin( BUILTIN_INTERACTION_AMBIENT_SKINNED );
|
||||
}
|
||||
|
||||
// RB begin
|
||||
// PBR variantes
|
||||
|
||||
void BindShader_PBR_Interaction()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_PBR_INTERACTION );
|
||||
}
|
||||
|
||||
void BindShader_PBR_InteractionSkinned()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_PBR_INTERACTION_SKINNED );
|
||||
}
|
||||
|
||||
void BindShader_PBR_InteractionAmbient()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_PBR_INTERACTION_AMBIENT );
|
||||
}
|
||||
|
||||
void BindShader_PBR_InteractionAmbientSkinned()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_PBR_INTERACTION_AMBIENT_SKINNED );
|
||||
}
|
||||
|
||||
//
|
||||
// regular shadow mapping
|
||||
//
|
||||
|
||||
void BindShader_Interaction_ShadowMapping_Spot()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_INTERACTION_SHADOW_MAPPING_SPOT );
|
||||
|
@ -590,29 +631,6 @@ public:
|
|||
BindShader_Builtin( BUILTIN_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED );
|
||||
}
|
||||
|
||||
// PBR variantes
|
||||
|
||||
void BindShader_PBR_Interaction()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_PBR_INTERACTION );
|
||||
}
|
||||
|
||||
void BindShader_PBR_InteractionSkinned()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_PBR_INTERACTION_SKINNED );
|
||||
}
|
||||
|
||||
void BindShader_PBR_InteractionAmbient()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_PBR_INTERACTION_AMBIENT );
|
||||
}
|
||||
|
||||
void BindShader_PBR_InteractionAmbientSkinned()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_PBR_INTERACTION_AMBIENT_SKINNED );
|
||||
}
|
||||
|
||||
// RB begin
|
||||
void BindShader_PBR_Interaction_ShadowMapping_Spot()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_SPOT );
|
||||
|
@ -643,6 +661,74 @@ public:
|
|||
BindShader_Builtin( BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED );
|
||||
}
|
||||
|
||||
//
|
||||
// shadow mapping using a big atlas
|
||||
//
|
||||
|
||||
void BindShader_Interaction_ShadowAtlas_Spot()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_INTERACTION_SHADOW_ATLAS_SPOT );
|
||||
}
|
||||
|
||||
void BindShader_Interaction_ShadowAtlas_Spot_Skinned()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_INTERACTION_SHADOW_ATLAS_SPOT_SKINNED );
|
||||
}
|
||||
|
||||
void BindShader_Interaction_ShadowAtlas_Point()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_INTERACTION_SHADOW_ATLAS_POINT );
|
||||
}
|
||||
|
||||
void BindShader_Interaction_ShadowAtlas_Point_Skinned()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_INTERACTION_SHADOW_ATLAS_POINT_SKINNED );
|
||||
}
|
||||
|
||||
void BindShader_Interaction_ShadowAtlas_Parallel()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_INTERACTION_SHADOW_ATLAS_PARALLEL );
|
||||
}
|
||||
|
||||
void BindShader_Interaction_ShadowAtlas_Parallel_Skinned()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_INTERACTION_SHADOW_ATLAS_PARALLEL_SKINNED );
|
||||
}
|
||||
|
||||
void BindShader_PBR_Interaction_ShadowAtlas_Spot()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_SPOT );
|
||||
}
|
||||
|
||||
void BindShader_PBR_Interaction_ShadowAtlas_Spot_Skinned()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_SPOT_SKINNED );
|
||||
}
|
||||
|
||||
void BindShader_PBR_Interaction_ShadowAtlas_Point()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_POINT );
|
||||
}
|
||||
|
||||
void BindShader_PBR_Interaction_ShadowAtlas_Point_Skinned()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_POINT_SKINNED );
|
||||
}
|
||||
|
||||
void BindShader_PBR_Interaction_ShadowAtlas_Parallel()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_PARALLEL );
|
||||
}
|
||||
|
||||
void BindShader_PBR_Interaction_ShadowAtlas_Parallel_Skinned()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_PARALLEL_SKINNED );
|
||||
}
|
||||
|
||||
//
|
||||
// debug tools
|
||||
//
|
||||
|
||||
void BindShader_DebugLightGrid()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_DEBUG_LIGHTGRID );
|
||||
|
|
|
@ -38,8 +38,11 @@ Texture2D t_Specular : register( t1 VK_DESCRIPTOR_SET( 0 ) );
|
|||
Texture2D t_BaseColor : register( t2 VK_DESCRIPTOR_SET( 0 ) );
|
||||
Texture2D t_LightFalloff : register( t3 VK_DESCRIPTOR_SET( 0 ) );
|
||||
Texture2D t_LightProjection : register( t4 VK_DESCRIPTOR_SET( 0 ) );
|
||||
//Texture2DArray<float> t_ShadowMapArray : register( t5 VK_DESCRIPTOR_SET( 0 ) );
|
||||
#if USE_SHADOW_ATLAS
|
||||
Texture2D t_ShadowAtlas : register( t5 VK_DESCRIPTOR_SET( 0 ) );
|
||||
#else
|
||||
Texture2DArray<float> t_ShadowMapArray : register( t5 VK_DESCRIPTOR_SET( 0 ) );
|
||||
#endif
|
||||
Texture2D t_Jitter : register( t6 VK_DESCRIPTOR_SET( 0 ) );
|
||||
|
||||
SamplerState s_Material : register( s0 VK_DESCRIPTOR_SET( 1 ) ); // for the normal/specular/basecolor
|
||||
|
@ -230,7 +233,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
float receiver = shadowTexcoord.z * rpScreenCorrectionFactor.w;
|
||||
//shadowTexcoord.z = shadowTexcoord.z * 0.999991;
|
||||
//shadowTexcoord.z = shadowTexcoord.z - bias;
|
||||
//shadowTexcoord.w = float( shadowIndex );
|
||||
shadowTexcoord.w = float( shadowIndex );
|
||||
|
||||
// multiple taps
|
||||
|
||||
|
@ -383,18 +386,26 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
{
|
||||
float2 jitter = VogelDiskSample( si, numSamples, vogelPhi );
|
||||
|
||||
#if USE_SHADOW_ATLAS
|
||||
// [0 .. 1] -> rectangle in atlas transform
|
||||
float2 shadowTexcoordAtlas = shadowTexcoord.xy * rpJitterTexScale.y + rpShadowAtlasOffsets[ shadowIndex ].xy;
|
||||
|
||||
float2 shadowTexcoordJittered = shadowTexcoordAtlas + jitter * shadowTexelSize;
|
||||
|
||||
shadow += t_ShadowAtlas.SampleCmpLevelZero( s_Shadow, shadowTexcoordJittered.xy, receiver );
|
||||
#else
|
||||
float3 shadowTexcoordJittered = float3( shadowTexcoord.xy + jitter * shadowTexelSize, shadowTexcoord.w );
|
||||
|
||||
shadow += t_ShadowMapArray.SampleCmpLevelZero( s_Shadow, shadowTexcoordJittered, receiver );
|
||||
#endif
|
||||
}
|
||||
|
||||
shadow *= stepSize;
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#if USE_SHADOW_ATLAS
|
||||
float2 uvShadow;
|
||||
uvShadow.x = shadowTexcoord.x;
|
||||
uvShadow.y = shadowTexcoord.y;
|
||||
|
@ -403,6 +414,13 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
uvShadow = uvShadow * rpJitterTexScale.y + rpShadowAtlasOffsets[ shadowIndex ].xy;
|
||||
|
||||
float shadow = t_ShadowAtlas.SampleCmpLevelZero( s_Shadow, uvShadow.xy, receiver );
|
||||
#else
|
||||
float3 uvzShadow;
|
||||
uvzShadow.x = shadowTexcoord.x;
|
||||
uvzShadow.y = shadowTexcoord.y;
|
||||
uvzShadow.z = shadowTexcoord.w;
|
||||
float shadow = t_ShadowMapArray.SampleCmpLevelZero( samp2, uvzShadow, receiver );
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if( shadowIndex == 0 )
|
||||
|
|
|
@ -49,8 +49,8 @@ builtin/lighting/interaction.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_
|
|||
builtin/lighting/interaction.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1}
|
||||
builtin/lighting/interactionAmbient.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1}
|
||||
builtin/lighting/interactionAmbient.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1}
|
||||
builtin/lighting/interactionSM.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D LIGHT_POINT={0,1} -D LIGHT_PARALLEL={0,1} -D USE_PBR={0,1} -D USE_NORMAL_FMT_RGB8={0,1}
|
||||
builtin/lighting/interactionSM.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D LIGHT_POINT={0,1} -D LIGHT_PARALLEL={0,1} -D USE_PBR={0,1} -D USE_NORMAL_FMT_RGB8={0,1}
|
||||
builtin/lighting/interactionSM.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D LIGHT_POINT={0,1} -D LIGHT_PARALLEL={0,1} -D USE_PBR={0,1} -D USE_NORMAL_FMT_RGB8={0,1} -D USE_SHADOW_ATLAS={0,1}
|
||||
builtin/lighting/interactionSM.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D LIGHT_POINT={0,1} -D LIGHT_PARALLEL={0,1} -D USE_PBR={0,1} -D USE_NORMAL_FMT_RGB8={0,1} -D USE_SHADOW_ATLAS={0,1}
|
||||
builtin/lighting/shadow.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1}
|
||||
builtin/lighting/shadow.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1}
|
||||
|
||||
|
|
Loading…
Reference in a new issue