Forum

DX11 Colouring Array of Objects by Volume Texture

Attached is a functioning patch, thanks to Vux and Antokhio for their help, going to look at voxaliser now :)

wish I’d seen that earlier! hehe

VolumeSampling (137.1 kB)

quoting vux:…To voxelize mesh it’s also quite easy, even tho bit slower, so works best with static elements:

Send your triangles as structured buffer to compute shader (normalized to 0-1 space)
For each voxel/triangle compute the signed distance from that (do a batch or n triangles per frame to avoid timeout, or flush the context). Sign is given by triangle normal so make sure you have good normals it's primordial.
Store minimum distance in the volume (absolute minimum but keep track of the sign)
Now you have a volume with signed distance field
Use buffer renderer with append flag to remove any positive value in volume (to only keep voxel inside the model). If you only want the shell, do a small threshold on absolute value.
Render as indirect with cubes

can someone show me how to do it? i constantly fail…

ran into microdees mups pack. then read this and got totally lost: http://http.developer.nvidia.com/GPUGems3/gpugems3_ch34.html

thx!