CaffeineViking / vkhr

Real-Time Hybrid Hair Rendering using Vulkan™
MIT License
446 stars 34 forks source link

Generate the Min/Max MIP Volume #35

Closed CaffeineViking closed 5 years ago

CaffeineViking commented 5 years ago

We want to generate two mip-hierarchies from the volume, one for the min and one for the max. We'll use this to find e.g. silhouette areas in screen-space (by finding the correct mip-level that translates to one pixel). We can find these mip-volumes by iteratively downsampling the volume at level-N, beginning at level-0, that is our original volume (e.g. 256^3 voxelization). This downsampling happens by taking the 2x2x2 max/min of the previous level. e.g. min(v[i,j,k], v[i+1,j,k], v[i,j+1,k],...,v[i+1,j+1,k+1]) (a total of 8 voxels).

CaffeineViking commented 5 years ago

I'll start by doing this on the CPU-side so we can sanity-check the results we get. Then I can do it in a shader.