lundi 29 juin 2015

How do I get started with a GPU voxelizer?


I've been reading various articles about how to write a GPU voxelizer. From my understanding the process goes like this:

  1. Inspect the triangles individually and decide the axis that displays the triangle in the largest way. Call this the dominant axis.
  2. Render the triangle on its dominant axis and sample the texels that come out.
  3. Write that texel data onto a 3D texture and then do what you will with the data

Disregarding conservative rasterization, I have a lot of questions regarding this process.

I've gotten as far as rendering each triangle, choosing a dominant axis and orthogonally projecting it. What should the values of the orthogonal projection be? Should it be some value based around the size of the voxels or how large of an area the map should cover?

What am I supposed to do in the fragment shader? How do I write to my 3D texture such that it stores the voxel data? From my understanding, due to choosing the dominant axis we can't have more than a depth of 1 voxel for each fragment. However, since we projected orthogonally I don't see how that would reflect onto the 3D texture.

Finally, I am wondering on where to store the texture data. I know it's a bad idea to store data CPU side since you have to pass it all in to use it on the GPU, however the sourcecode I am kind of following chooses to store all its texture on the CPU side, such as those for a light map. My assumption is that data that will only be used on the GPU should be stored there and data used on both should be stored on the CPU side of things. So, from this I store my data on the CPU side. Is that correct?

My main sources have been: http://ift.tt/1NuxKwa OpenGL Insights http://ift.tt/1NuxKwc A SVO using a voxelizer. The issue is that the shader code is not in the github.


Aucun commentaire:

Enregistrer un commentaire