Skip to content

Commit

Permalink
Shadow bias range for easier edit
Browse files Browse the repository at this point in the history
  • Loading branch information
Benualdo committed Oct 16, 2024
1 parent 96c4c55 commit 185820c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/renderer/Instance/Light/LightInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace vg::renderer

bool m_shadow = false;
core::float2 m_shadowRange = core::float2(0.1f, 100.0f);
float m_shadowBias = 0.001f;
float m_shadowBias = 0.01f;
core::uint2 m_shadowSize = core::uint2(16, 16);
core::uint2 m_shadowResolution = core::uint2(1024, 1024);
float m_shadowIntensity = 1.0f;
Expand Down
12 changes: 9 additions & 3 deletions src/renderer/Instance/Light/LightInstance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,22 @@ namespace vg::renderer
registerPropertyOptionalGroupBegin(LightDesc, m_shadow, "Shadow Settings");
{
registerProperty(LightDesc, m_shadowRange, "Range");
setPropertyRange(LightDesc, m_shadowRange, float2(0.0f, 256.0f));
setPropertyRange(LightDesc, m_shadowRange, float2(0.0f, 1000.0f));
setPropertyDescription(LightDesc, m_shadowRange, "Max shadow distance");

registerProperty(LightDesc, m_shadowBias, "Bias");
setPropertyRange(LightDesc, m_shadowBias, float2(0.0001f, 0.01f));
setPropertyRange(LightDesc, m_shadowBias, float2(0.0f, 1.0f));
setPropertyDescription(LightDesc, m_shadowBias, "Bias shadow distance");

registerProperty(LightDesc, m_shadowSize, "Size");
setPropertyDescription(LightDesc, m_shadowSize, "Shadow map size in world-space");

registerProperty(LightDesc, m_shadowResolution, "Resolution");
setPropertyDescription(LightDesc, m_shadowResolution, "Shadow map resolution in pixels");

registerProperty(LightDesc, m_shadowIntensity, "Shadow Intensity");
setPropertyRange(LightDesc, m_shadowIntensity, float2(0.0f, 1.0f));
setPropertyDescription(LightDesc, m_shadowIntensity, "Amound of light occluded in shadowed areas");
}
registerPropertyOptionalGroupEnd(LightDesc);

Expand Down Expand Up @@ -72,7 +78,7 @@ namespace vg::renderer
{
m_shadow = _lightDesc->m_shadow;
m_shadowRange = _lightDesc->m_shadowRange;
m_shadowBias = _lightDesc->m_shadowBias;
m_shadowBias = _lightDesc->m_shadowBias * 0.01f;
m_shadowSize = _lightDesc->m_shadowSize;
m_shadowResolution = _lightDesc->m_shadowResolution;
m_shadowIntensity = m_shadow ? _lightDesc->m_shadowIntensity : 0.0f;
Expand Down

0 comments on commit 185820c

Please sign in to comment.