voxel rendering on mobile devices
TRANSCRIPT
VOXEL RENDERING
VOXEL RENDERINGon mobile devices
GOALSMobile devices
Interactive (realtime rotation and slicing)Real world data set (MRI and other scanners)Smooth
INPUT DATADICOM packed MRI scanner output217 x 181 x 181 (>7 millions) points of intensity valuesSame amount of masks (layers) dataTable with masks descriptions (up to 255 values)
APPROACHESUses a large number of very small graphic objectsOne small object (point in our case) is one quad, i.e. two triangles on four vertices217 x 181 x 181 x 4 = 28436548 vertices. Too much, even for the newest iPad
Simple set of texels with three dimensionsNot supported on target platforms
Complicated technique of model ray casting to generate 2D projectionHeavy usage of CPU resources
PARTICLE SYSTEM3D TEXTURERAY CASTING VOLUME RENDERING
ALTERNATIVE APPROACH. GOALSReduce geometry size (number of vertices)Reduce CPU usageIt should be easy to implementScalable for other features, like slicing and colored layering
SOLUTIONGenerate sets of axis aligned textures for each axis (217 + 181 + 181 = 579 quads = 2316 vertices)Each texture can have up to 4 channels (RGBA), so we need to use them as much as possibleWe have to use dirty tricks and magic
TEXTURES AND GEOMETRY GENERATIONNeed to generate quads and textures for each of axisTrivial task, especially for geometry. Three simple loops
We have 4 channels at our disposal, so use them all!First channel is for intensity of MRI pointsSecond channel is for indexed layer coloringThird and fourth channels are for slicing
1st ROUND RESULTSNice solid rendered brainIndexed dynamic layer coloring. For recoloring of brain section we just need to change one texel in palette textureAxis-dependent slicing could be set with cutoff material parameter, that works with third and fourth channels2316 draw calls and 7109137 fragment shader calls. Its still quite a lot for a target device. Time for tricks!
OPTIMIZATION. PART 1Batch! Batch! Batch!For reducing draw calls we need to minimize material switches. Now we have 2316 materials, each is for every slice.For example Z-axis has 181 textures with size 217x181. Overwhelming majority of mobile devices can support textures of size 2048 x 2048. Its enough for group small slices in two atlases.181 => 2! Not bad! Now we have only 6 materials and potentially 6 draw calls
OPTIMIZATION. PART 2It all depends on your point of viewWe dont need to render all of quads sets for any particular position of cameraDepending on the position of the camera, we will turn on or off those sets dynamicallyAccording to our experience only one or two sets at the moment could be shown without visible changes2-4 draw calls. We cheated! You almost didnt notice anything!
OPTIMIZATION. PART 3Save your fillrateOur quads contains of huge amount of useless transparent areas around actual dataWe need to refuse quads and use more suitable custom geometry for each slice of brain
THE ENDTHANK [email protected]