Example 6.2: Visualization using SoPathTracer
Introduction
In this tutorial, we will explain the basics of using the SoPathTracer
module in MeVisLab. You will learn how to create a scene, assign materials, add light sources, and configure the PathTracer to generate enhanced renderings.
The MeVis Path Tracer requires an NVIDIA graphics card with CUDA support. In order to check your hardware, open MeVisLab and add a SoPathTracer
module to your workspace. You will see a message if your hardware does not support CUDA:
MeVisLab detected an Intel onboard graphics adapter. If you experience rendering problems, try setting the environment variables SOVIEW2D_NO_SHADERS and GVR_NO_GLSL.
Handling cudaGetDeviceCount returned 35 (CUDA driver version is insufficient for CUDA runtime version)
Steps to do
Develop your network
Download and open the images by using a LocalImage
module. Connect it to a View2D
to visually inspect its contents.
Replace the View2D
module by a SoExaminerViewer
. Add the modules SoPathTracerVolume
and SoPathTracer
to your workspace and connect them as seen below.
The SoPathTracerVolume
enables the loading and transforming the data into renderable volumes for Path Tracing. The SoPathTracer
is the main rendering module of the MeVis Path Tracer framework. It provides a much more realistic way to visualize the behavior of light in a scene. It simulates the scattering and absorption of light within the volume.
SoPathTracer
module on the right side of the scene. This strategic placement ensures that the module can render all objects located in the scene before it accurately.If you check your SoExaminerViewer
you will see a black box. We need to define a LUT for the grey values first.
Now connect the SoLUTEditor
module to your SoPathTracerVolume
as illustrated down bellow and you will be able to see the knee.
Add a MinMaxScan
module to the LocalImage
module and open the panel. The module shows the minimal and maximal grey values of the volume.
Open the panel of the SoLUTEditor
module and define Range between 0 and 2047 as calculated by the MinMaxScan
.
Next, add lights to your scene. Connect a SoPathTracerAreaLight
and a SoPathTracerBackgroundLight
module to your SoExaminerViewer
to improve scene lighting.
The SoPathTracerAreaLight
module provides a physically based area light that illuminates the scene of a SoPathTracer
. The lights can be rectangular or discs and have an area, color and intensity. They can be positioned with spherical coordinates around the bounding box of the renderer, or they can be position in world or camera space.
The SoPathTracerBackgroundLight
module provides a background light for the SoPathTracer
. It supports setting a top, middle and bottom color or alternatively it support image based lighting (IBL) using a sphere or cube map. Only one background light can be active for a given SoPathTracer
.
Open the panel of the SoPathTracerBackgroundLight
module and choose your three colors.
Manually define LUT
Either define your desired colors for your LUT in the Editor tab manually as shown down below.
Load example LUT from file
As an alternative, you can replace the SoLUTEditor
with a LUTLoad
and load this XML file to use a pre-defined LUT.
Now, let’s enhance your rendering further by using the SoPathTracerMaterial
module. This module provides essential material properties for geometry and volumes within the SoPathTracer
scene.
Add a SoPathTracerMaterial
module to your SoPathTracerVolume
. Open it’s panel and navigate to the tab Surface Brdf. Change the Diffuse color for altering the visual appearance of surfaces. The Diffuse color determines how light interacts with the surface, influencing its overall color and brightness. Set Specular to 0.5, Shininess to 1.0 and Specular Intensity to 0.5.
SoExaminerViewer
might look different, depending on your defined LUT.Visualize Bones
If you want to visualize multiple volumes at the same time, you need to add another SoPathTracerVolume
and LocalImage
for loading the mask to the SoExaminerViewer
.
As the LUT of the second volume also differs, add another SoLUTEditor
module or LUTLoad
module to the new SoPathTracerVolume
.
For later usage, you can also already add a SoPathTracerMaterial
module to the SoPathTracerVolume
module.
Load the Bones mask by using the new LocalImage
module and preview it in a View2D
.
Start by disabling the visibility of your first volume by toggeling SoPathTracerVolume
Enabled field to off. This helps improve the rendering of the bones itself and makes it easier to define colors for your LUT.
Load example LUT from file
Once again, you can decide to define the LUT yourself in SoLUTEditor
module, or load a prepared XML File in a LUTLoad
module as provided here.
Manually define LUT
If you want to define your own LUT, connect a MinMaxScan
module to your LocalImage1
and define Range for the SoLUTEditor
as already done before.
Open the panel of SoLUTEditor1
for the bones and go to tab Range and set New Range Min to 0 and New Range Max to 127. Define the following colors in tab Editor.
You can increase the Shininess of the bones and change the Diffuse color in the Surface Brdf tab within the SoPathTracerMaterial1
. Also set Specular to 0.5, Shininess to 0.904 and Specular Intensity to 0.466.
Visualize Vessels
Repeat the process for the vessels. Add another LocalImage
, SoPathTracerVolume
, SoLUTEditor
(or LUTLoad
) and View2D
module as seen below. Load this Vessels mask and check it using View2D
.
Load example LUT from file
Load a prepared XML File in a LUTLoad
module as provided here
Manually define LUT
Connect the MinMaxScan
to your LocalImage2
.
Access the SoLUTEditor2
panel in the tab Range and set the New Range Min to 0 and the New Range Max to 255. Additionally, modify the illustrated color settings within the Editor tab.
Now you should set your first volume visible again by toggeling SoPathTracerVolume
Enabled field to on.
SoExaminerViewer
might look different, depending on your defined LUTs.Summary:
- You can achieve photorealistic renderings using
SoPathTracer
and associated modules. - Render volumes efficiently in
SoPathTracer
scenes withSoPathTracerVolume
, enabling diverse rendering options, LUT adjustments, lights and material enhancements. - Enhance your scene’s look by adjusting materials and colors interactively using
SoPathTracerMaterial
andSoLUTEditor
. - Use lighting modules such as
SoPathTracerAreaLight
andSoPathTracerBackgroundLight
to optimize the illumination of your rendered scenes.