Updated shadow implementation #335
|
@ -60,7 +60,7 @@ float CalcShadowValue (sampler2D shadowMap, vec4 worldSpaceFragPos, mat4 lightPV
|
|||
|
||||
if (fragPosLightPOV.z > sampledDepth && fragPosLightPOV.w > 0.0f)
|
||||
{
|
||||
return 0.0f;
|
||||
return 0.7f;
|
||||
}
|
||||
else
|
||||
return 1.0f;
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,10 @@
|
|||
#version 450
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
#extension GL_ARB_shading_language_420pack : enable
|
||||
#extension GL_EXT_nonuniform_qualifier : require
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
Name: ShadowMap_FS
|
||||
ID: 45925790
|
||||
Type: 2
|
|
@ -128,6 +128,7 @@ namespace SHADE
|
|||
SHFreetypeInstance::Init();
|
||||
|
||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/DeferredComposite_CS.glsl", false);
|
||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMap_FS.glsl", false);
|
||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false);
|
||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/SSAOBlur_CS.glsl", false);
|
||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/PureCopy_CS.glsl", false);
|
||||
|
@ -137,6 +138,7 @@ namespace SHADE
|
|||
//SHAssetManager::CompileAsset("../../Assets/Shaders/UI_FS.glsl", false);
|
||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/Text_VS.glsl", false);
|
||||
|
||||
|
||||
// Load Built In Shaders
|
||||
static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEFAULT);
|
||||
static constexpr AssetID VS_ANIM = 47911992; animtVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_ANIM);
|
||||
|
@ -152,6 +154,7 @@ namespace SHADE
|
|||
static constexpr AssetID RENDER_SC_VS = 48082949; renderToSwapchainVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(RENDER_SC_VS);
|
||||
static constexpr AssetID RENDER_SC_FS = 36869006; renderToSwapchainFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(RENDER_SC_FS);
|
||||
static constexpr AssetID SHADOW_MAP_VS = 44646107; shadowMapVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_VS);
|
||||
static constexpr AssetID SHADOW_MAP_FS = 45925790; shadowMapFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_FS);
|
||||
|
||||
}
|
||||
|
||||
|
@ -583,14 +586,21 @@ namespace SHADE
|
|||
#endif
|
||||
}
|
||||
|
||||
//if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::B))
|
||||
//{
|
||||
// auto& lightComps = SHComponentManager::GetDense<SHLightComponent>();
|
||||
static bool shadowAdded = false;
|
||||
|
||||
if (shadowAdded == false/* && SHInputManager::GetKey(SHInputManager::SH_KEYCODE::B)*/)
|
||||
{
|
||||
shadowAdded = true;
|
||||
auto& lightComps = SHComponentManager::GetDense<SHLightComponent>();
|
||||
if (lightComps.size() > 2)
|
||||
{
|
||||
lightComps[2].SetEnableShadow(true);
|
||||
}
|
||||
//for (auto& comp : lightComps)
|
||||
//{
|
||||
// comp.SetEnableShadow(true);
|
||||
//}
|
||||
//}
|
||||
}
|
||||
|
||||
renderGraph->Begin(frameIndex);
|
||||
auto cmdBuffer = renderGraph->GetCommandBuffer(frameIndex);
|
||||
|
@ -809,11 +819,11 @@ namespace SHADE
|
|||
tempLibrary.Init(device);
|
||||
tempLibrary.CreateGraphicsPipelines
|
||||
(
|
||||
{ shadowMapVS, {} }, shadowMapNode->GetRenderpass(), newSubpass,
|
||||
{ shadowMapVS, shadowMapFS }, shadowMapNode->GetRenderpass(), newSubpass,
|
||||
SHGraphicsPredefinedData::SystemType::BATCHING,
|
||||
SHGraphicsPredefinedData::GetShadowMapViState(), rasterState
|
||||
);
|
||||
shadowMapPipeline = tempLibrary.GetGraphicsPipeline({ shadowMapVS, {} });
|
||||
shadowMapPipeline = tempLibrary.GetGraphicsPipeline({ shadowMapVS, shadowMapFS });
|
||||
}
|
||||
newSubpass->SetCompanionSubpass(companionSubpass, shadowMapPipeline); // set companion subpass and pipeline
|
||||
|
||||
|
|
|
@ -469,6 +469,7 @@ namespace SHADE
|
|||
Handle<SHVkShaderModule> renderToSwapchainVS;
|
||||
Handle<SHVkShaderModule> renderToSwapchainFS;
|
||||
Handle<SHVkShaderModule> shadowMapVS;
|
||||
Handle<SHVkShaderModule> shadowMapFS;
|
||||
|
||||
// Fonts
|
||||
Handle<SHFont> testFont;
|
||||
|
|
Loading…
Reference in New Issue