mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 06:07:54 +02:00
Disabled broken PCF and reset back to previous bias
This commit is contained in:
parent
44393f12d9
commit
0044759196
3 changed files with 17 additions and 2 deletions
|
@ -18,6 +18,12 @@ std::string LightStage::_stageName { "LIGHT_STAGE"};
|
||||||
LightStage::LightStage() {
|
LightStage::LightStage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LightStage::Shadow::Schema::Schema() :
|
||||||
|
bias{ 0.005f },
|
||||||
|
scale{ 1.0f / MAP_SIZE } {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
LightStage::Shadow::Shadow(model::LightPointer light) : _light{ light}, _frustum{ std::make_shared<ViewFrustum>() } {
|
LightStage::Shadow::Shadow(model::LightPointer light) : _light{ light}, _frustum{ std::make_shared<ViewFrustum>() } {
|
||||||
framebuffer = gpu::FramebufferPointer(gpu::Framebuffer::createShadowmap(MAP_SIZE));
|
framebuffer = gpu::FramebufferPointer(gpu::Framebuffer::createShadowmap(MAP_SIZE));
|
||||||
map = framebuffer->getDepthStencilBuffer();
|
map = framebuffer->getDepthStencilBuffer();
|
||||||
|
|
|
@ -60,17 +60,21 @@ public:
|
||||||
|
|
||||||
gpu::FramebufferPointer framebuffer;
|
gpu::FramebufferPointer framebuffer;
|
||||||
gpu::TexturePointer map;
|
gpu::TexturePointer map;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
model::LightPointer _light;
|
model::LightPointer _light;
|
||||||
std::shared_ptr<ViewFrustum> _frustum;
|
std::shared_ptr<ViewFrustum> _frustum;
|
||||||
|
|
||||||
class Schema {
|
class Schema {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
Schema();
|
||||||
|
|
||||||
glm::mat4 projection;
|
glm::mat4 projection;
|
||||||
glm::mat4 viewInverse;
|
glm::mat4 viewInverse;
|
||||||
|
|
||||||
glm::float32 bias = 0.003f;
|
glm::float32 bias;
|
||||||
glm::float32 scale = 1 / MAP_SIZE;
|
glm::float32 scale;
|
||||||
};
|
};
|
||||||
UniformBufferView _schemaBuffer = nullptr;
|
UniformBufferView _schemaBuffer = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,8 @@ vec2 PCFkernel[4] = vec2[4](
|
||||||
);
|
);
|
||||||
|
|
||||||
float evalShadowAttenuationPCF(vec4 position, vec4 shadowTexcoord) {
|
float evalShadowAttenuationPCF(vec4 position, vec4 shadowTexcoord) {
|
||||||
|
// PCF is buggy so disable it for the time being
|
||||||
|
#if 0
|
||||||
float pcfRadius = 3.0;
|
float pcfRadius = 3.0;
|
||||||
float shadowScale = getShadowScale();
|
float shadowScale = getShadowScale();
|
||||||
|
|
||||||
|
@ -80,6 +82,9 @@ float evalShadowAttenuationPCF(vec4 position, vec4 shadowTexcoord) {
|
||||||
fetchShadow(shadowTexcoord.xyz + shadowScale * vec3(offset + PCFkernel[2], 0.0)) +
|
fetchShadow(shadowTexcoord.xyz + shadowScale * vec3(offset + PCFkernel[2], 0.0)) +
|
||||||
fetchShadow(shadowTexcoord.xyz + shadowScale * vec3(offset + PCFkernel[3], 0.0))
|
fetchShadow(shadowTexcoord.xyz + shadowScale * vec3(offset + PCFkernel[3], 0.0))
|
||||||
));
|
));
|
||||||
|
#else
|
||||||
|
float shadowAttenuation = fetchShadow(shadowTexcoord.xyz);
|
||||||
|
#endif
|
||||||
|
|
||||||
return shadowAttenuation;
|
return shadowAttenuation;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue