In yesterday's post, I introduced my new hobby project Photon Mapping Voxels. Today, I made some more progress, and managed to properly interpolate the shading. The voxel faces in a plane now share vertices. But there is still a matter of ambiguity when shading a quad, which causes the triangle seam to show in the middle of the quad. To alleviate this issue, I added a center vertex in the middle of the quad, and render it as 4 triangles, instead of just 2. The results are below. The animated gif cycles through four renderings: quads, triangles, triangles in wireframe, quads in wireframe. As you can see, there are less discontinuities in the triangle version, at the cost of more vertices, and double the triangles.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghqRmX-iJTXuXB-R94Z9wb0HAZKmWw_IgaLVWDpcBXR6zxZxL5HtjrgSb2-j99cgZSStFPuRoAxgRWEDhvfDZdthjlOBVpq2tq3d3ZHZD24SCk4BnO9wMTcPhdKxxyEReIzRHm_dcXAKoc/s1600/photons.gif)
Again, this is direct light only. I am getting excited about seeing it with indirect light (bounces) and also colour. Currently, all photons and all voxels are white. Also on the todo list: make it really fast by doing SIMD intersection tests: a ray versus 8 voxels in a single go. This requires AVX though, probably AVX2 even.
When doing the AVX2 implementation, min/max across a vector will come in handy. Here is a SIMD horizontal min or max: http://stackoverflow.com/questions/23590610/find-index-of-maximum-element-in-x86-simd-vector
ReplyDelete