This rasterizer DOES NOT USE OPENGL to draw triangles! I am using CUDA to draw triangles and do shading FROM SCRATCH, in software!
Video and full description available at http://lightspeedbanana.blogspot.com/2013/11/cuda-rasterizer.html.
Above, clockwise from upper left: Wireframe, Backfaces, Diffuse, Normals.
Above, Culling on vs. Culling Off
Above, performance on different models.
Above, I used my rasterizer to visualize the rotation field in a deforming bar. My rasterizer can render the finite-element discretization of the bar (center), and render the average rotation at each element (right).
For our research, it's important that we check for overlapping geometry. Above
is a comparison between the standard MATLAB plot and this rasterizer, visualizing overlapping bits. This is easy to do with a CUDA rasterizer, and tricky to do in MATLAB.
- Click and drag (camera move)
- WASD (camera move)
- Q and E (zoom in and out)
- L (draw lines on top of shading)
- H (toggle shading on and off)
- C (toggle color interpolation on and off. This will average colors at faces rather than interpolate them, IF we are using normals as a "hack" to draw face colors).
- T (toggle sampling step size. Larger step is faster, but produces artifacts. Reason why is we need to sample tris below the Nyquist limit).
- B toggle backface culling.
- Press 8 for 1984 mode (wireframe, green on black!)
- Press K to write a yellow pixel to the buffer when two triangles are drawn on top of each other. This works bets when we use a LARGER step (see #7) for sampling.
Credits:
- Interactive camera is mostly based on my Pathtracer's interactive camera, which is based on my CIS277 interactive camera.
- Some commented out code is from some snippets from http://sol.gfxile.net/tri/index.html. The sort I did myself without looking at the code there. The gradient calculation I did steal (but that's basically the only way to calculate gradient, and it's also three lines). The pseudocode/algorithm description is what I did, but that's something I did myself, since a full implementation isn't on that blog post.
- Got the line-drawing algorithm from CIS560 slides.
- Base code from CIS565/Karl Li/Liam Boone.


