This repository contains assignments for a course in Scientific Visualization, implemented in C and OpenGL. It demonstrates several visualization techniques including marching cubes, ray casting, Line Integral Convolution, Sammon mapping, and Self-Organizing Maps (SOM).
This project explores several scientific visualization techniques through a series of assignments:
- HW1: Iso-surface — Marching Cubes — Extracting iso-surfaces from volumetric data.
- HW2: Ray Casting — Direct volume rendering using ray tracing techniques.
- HW3: Line Integral Convolution (LIC) — Visualizing vector fields with texture-based methods.
- HW4: Sammon Mapping — Mapping scalar fields onto surfaces.
- HW5: Self-Organizing Maps (SOM) — Dimensionality reduction and clustering visualization.
Implemented the Marching Cubes algorithm to extract iso-surfaces from volumetric data.
- Support for multiple iso-values and line/fill rendering modes
- Camera control and normal vector calculation options
- Cross-section and slice visualization features
- Histogram panel for iso-value selection with log2 transformation
- Allows switching between displaying the Original Histogram or the Log2-transformed Histogram.
The log2-transformed histogram makes it easier to identify appropriate iso-value regions. - Each dataset has a predefined iso-value, when Line Mode and Multiple Iso-surface are enabled, the colors of the lines on the histogram correspond to the iso-values of the surfaces.
- Adjust the camera position.
- Choose between two normal vector computation methods: Triangle Normals or Gradient Normals.
- Select between two polygon modes: Fill Mode or Line Mode.
- Enable Multiple Iso-surface display, and choose which surfaces to show (up to 3 surfaces; you can display one, two, or all three simultaneously).
Line Mode provides clearer visualization of the surfaces. - Enable Cross Section, which offers two functions: Cross Section or Slice. You can select the direction of the cross section or slice and adjust its position.
- Select different datasets to visualize.
Switching datasets takes significant time due to recomputing the triangles.
Implemented direct volume rendering using ray casting accelerated by GPU.
- Adjustable ray step gap for performance/quality tradeoff
- Phong shading mode support
- Interactive camera manipulation
- Color transfer function editor for dynamic visualization
- Adjust the camera position.
- Adjust the Ray Casting Gap Size, which controls the sampling interval during ray tracing.
- Enable or disable Phong Shading Mode for enhanced surface shading.
- Configure the Transfer Function for color and opacity mapping.
- Add new color segments by inputting colors and defining ranges.
- Remove the most recently added color segment.
Visualized 2D vector fields by convolving noise textures along streamlines using LIC.
- Support for different noise types: black & white, gray-scale, spot noise
- Multiple convolution kernels: box filter, tent filter
- Color mode based on relative velocity magnitude
- Side-by-side display of noise and LIC results
- Select different Noise Types.
- Select different Convolution Filter.
- Adjust the Convolution Mask Size(Convolution Kernel Size).
- Enable Color Display Mode, where colors represent relative velocity magnitudes.
- The left panel shows the visualization result.
- The right panel shows the noise texture.
Dimensionality reduction and visualization using Sammon mapping.
Implemented Self-Organizing Map (SOM) trained on cylindrical lattices to generate a vase-shaped structure.
- Adaptive learning rate
- Dynamic neighborhood layers decreasing over iterations
The SOM training process uses the following parameters and rules:
-
Learning Rate
The learning rate at each iteration is computed as:
delta = 0.01 * exp(-iteration / max_iteration)
-
Neighborhood Layers
The number of neighborhood layers
t
depends on the current iteration:if iteration > max_iteration / 2 then t = 1 else if iteration > max_iteration / 5 then t = 2 else if iteration > max_iteration / 10 then t = 3 else t = 4
-
Neighborhood Function
The influence of a node at distance
d
is computed as:r(d) = 1.0 / sqrt(d)
- Visual Studio 2022 or later
- OpenGL 3.3 or higher support
-
header/
Contains project-specific header files such asshader.h
,glad.h
, andimgui.h
. -
include/
Contains third-party libraries headers includingGLFW
,KHR
,glad
, andglm
. -
lib-vc2022/
Contains precompiled.lib
files required for linking (compatible with Visual Studio 2022).
- Open Visual Studio and select Open Folder, then choose this project’s root directory.
- In Visual Studio, add
header/
andinclude/
folders to the Additional Include Directories in the project properties. - Make sure OpenGL and GLFW libraries are installed on your system. Link the necessary
.lib
files in the Linker settings. - Build and run the project.
- Each homework assignment is located in a separate folder; open and run the desired assignment accordingly.