Sunday, November 4, 2012

More additions

The following have now been implemented:

Back Face Culling
This is implemented as part of the rasterizer, which ignores the faces facing away from the viewer using the normal data. For flat shading of a scaled up, rotated version of the cow I get
the same fps with or without back face culling. Just over 2700 triangles were culled in this view.

Anti-aliasing
I performed antialiasing on each and every primitive. This worked fine for a single primitive, but on a model, I get lines at the junctions where the primitives meet. This was done in the vertex shader itself. The image is anti-aliased but artifacts are disturbing. This runs at 12 fps same as the normal case.
So I performed anti aliasing using higher resolution (4 times the normal resolution) in the rasterizer and performed shading on the higher resolution before writing to the frame buffer. I get a 0.5 to 1 fps with this method instead of 12 fps.
Antialiasing a Primitive
 
Model with primitive antialiasing
 
You can clearly see the lines where the 2 triangles meet. The depth test put only one color there, which would be lighter due to antiaiasing and thus causing these lines to appear. (Though it look like I have enabled Mesh display :))
 
Antialised Model

 Comparison: Left - Non antialiased, Right - Antialiased

 The smotthness can be clearly seen in the antialiased model. This was created using a 9*9 mask.


Z-Buffer Visual
I got the minimum and maximum values of the depth and shaded from 0.15 to 0.85 depending on depth from camera with 0.15 being the closest. This can be seen in the above picture.


That's it for now for the rasterizer. Sadly have to get back to other work.

No comments:

Post a Comment