[feature] Volume rendering scissors cropping
One approach is to run a double pass volume rendering that will allow us to do some volume rendering on irregular shapes.
However there are limitation with "convex shapes" and any advice on the right approach would be very much appreciated!
Current experiments: https://drive.google.com/file/d/1-Xxs7lJ3GOYsoqckbzsyKrsjMJ1m0jA6/view
Another approach is to edit the voxel values then push the new voxels back to the shader. Will not be real time but 2-3s delay may be OK.
The most robust (not fastest) approach seem to be the following: 1- Draw ROI to be cropped 2- If voxels of the data belong to ROI, change intensity to "background" color. // we assume the background will be transparent 3- Perform regular volume rendering
Other faster approaches (double pass + irregular mesh shape) seem to have more limitations but may be fine for basic use cases
@NicolasRannou Thank you, it seems very interesting. Do you guys already have some piece of code to play with it?
Let me check if there is something around - however be warned that is pure testing/investigation code :)
Some quick notes:
The approach there was to modify the shape of the base object that is volume renderered, then perform a 2 pass volume rendering on this new shape.
We use ThreeJS helpers to generate a convex geometry that is then "cropped out" of the stack with the "three-csg" library.
As you will see it works well on some limited cases that may not be enough.
My idea was that a the we can not just get away with using "CSG" + "double pass" VR and that a better (read more robust but slower) approach is to:
1- generate a geometry we want to "crop out" - (current approach with ray casting + large bbox seems ok, need to generate concave + convex shapes though)
2- for all voxels in our stack, test if it belong to the new geometry or not.
3- if it belongs to the geometry, then we want to exclude it and we change its value to "background" color?
4- Pack new texture with updated voxel values and push it to shaders
Lot of questions to be answered, happy to use this thread for discussion / work on it! Will be a killer feature when ready!
yarn example vr_crop
