volume rendering of large data by packing texture

497 views Asked by At

I want to implement GPU-based ray casting volume rendering of large data sets which are larger than GPU memory. I try to do like this:

(1)Firstly I divide the volume into bricks with equal size.

(2)Then I decide if each brick is transparent or not according the transfer function.

(3)Then I store the non-transparent brick into a "Packed-Texture".In order to sample during ray casting rendering,I create another texture called "Index-Texture" which store the brick index in Packed-Texture.

When I do sampling during rendering in the shader, Firstly I calculate in which brick the sample point is.And then I access the Index-Texture to get the value of the sample point.But in default the value is after interpolated, and is not correctly the index of brick in the Packed-Texture.

So,my question is:when do sampling during ray casting rendering,how to get the index of brick (in which the sample point is) in Packed-Texture from the Index-Texture correctly?

1

There are 1 answers

1
datenwolf On

This is not really a problem, say your volume cube goes from [0, 1]³ and you split it into, say 8 blocks into each direction. Then multiply the fractional coordinate with 8 (or whatever) and round down to the nearest integer, which gives you the index. After rounding down you subtract the index from the scaled fractional coordinate, which gives you the fractional position in the sub-block, i.e.

volcube_pos = volcube_frac_pos * volcube_blocks;
volcube_index = (int)floor(volcube_pos);
subblock_pos = volcube_pos - volcube_index;

Now all these blocks have to be stored somewhere. Putting them into a regular, packed 3D texture requires, that you disable filtering, take care about the fencepost problem ( https://stackoverflow.com/a/5879551/524368 ) and do all filtering interpolation yourself.

Another approach instead of packed textures, I'm going to look into myself – as it happens I'm working on volume rendering myself right now – is using NVidia's bindless textures.