So Im trying to implement a Volume Renderer mainly for medical images like CT-scans and MRI images using GPU raymarching. I'm using the book "Real Time Volume Graphics" and this tutorial as a refernce.
I'm trying to render only grayscale images as a start. I understand that the
pvm2raw part gives us an 8-bit raw file so each voxel has the isovalue in the range [0-255]. So I decided map this single value on all color channels
rgba when taking a sample.
As you can see the lobster dataset stretches when viewed from the side. My first guess was that I wasn't accounting for the aspect ratio correctly. I have tried scaling the Bounding box to account for the aspect ratio, then adjusting the stepsize according to that. I've also tried to ignore aspect ratio altogether. Both give similar images.
I tried rendering more datasets like "Knee", "Bruce's head", "DTI Scan", etc but those didn't even gave an image. There was just random noise everywhere. Here's an example of "Bruce's head"
This happens with both uniform and non-uniform datasets. If some datasets are getting rendered correctly like the "Foot" in my video, this should mean it's more a with that specific dataset itself rather the core algorithm. Nonetheless the link to the code is provided If anybody can point out some mistakes I'd be grateful.
The link to the Compute shader is here. Main functions are
rayMarchVolume. I didn't scale the root bounding box to the dimensions of the volume, it's normalized
(0-1), accounted for the aspect ratio
(0, ar) and adjusted so it's in the center
(-ar/2, ar/2). The function
cartesianToTextureCoord(vec4 point) accounts for this fact and returns a texture coord in the range 0-1
EDIT:- If you are hesitating to post an answer here since it's only a suggestion, you can post on Reddit, then when the problem is solved you can post your answer here
UPDATE:- I've provided a release to this project on github. If anybody is willing to help me with this, he can download the release and run the program. Since the algorithm is based entirely inside the compute shader you can change the file easily and test your findings on the spot. Thanks.