Graphics: Fix point light shadowmaps

This commit is contained in:
SirLynix 2022-12-08 18:28:17 +01:00
parent f8238a6e6c
commit 780359eb8b
2 changed files with 3 additions and 4 deletions

View File

@ -217,7 +217,6 @@ fn main(input: VertToFrag) -> FragOut
const sampleCount = 4; const sampleCount = 4;
const offset = 0.005; const offset = 0.005;
const bias = 0.05;
const invSampleCount = 1.0 / f32(sampleCount); const invSampleCount = 1.0 / f32(sampleCount);
const start = vec3[f32](offset * 0.5, offset * 0.5, offset * 0.5); const start = vec3[f32](offset * 0.5, offset * 0.5, offset * 0.5);
@ -237,8 +236,8 @@ fn main(input: VertToFrag) -> FragOut
let depth = shadowMapsCube[i].Sample(sampleDir).r; let depth = shadowMapsCube[i].Sample(sampleDir).r;
depth = LinearizeDepth(depth, 0.01, lightRadius); depth = LinearizeDepth(depth, 0.01, lightRadius);
if (depth > dist - bias) if (depth > dist)
shadowFactor += shadowContribution; shadowFactor += shadowContribution;
} }
} }

View File

@ -192,7 +192,7 @@ namespace Nz
auto& textureEntry = m_textureBindingCache.emplace_back(); auto& textureEntry = m_textureBindingCache.emplace_back();
textureEntry.texture = texture; textureEntry.texture = texture;
textureEntry.sampler = shadowSampler.get(); textureEntry.sampler = defaultSampler.get(); //< cube shadowmap don't use depth compare
} }
auto& bindingEntry = m_bindingCache.emplace_back(); auto& bindingEntry = m_bindingCache.emplace_back();