Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VkCV Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vulkan2021
VkCV Framework
Commits
76d71b4b
Commit
76d71b4b
authored
3 years ago
by
Alexander Gauggel
Browse files
Options
Downloads
Patches
Plain Diff
[
#82
] Light bleeding reduction
parent
92241173
No related branches found
No related tags found
1 merge request
!70
Resolve "Voxel cone tracing"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projects/voxelization/resources/shaders/shadowMapping.inc
+13
-2
13 additions, 2 deletions
projects/voxelization/resources/shaders/shadowMapping.inc
with
13 additions
and
2 deletions
projects/voxelization/resources/shaders/shadowMapping.inc
+
13
−
2
View file @
76d71b4b
...
@@ -35,7 +35,7 @@ float ComputeMSMShadowIntensity(vec4 _4Moments, float FragmentDepth, float Depth
...
@@ -35,7 +35,7 @@ float ComputeMSMShadowIntensity(vec4 _4Moments, float FragmentDepth, float Depth
vec4
(
0.0
));
vec4
(
0.0
));
float
Quotient
=
(
Switch
[
0
]
*
z
[
2
]
-
b
[
0
]
*
(
Switch
[
0
]
+
z
[
2
])
+
b
[
1
])
float
Quotient
=
(
Switch
[
0
]
*
z
[
2
]
-
b
[
0
]
*
(
Switch
[
0
]
+
z
[
2
])
+
b
[
1
])
/
((
z
[
2
]
-
Switch
[
1
])
*
(
z
[
0
]
-
z
[
1
]));
/
((
z
[
2
]
-
Switch
[
1
])
*
(
z
[
0
]
-
z
[
1
]));
return
clamp
(
Switch
[
2
]
+
Switch
[
3
]
*
Quotient
,
0
,
1
);
return
1
-
clamp
(
Switch
[
2
]
+
Switch
[
3
]
*
Quotient
,
0
,
1
);
}
}
vec4
quantizeMoments
(
vec4
moments
){
vec4
quantizeMoments
(
vec4
moments
){
...
@@ -59,6 +59,16 @@ vec4 unquantizeMoments(vec4 moments){
...
@@ -59,6 +59,16 @@ vec4 unquantizeMoments(vec4 moments){
return
T
*
moments
;
return
T
*
moments
;
}
}
float
rescaleRange
(
float
a
,
float
b
,
float
v
)
{
return
clamp
((
v
-
a
)
/
(
b
-
a
),
0
,
1
);
}
float
reduceLightBleeding
(
float
shadow
,
float
amount
)
{
return
rescaleRange
(
amount
,
1.0
f
,
shadow
);
}
float
shadowTest
(
vec3
worldPos
,
LightInfo
lightInfo
,
texture2D
shadowMap
,
sampler
shadowMapSampler
,
vec2
offset
){
float
shadowTest
(
vec3
worldPos
,
LightInfo
lightInfo
,
texture2D
shadowMap
,
sampler
shadowMapSampler
,
vec2
offset
){
vec4
lightPos
=
lightInfo
.
lightMatrix
*
vec4
(
worldPos
,
1
);
vec4
lightPos
=
lightInfo
.
lightMatrix
*
vec4
(
worldPos
,
1
);
lightPos
/=
lightPos
.
w
;
lightPos
/=
lightPos
.
w
;
...
@@ -78,7 +88,8 @@ float shadowTest(vec3 worldPos, LightInfo lightInfo, texture2D shadowMap, sample
...
@@ -78,7 +88,8 @@ float shadowTest(vec3 worldPos, LightInfo lightInfo, texture2D shadowMap, sample
float
depthBias
=
0.
f
;
float
depthBias
=
0.
f
;
float
momentBias
=
0.00005
;
float
momentBias
=
0.00005
;
return
1
-
ComputeMSMShadowIntensity
(
shadowMapSample
,
lightPos
.
z
,
depthBias
,
momentBias
);
float
shadow
=
ComputeMSMShadowIntensity
(
shadowMapSample
,
lightPos
.
z
,
depthBias
,
momentBias
);
return
reduceLightBleeding
(
shadow
,
0.1
f
);
}
}
#endif // #ifndef SHADOW_MAPPING_INC
#endif // #ifndef SHADOW_MAPPING_INC
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment