Implemented Shadow maps (still needs improvement) #314

Merged
Xenosas1337 merged 22 commits from SP3-1-Rendering into main 2023-01-16 15:40:30 +08:00
5 changed files with 4 additions and 3 deletions
Showing only changes of commit 1526176c58 - Show all commits

View File

@ -60,7 +60,7 @@ float CalcShadowValue (sampler2D shadowMap, vec4 worldSpaceFragPos, mat4 lightPV
if (fragPosLightPOV.z > sampledDepth && fragPosLightPOV.w > 0.0f) if (fragPosLightPOV.z > sampledDepth && fragPosLightPOV.w > 0.0f)
{ {
return 0.3f; return 0.0f;
} }
else else
return 1.0f; return 1.0f;

View File

@ -33,6 +33,7 @@ namespace SHADE
.maxAnisotropy = 1.0f, .maxAnisotropy = 1.0f,
.minLod = params.minLod, .minLod = params.minLod,
.maxLod = params.maxLod, .maxLod = params.maxLod,
.borderColor = vk::BorderColor::eFloatOpaqueWhite
}; };
// Create the sampler // Create the sampler

View File

@ -412,7 +412,7 @@ namespace SHADE
lightingSubSystem = resourceManager.Create<SHLightingSubSystem>(); lightingSubSystem = resourceManager.Create<SHLightingSubSystem>();
lightingSubSystem->Init(device, descPool, &resourceManager, samplerCache.GetSampler (device, SHVkSamplerParams lightingSubSystem->Init(device, descPool, &resourceManager, samplerCache.GetSampler (device, SHVkSamplerParams
{ {
// nothing for now .addressMode = vk::SamplerAddressMode::eClampToBorder,
}) })
); );

View File

@ -518,7 +518,7 @@ namespace SHADE
if (auto renderer = light.GetRenderer()) if (auto renderer = light.GetRenderer())
{ {
//SHMatrix orthoMatrix = SHMatrix::OrthographicRH() //SHMatrix orthoMatrix = SHMatrix::OrthographicRH()
renderer->UpdateDataManual(frameIndex, GetViewMatrix(&light), SHMatrix::OrthographicLH(30.0f, 30.0f, 1.0f, 50.0f)); renderer->UpdateDataManual(frameIndex, GetViewMatrix(&light), SHMatrix::OrthographicLH(10.0f, 10.0f, 1.0f, 50.0f));
} }
auto enumValue = SHUtilities::ConvertEnum(light.GetLightData().type); auto enumValue = SHUtilities::ConvertEnum(light.GetLightData().type);