improved shadow bias
This commit is contained in:
@@ -593,7 +593,7 @@ inline void TiledLighting(inout Surface surface, inout Lighting lighting, uint f
|
||||
half radius = entity.GetRange() * CAPSULE_SHADOW_BOLDEN;
|
||||
half occ = directionalOcclusionCapsule(surface.P, A, B, radius, cone);
|
||||
|
||||
// attenutaion based on capsule-sphere:
|
||||
// attenuation based on capsule-sphere:
|
||||
float3 center = lerp(A, B, 0.5);
|
||||
half range = distance(center, A) + radius + CAPSULE_SHADOW_AFFECTION_RANGE;
|
||||
half range2 = range * range;
|
||||
|
||||
@@ -209,12 +209,12 @@ inline half3 shadow_2D(in ShaderEntity light, in float z, in float2 shadow_uv, i
|
||||
{
|
||||
shadow_uv.x += cascade;
|
||||
shadow_uv = mad(shadow_uv, light.shadowAtlasMulAdd.xy, light.shadowAtlasMulAdd.zw);
|
||||
return sample_shadow(shadow_uv, z, shadow_border_clamp(light, cascade), light.GetType() == ENTITY_TYPE_RECTLIGHT ? (half2(light.GetRadius(), light.GetLength()) * 0.05) : light.GetRadius(), pixel);
|
||||
return sample_shadow(shadow_uv, z, shadow_border_clamp(light, cascade), light.GetType() == ENTITY_TYPE_RECTLIGHT ? (half2(light.GetRadius(), light.GetLength()) * 0.025) : light.GetRadius(), pixel);
|
||||
}
|
||||
|
||||
inline half3 shadow_cube(in ShaderEntity light, in float3 Lunnormalized, min16uint2 pixel = 0)
|
||||
{
|
||||
const float remapped_distance = light.GetCubemapDepthRemapNear() + light.GetCubemapDepthRemapFar() / (max(max(abs(Lunnormalized.x), abs(Lunnormalized.y)), abs(Lunnormalized.z)) * 0.989); // little bias to avoid artifact
|
||||
const float remapped_distance = light.GetCubemapDepthRemapNear() + light.GetCubemapDepthRemapFar() / (max(max(abs(Lunnormalized.x), abs(Lunnormalized.y)), abs(Lunnormalized.z)));
|
||||
const float3 uv_slice = cubemap_to_uv(-Lunnormalized);
|
||||
float2 shadow_uv = uv_slice.xy;
|
||||
shadow_uv.x += uv_slice.z;
|
||||
|
||||
@@ -1444,6 +1444,7 @@ namespace dx12_internal
|
||||
{
|
||||
struct PSO_STREAM1
|
||||
{
|
||||
CD3DX12_PIPELINE_STATE_STREAM_FLAGS Flags;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_VS VS;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_HS HS;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_DS DS;
|
||||
@@ -4049,6 +4050,7 @@ std::mutex queue_locker;
|
||||
pso->desc = *desc;
|
||||
|
||||
auto& stream = internal_state->stream;
|
||||
//stream.stream1.Flags |= D3D12_PIPELINE_STATE_FLAG_DYNAMIC_DEPTH_BIAS; // doesn't work on windows 10
|
||||
if (pso->desc.vs != nullptr)
|
||||
{
|
||||
auto shader_internal = to_internal(pso->desc.vs);
|
||||
|
||||
@@ -2200,7 +2200,7 @@ void SetUpStates()
|
||||
{
|
||||
rs.depth_bias = -1000;
|
||||
}
|
||||
rs.slope_scaled_depth_bias = -4.0f;
|
||||
rs.slope_scaled_depth_bias = -6.0f;
|
||||
rs.depth_bias_clamp = 0;
|
||||
rs.depth_clip_enable = false;
|
||||
rs.multisample_enable = false;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace wi::version
|
||||
// minor features, major updates, breaking compatibility changes
|
||||
const int minor = 71;
|
||||
// minor bug fixes, alterations, refactors, updates
|
||||
const int revision = 775;
|
||||
const int revision = 776;
|
||||
|
||||
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user