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
Merge requests
!70
Resolve "Voxel cone tracing"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Voxel cone tracing"
82-voxel-cone-tracing
into
develop
Overview
7
Commits
95
Pipelines
67
Changes
1
Merged
Ghost User
requested to merge
82-voxel-cone-tracing
into
develop
3 years ago
Overview
7
Commits
95
Pipelines
67
Changes
1
Expand
Closes
#82 (closed)
Edited
3 years ago
by
Tobias Frisch
0
0
Merge request reports
Viewing commit
b0690281
Prev
Next
Show latest version
1 file
+
65
−
57
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
b0690281
[
#82
] Add UI toggle
· b0690281
Alexander Gauggel
authored
3 years ago
projects/voxelization/src/main.cpp
+
65
−
57
Options
@@ -363,6 +363,13 @@ int main(int argc, const char** argv) {
}
});
bool
renderUI
=
true
;
window
.
e_key
.
add
([
&
renderUI
](
int
key
,
int
scancode
,
int
action
,
int
mods
)
{
if
(
key
==
GLFW_KEY_I
&&
action
==
GLFW_PRESS
)
{
renderUI
=
!
renderUI
;
}
});
// tonemapping compute shader
vkcv
::
ShaderProgram
tonemappingProgram
;
compiler
.
compile
(
vkcv
::
ShaderStage
::
COMPUTE
,
"resources/shaders/tonemapping.comp"
,
@@ -663,67 +670,68 @@ int main(int argc, const char** argv) {
// draw UI
gui
.
beginGUI
();
ImGui
::
Begin
(
"Settings"
);
ImGui
::
Checkbox
(
"MSAA custom resolve"
,
&
msaaCustomResolve
);
ImGui
::
DragFloat2
(
"Light angles"
,
&
lightAnglesDegree
.
x
);
ImGui
::
ColorEdit3
(
"Sun color"
,
&
lightColor
.
x
);
ImGui
::
DragFloat
(
"Sun strength"
,
&
lightStrength
);
ImGui
::
DragFloat
(
"Max shadow distance"
,
&
maxShadowDistance
);
maxShadowDistance
=
std
::
max
(
maxShadowDistance
,
1.
f
);
ImGui
::
ColorEdit3
(
"Sky color"
,
&
skySettings
.
color
.
x
);
ImGui
::
DragFloat
(
"Sky strength"
,
&
skySettings
.
strength
,
0.1
);
ImGui
::
Checkbox
(
"Draw voxel visualisation"
,
&
renderVoxelVis
);
ImGui
::
SliderInt
(
"Visualisation mip"
,
&
voxelVisualisationMip
,
0
,
7
);
ImGui
::
DragFloat
(
"Voxelization extent"
,
&
voxelizationExtent
,
1.
f
,
0.
f
);
voxelizationExtent
=
std
::
max
(
voxelizationExtent
,
1.
f
);
voxelVisualisationMip
=
std
::
max
(
voxelVisualisationMip
,
0
);
ImGui
::
ColorEdit3
(
"Scattering color"
,
&
scatteringColor
.
x
);
ImGui
::
DragFloat
(
"Scattering density"
,
&
scatteringDensity
,
0.0001
);
ImGui
::
ColorEdit3
(
"Absorption color"
,
&
absorptionColor
.
x
);
ImGui
::
DragFloat
(
"Absorption density"
,
&
absorptionDensity
,
0.0001
);
ImGui
::
DragFloat
(
"Volumetric ambient"
,
&
volumetricAmbient
,
0.002
);
if
(
ImGui
::
Button
(
"Reload forward pass"
))
{
vkcv
::
ShaderProgram
newForwardProgram
;
compiler
.
compile
(
vkcv
::
ShaderStage
::
VERTEX
,
std
::
filesystem
::
path
(
"resources/shaders/shader.vert"
),
[
&
](
vkcv
::
ShaderStage
shaderStage
,
const
std
::
filesystem
::
path
&
path
)
{
newForwardProgram
.
addShader
(
shaderStage
,
path
);
});
compiler
.
compile
(
vkcv
::
ShaderStage
::
FRAGMENT
,
std
::
filesystem
::
path
(
"resources/shaders/shader.frag"
),
[
&
](
vkcv
::
ShaderStage
shaderStage
,
const
std
::
filesystem
::
path
&
path
)
{
newForwardProgram
.
addShader
(
shaderStage
,
path
);
});
forwardPipelineConfig
.
m_ShaderProgram
=
newForwardProgram
;
vkcv
::
PipelineHandle
newPipeline
=
core
.
createGraphicsPipeline
(
forwardPipelineConfig
);
if
(
newPipeline
)
{
forwardPipeline
=
newPipeline
;
if
(
renderUI
)
{
ImGui
::
Begin
(
"Settings"
);
ImGui
::
Checkbox
(
"MSAA custom resolve"
,
&
msaaCustomResolve
);
ImGui
::
DragFloat2
(
"Light angles"
,
&
lightAnglesDegree
.
x
);
ImGui
::
ColorEdit3
(
"Sun color"
,
&
lightColor
.
x
);
ImGui
::
DragFloat
(
"Sun strength"
,
&
lightStrength
);
ImGui
::
DragFloat
(
"Max shadow distance"
,
&
maxShadowDistance
);
maxShadowDistance
=
std
::
max
(
maxShadowDistance
,
1.
f
);
ImGui
::
ColorEdit3
(
"Sky color"
,
&
skySettings
.
color
.
x
);
ImGui
::
DragFloat
(
"Sky strength"
,
&
skySettings
.
strength
,
0.1
);
ImGui
::
Checkbox
(
"Draw voxel visualisation"
,
&
renderVoxelVis
);
ImGui
::
SliderInt
(
"Visualisation mip"
,
&
voxelVisualisationMip
,
0
,
7
);
ImGui
::
DragFloat
(
"Voxelization extent"
,
&
voxelizationExtent
,
1.
f
,
0.
f
);
voxelizationExtent
=
std
::
max
(
voxelizationExtent
,
1.
f
);
voxelVisualisationMip
=
std
::
max
(
voxelVisualisationMip
,
0
);
ImGui
::
ColorEdit3
(
"Scattering color"
,
&
scatteringColor
.
x
);
ImGui
::
DragFloat
(
"Scattering density"
,
&
scatteringDensity
,
0.0001
);
ImGui
::
ColorEdit3
(
"Absorption color"
,
&
absorptionColor
.
x
);
ImGui
::
DragFloat
(
"Absorption density"
,
&
absorptionDensity
,
0.0001
);
ImGui
::
DragFloat
(
"Volumetric ambient"
,
&
volumetricAmbient
,
0.002
);
if
(
ImGui
::
Button
(
"Reload forward pass"
))
{
vkcv
::
ShaderProgram
newForwardProgram
;
compiler
.
compile
(
vkcv
::
ShaderStage
::
VERTEX
,
std
::
filesystem
::
path
(
"resources/shaders/shader.vert"
),
[
&
](
vkcv
::
ShaderStage
shaderStage
,
const
std
::
filesystem
::
path
&
path
)
{
newForwardProgram
.
addShader
(
shaderStage
,
path
);
});
compiler
.
compile
(
vkcv
::
ShaderStage
::
FRAGMENT
,
std
::
filesystem
::
path
(
"resources/shaders/shader.frag"
),
[
&
](
vkcv
::
ShaderStage
shaderStage
,
const
std
::
filesystem
::
path
&
path
)
{
newForwardProgram
.
addShader
(
shaderStage
,
path
);
});
forwardPipelineConfig
.
m_ShaderProgram
=
newForwardProgram
;
vkcv
::
PipelineHandle
newPipeline
=
core
.
createGraphicsPipeline
(
forwardPipelineConfig
);
if
(
newPipeline
)
{
forwardPipeline
=
newPipeline
;
}
}
}
if
(
ImGui
::
Button
(
"Reload tonemapping"
))
{
vkcv
::
ShaderProgram
newProgram
;
compiler
.
compile
(
vkcv
::
ShaderStage
::
COMPUTE
,
std
::
filesystem
::
path
(
"resources/shaders/tonemapping.comp"
),
[
&
](
vkcv
::
ShaderStage
shaderStage
,
const
std
::
filesystem
::
path
&
path
)
{
newProgram
.
addShader
(
shaderStage
,
path
);
});
vkcv
::
PipelineHandle
newPipeline
=
core
.
createComputePipeline
(
newProgram
,
{
core
.
getDescriptorSet
(
tonemappingDescriptorSet
).
layout
});
if
(
newPipeline
)
{
tonemappingPipeline
=
newPipeline
;
if
(
ImGui
::
Button
(
"Reload tonemapping"
))
{
vkcv
::
ShaderProgram
newProgram
;
compiler
.
compile
(
vkcv
::
ShaderStage
::
COMPUTE
,
std
::
filesystem
::
path
(
"resources/shaders/tonemapping.comp"
),
[
&
]
(
vkcv
::
ShaderStage
shaderStage
,
const
std
::
filesystem
::
path
&
path
)
{
newProgram
.
addShader
(
shaderStage
,
path
)
;
}
);
vkcv
::
PipelineHandle
newPipeline
=
core
.
createComputePipeline
(
newProgram
,
{
core
.
getDescriptorSet
(
tonemappingDescriptorSet
).
layout
});
if
(
newPipeline
)
{
tonemappingPipeline
=
newPipeline
;
}
}
ImGui
::
End
();
}
ImGui
::
End
();
gui
.
endGUI
();
core
.
endFrame
();
Loading