Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
iMSTK
iMSTK
Commits
ab38797d
Commit
ab38797d
authored
Jan 14, 2021
by
Furkan Dinç
Committed by
Sreekanth Arikatla
Jun 07, 2021
Browse files
Screen space ambient occlusion effect added
parent
c435ef5e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Source/Rendering/VTKRenderer/imstkVTKRenderer.cpp
View file @
ab38797d
...
...
@@ -48,6 +48,11 @@
#include
<vtkOpenVRRenderer.h>
#include
<vtkOpenVRCamera.h>
#include
<vtkShadowMapBakerPass.h>
#include
<vtkShadowMapPass.h>
#include
<vtkSequencePass.h>
#include
<vtkCameraPass.h>
#include
<vtkRenderPassCollection.h>
namespace
imstk
{
...
...
@@ -226,6 +231,11 @@ VTKRenderer::VTKRenderer(std::shared_ptr<Scene> scene, const bool enableVR) :
axisY
->
SetGridVisible
(
false
);
axisY
->
SetCustomTickPositions
(
xIndices
,
labels
);
}
// Prepare screen space ambient occlusion effect
vtkNew
<
vtkRenderStepsPass
>
basicPasses
;
ssao
->
SetDelegatePass
(
basicPasses
);
}
void
...
...
@@ -382,6 +392,12 @@ VTKRenderer::getTimeTableVisibility() const
return
m_timeTableChartActor
->
GetVisibility
();
}
ssaoConfig
VTKRenderer
::
getSSAOConfig
()
const
{
return
m_config
->
m_ssaoConfig
;
}
void
VTKRenderer
::
updateCamera
()
{
...
...
@@ -610,4 +626,30 @@ VTKRenderer::updateBackground(const Vec3d backgroundOne, const Vec3d backgroundT
m_vtkRenderer
->
GradientBackgroundOff
();
}
}
void
VTKRenderer
::
updateSSAOConfig
(
ssaoConfig
config
)
{
m_config
->
m_ssaoConfig
=
config
;
// update config
ssao
->
SetRadius
(
config
.
m_SSAORadius
);
// comparison radius
ssao
->
SetBias
(
config
.
m_SSAOBias
);
// comparison bias
ssao
->
SetKernelSize
(
config
.
m_KernelSize
);
// number of samples used
if
(
config
.
m_SSAOBlur
)
{
ssao
->
BlurOn
();
// blur occlusion
}
else
{
ssao
->
BlurOff
();
// do not blur occlusion
}
if
(
config
.
m_enableSSAO
)
{
m_vtkRenderer
->
SetPass
(
ssao
);
}
else
{
m_vtkRenderer
->
SetPass
(
NULL
);
}
}
}
// imstk
Source/Rendering/VTKRenderer/imstkVTKRenderer.h
View file @
ab38797d
...
...
@@ -27,6 +27,8 @@
#include
"imstkEventObject.h"
#include
<vtkSmartPointer.h>
#include
<vtkRenderStepsPass.h>
#include
<vtkSSAOPass.h>
#include
<unordered_map>
#include
<unordered_set>
...
...
@@ -102,6 +104,11 @@ public:
///
bool
getTimeTableVisibility
()
const
;
///
/// \brief Update SSAO options
///
ssaoConfig
getSSAOConfig
()
const
;
///
/// \brief Updates the camera
///
...
...
@@ -127,6 +134,11 @@ public:
///
void
updateBackground
(
const
Vec3d
color1
,
const
Vec3d
color2
=
Vec3d
::
Zero
(),
const
bool
gradientBackground
=
false
);
///
/// \brief Update SSAO options
///
void
updateSSAOConfig
(
ssaoConfig
config
);
protected:
///
/// \brief Remove actors (also called props) from the scene
...
...
@@ -210,5 +222,8 @@ protected:
vtkSmartPointer
<
vtkTable
>
m_timeTable
;
vtkPlotBar
*
m_timeTablePlot
;
int
m_timeTableIter
=
0
;
// SSAO Effect
vtkNew
<
vtkSSAOPass
>
ssao
;
};
}
Source/Rendering/imstkRenderer.h
View file @
ab38797d
...
...
@@ -27,12 +27,24 @@
namespace
imstk
{
struct
ssaoConfig
{
bool
m_enableSSAO
=
false
;
bool
m_SSAOBlur
=
false
;
// blur occlusion
double
m_SSAORadius
=
0.1
;
// comparison radius
double
m_SSAOBias
=
0.001
;
// comparison bias
unsigned
int
m_KernelSize
=
128
;
// number of samples used
};
struct
rendererConfig
{
bool
m_enableVR
=
false
;
Color
m_BGColor1
=
Color
(
0.3285
,
0.3285
,
0.6525
);
Color
m_BGColor2
=
Color
(
0.13836
,
0.13836
,
0.2748
);
// ScreenSpace Ambient Occlusion
ssaoConfig
m_ssaoConfig
;
};
///
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment