Advanced Tutorial Visualization 3D Path Tracer

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.

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.

MR Image of Knee

MR Image of Knee in 2D

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.

SoPathTracerVolume & SoPathTracer

SoPathTracerVolume & SoPathTracer

If you check your SoExaminerViewer you will see a black box. We need to define a LUT for the grey values first.

SoExaminerViewer

SoExaminerViewer

Now connect the SoLUTEditor module to your SoPathTracerVolume as illustrated down bellow and you will be able to see the knee.

SoLUTEditor

SoLUTEditor

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.

SoLUTEditor

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.

Lights

Lights

Open the panel of the SoPathTracerBackgroundLight module and choose your three colors.

SoPathTracerBackgroundLight

SoPathTracerBackgroundLight

Manually define LUT

Either define your desired colors for your LUT in the Editor tab manually as shown down below.

LUT

LUT

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.

LUTLoad

LUTLoad

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.

SoPathTracerMaterial

SoPathTracerMaterial

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.

Bones mask

Bones mask

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.

MinMaxScan of Bones mask

MinMaxScan of Bones mask

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.

SoLUTEditor1

SoLUTEditor1

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.

SoPathTracerMaterial1

SoPathTracerMaterial1

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.

Vessels mask

Vessels mask

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.

Vessels

MinMaxScan of Vessels mask

SoLUTEditor2

SoLUTEditor2

Now you should set your first volume visible again by toggeling SoPathTracerVolume Enabled field to on.

Final Resul

Final Result

Final Resul

Final Result with Enhanced Visualization

Summary:

  • You can achieve photorealistic renderings using SoPathTracer and associated modules.
  • Render volumes efficiently in SoPathTracer scenes with SoPathTracerVolume, enabling diverse rendering options, LUT adjustments, lights and material enhancements.
  • Enhance your scene’s look by adjusting materials and colors interactively using SoPathTracerMaterial and SoLUTEditor.
  • Use lighting modules such as SoPathTracerAreaLight and SoPathTracerBackgroundLight to optimize the illumination of your rendered scenes.