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
90d7d405
Commit
90d7d405
authored
3 years ago
by
Alexander Gauggel
Browse files
Options
Downloads
Patches
Plain Diff
[
#106
] Add motion blur early out for barely moving pixels
parent
fe9de4d9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!89
Resolve "Indirect Dispatch"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
projects/indirect_dispatch/resources/shaders/motionBlurDummy.comp
+10
-0
10 additions, 0 deletions
.../indirect_dispatch/resources/shaders/motionBlurDummy.comp
projects/indirect_dispatch/src/App.cpp
+9
-4
9 additions, 4 deletions
projects/indirect_dispatch/src/App.cpp
with
19 additions
and
4 deletions
projects/indirect_dispatch/resources/shaders/motionBlurDummy.comp
+
10
−
0
View file @
90d7d405
...
...
@@ -11,6 +11,7 @@ layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
layout( push_constant ) uniform constants{
// computed from delta time and shutter speed
float motionFactor;
float minVelocity;
};
...
...
@@ -24,6 +25,15 @@ void main(){
vec2 uv = vec2(coord) / textureRes;
vec2 motion = texture(sampler2D(inMotion, textureSampler), uv).rg;
float velocity = length(motion);
// early out on little movement
if(velocity < minVelocity){
vec3 color = texture(sampler2D(inColor, textureSampler), uv).rgb;
imageStore(outImage, coord, vec4(color, 0.f));
return;
}
motion *= motionFactor;
vec3 color = vec3(0);
...
...
This diff is collapsed.
Click to expand it.
projects/indirect_dispatch/src/App.cpp
+
9
−
4
View file @
90d7d405
...
...
@@ -101,8 +101,9 @@ void App::run() {
eDebugView
debugView
=
eDebugView
::
None
;
eMotionBlurInput
motionBlurInput
=
eMotionBlurInput
::
MotionVectorMaxTileNeighbourhood
;
float
objectVerticalSpeed
=
0.005
;
int
cameraShutterSpeedInverse
=
48
;
float
objectVerticalSpeed
=
0.005
;
float
motionBlurMinVelocity
=
0.001
;
int
cameraShutterSpeedInverse
=
48
;
glm
::
mat4
mvpPrevious
=
glm
::
mat4
(
1.
f
);
glm
::
mat4
viewProjectionPrevious
=
m_cameraManager
.
getActiveCamera
().
getMVP
();
...
...
@@ -285,8 +286,11 @@ void App::run() {
const
float
fDeltatimeSeconds
=
microsecondToSecond
*
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
frameEndTime
-
frameStartTime
).
count
();
const
float
motionBlurMotionFactor
=
1
/
(
fDeltatimeSeconds
*
cameraShutterSpeedInverse
);
vkcv
::
PushConstants
motionBlurPushConstants
(
sizeof
(
float
));
motionBlurPushConstants
.
appendDrawcall
(
motionBlurMotionFactor
);
vkcv
::
PushConstants
motionBlurPushConstants
(
sizeof
(
float
)
*
2
);
float
motionBlurConstantData
[
2
]
=
{
motionBlurMotionFactor
,
motionBlurMinVelocity
};
motionBlurPushConstants
.
appendDrawcall
(
motionBlurConstantData
);
m_core
.
recordComputeDispatchToCmdStream
(
cmdStream
,
...
...
@@ -350,6 +354,7 @@ void App::run() {
ImGui
::
InputFloat
(
"Object movement speed"
,
&
objectVerticalSpeed
);
ImGui
::
InputInt
(
"Camera shutter speed inverse"
,
&
cameraShutterSpeedInverse
);
ImGui
::
DragFloat
(
"Motion blur min velocity"
,
&
motionBlurMinVelocity
,
0.01
,
0
,
1
);
ImGui
::
End
();
gui
.
endGUI
();
...
...
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