About rasterizer:

This project implements the standard rasterized graphics pipeline similar to OpenGL pipeline. To complete the pipeline, I implemented vertex shader, primitive assembly, perspective transformation, rasterizer, and fragment shader.

Vertex Shader & Primitive Assembly
I started coding for CUDA rasterizer on Monday this week. But all  thanks to Sandy, I lost my power by midnight. BY that time I finished my vertex shader and primitive assembly. They were straight forward.

I used following blogs for the implementation: http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/

 On thursday morning, yes thats when my light came back, I started working on rasterization step. It took me 2 days to complete it.

 The major difficulty I was facing was that my code kept crashing for resolution greater than 200 by 200. Its still not working for more than 400 by 400. Also, when I implemented atomics in the code, Visual studio was not able to recognize any of the atomic functions. The reason was that I was using CUDA 4.2 instead of CUDA 4.0. Hence , I change the setting in projectProperties->CUDA->Device-> code generation to sm_20 instead of sm_10.

Fragment Shader
Now, I have implemented fragment shader as well.

But the phong highlight is not very apparent from the image. May be due to the resolution. But, I would not worry about the resolution for now. First I will complete the other functionality.
I can set the resolution of 800 by 800 for the cow but not for the cube.

Back Face Culling
Just Implemented Back Face culling.

However, sometimes there is a lag in generating a face while the model is continuously rotating.
I resolved it by increasing the threshold for the dot product comparison.
There is one more issue that it is slow after implementing back face culling. Gives 9 FPS otherwise it is 12 or 13FPS.

Scissor Test
The most easiest part of the assignment. Increases the render rate to 15-16FPS.

Features Implemented:
I implemented following features in the rasterizer:
  • Vertex Shading
  • Primitive Assembly with support for triangle VBOs/IBOs
  • Perspective Transformation
  • Rasterization through either a scanline or a tiled approach
  • Fragment Shading
  • A depth buffer for storing and depth testing fragments
  • Fragment to framebuffer writing
  • A simple lighting/shading scheme, such as Lambert as well as Blinn-Phong

Some additional features:
    • Back-face culling - Performance did not improve after implementing this. Infact, the FPS count decreased after implementing this test. I implemented this at the primitive assembly stage. One more problem which I faced in this implementation is that during the dot product test of back Face, my faces were disappearing as soon as the model turned back with 0.0. So, I increased this value to 0.6 and now it is delayed, but I can still see black spots while turning. However, on increasing it to 1.0f the black spots are completely gone. For now I have kept it to be 0.6f. 
    • Scissor test - Performance increased after implementing this test.
    • Correct color interpretation between points on a primitive
Video of the project:


Issue: Whenever I was moving the camera closer, my cuda was crashing. The reason I figured out was not the number of threads being created but the number of pixels being traced by each thread. Since moving the camera closer was increasing the number of pixel to be traced it failed.

Back Face Cull:

No comments:

Post a Comment