I'm currently looking into an algorithm described within this research paper, however I've come across a portion which I'm unclear of how it's been achieved.
A grid is defined by placing a camera above the scene and adjusting its view frustum to enclose the area to be voxelized. This camera has an associated viewport with (w, h ) dimensions. The scene is then rendered, constructing the voxelization in the frame buffer. A pixel (i,j) represents a column in the grid and each voxel within this column is binary encoded using the k th bit of the RGBA value of the pixel. Therefore, the corresponding image represents a w×h×32 grid with one bit of information per voxel. This bit indicates whether a primitive passes through a cell or not. The union of voxels corresponding to the kth bit for all pixels defines a slice. Consequently, the image/texture encoding the grid is called a slicemap . When a primitive is rasterized, a set of fragments are obtained. A fragment shader is used in order to determine the position of the fragment in the column based on its depth. The result is then OR−ed with the current value of the frame buffer.
Presumably one would achieve this by setting the blend equation to use a binary-OR, however that's not an available option and I can't see a way to achieve it through manipulation of glBlendFunc()+glBlendEquation()
Additionally from my understanding it's not possible to read the framebuffer within the fragment shader. You can bind a texture to both the shader and framebuffer, however accessing this within the shader is undefined behaviour due to a lack of synchronisation.
The paper doesn't state whether OpenGL or Direct-X was used, however to the best of my understanding it has the same glBlendEquation() limitations.
Am I missing something?
I realise I could simply achieve the same result in 32 passes.