brown-ccv / VR-Volumeviewer

A simple viewer for visualizing volumetric datasets
3 stars 0 forks source link

Evaluate ray step size on ray cast rendering. #59

Open kmilo9999 opened 2 years ago

kmilo9999 commented 2 years ago

Previous implementations made a correlation between the ray step size and the number of slices in the volume (how fast the ray should penetrate the volume). This was causing artifacts at the moment of clipping the volume on different axis. Some slices changes from valid data to zero too quick, making the ray stopping its march too soon. To compensate for this, the step size was changed to a constant value (0.01). Maybe future data will need the step size depending on the number of slices. This needs to be revaluated, maybe having a UI checkbox that switches between the two modes.

void VolumeRaycastRenderer::set_num_slices(int slices)
{
  shader.set_stepSize(0.01, 0.01, 0.01);
  // TODO:  Camilo Thinks this is not necessary for ray casting volume rendering.
  // we only need step size.
  // shader.set_stepSize(1.0f / slices, 1.0f / slices, 1.0f / slices);
}