mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-12-28 18:41:14 +00:00
filter-sdf-effects: Improve shadow rendering
This works around the incorrect shadow on the edge of the Signed Distance Field, but it does not get rid of it completely. Due to linear sampling it will still show at some point so a different solution has to be found in the future.
This commit is contained in:
parent
ecd17cff6c
commit
9b4edc8fb0
1 changed files with 3 additions and 3 deletions
|
@ -32,7 +32,7 @@ sampler_state sdfSampler1_1 {
|
|||
Filter = Linear;
|
||||
AddressU = Border;
|
||||
AddressV = Border;
|
||||
BorderColor = FFFF0000;
|
||||
BorderColor = 000000FF;
|
||||
};
|
||||
|
||||
sampler_state imageSampler {
|
||||
|
@ -106,7 +106,7 @@ float4 PS_SDFShadow_v1_1(VertDataOut v_in) : TARGET
|
|||
|
||||
//! Outer Shadow
|
||||
// Are we allowed to draw an outer shadow?
|
||||
float2 outer_sdf = _sdf.Sample(sdfSampler, v_in.uv + _outer_offset).rg * float2(MAX_DISTANCE, MAX_DISTANCE);
|
||||
float2 outer_sdf = _sdf.Sample(sdfSampler1_1, v_in.uv + _outer_offset).rg * float2(MAX_DISTANCE, MAX_DISTANCE);
|
||||
if ((_outer_color.a > 0.) && (outer_sdf.r < MAX_DISTANCE)) {
|
||||
// Calculate the true distance value:
|
||||
// - If we are outside, this will be positive.
|
||||
|
@ -129,7 +129,7 @@ float4 PS_SDFShadow_v1_1(VertDataOut v_in) : TARGET
|
|||
|
||||
//! Inner Shadow
|
||||
// Are we allowed to draw an inner shadow?
|
||||
float2 inner_sdf = _sdf.Sample(sdfSampler, v_in.uv + _inner_offset).rg * float2(MAX_DISTANCE, MAX_DISTANCE);
|
||||
float2 inner_sdf = _sdf.Sample(sdfSampler1_1, v_in.uv + _inner_offset).rg * float2(MAX_DISTANCE, MAX_DISTANCE);
|
||||
if ((_inner_color.a > 0.) && (inner_sdf.g < MAX_DISTANCE) && (inner_sdf.r <= FLT_SMALL)) {
|
||||
// Calculate the true distance value:
|
||||
// - If we are outside, this will be positive.
|
||||
|
|
Loading…
Reference in a new issue