Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project 4: Bowen Bao #20

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
65 changes: 60 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,69 @@ CUDA Rasterizer

**University of Pennsylvania, CIS 565: GPU Programming and Architecture, Project 4**

* (TODO) YOUR NAME HERE
* Tested on: (TODO) Windows 22, i7-2222 @ 2.22GHz 22GB, GTX 222 222MB (Moore 2222 Lab)
* Bowen Bao
* Tested on: Windows 10, i7-6700K @ 4.00GHz 32GB, GTX 1080 8192MB (Personal Computer)

### (TODO: Your README)
## Overview

*DO NOT* leave the README to the last minute! It is a crucial part of the
project, and we will not be able to grade you without a good README.
Here's the list of features of this project:

1. Core Features (Basic Rasterizer):
* Vertex shading
* Rasterization
* Fragment shader
2. Extra Features:
* UV texture mapping with bilinear texture filtering and perspective correct texture coordinates.
* SSAA
* MSAA

![](/img/overall.png)

## Texture Mapping
Base on depth per fragment for each pixel, and the transformed texture position indices, we load the correspond texture color.
###Bilinear filtering
We use bilinear filtering to smooth textures when they are displayed larger or smaller than they actually are.

###Perspective Correct
There will be distortions if we transform the pixel coordinate directly to position on textures. In perspective correct mapping we take into consideration the depth of the coordinates as well.

![](/img/truck_first.png)

Result of distortion mapping.

![](/img/truck_pers_bilinear.png)

Result of perspective correct mapping and bilinear filtering.

## Anti-aliasing
### SSAA
We first perform 4xSSAA to remove most of the rough edges. Although the performance cost is huge.

![](/img/truck_ssaa_comp.png)

No anti-aliasing compared to SSAA.

### MSAA
We also perform 4xMSAA to remove the rough edges. We could observe MSAA detects the edges of different fragments, as most of the rough edges occurs on those edges. Running super sampling on only those pixels greatly reduce the performance cost compared to SSAA.

![](/img/truck_msaa_3.png)

Pixels in red are those whose super sample positions lie in different fragments.

![](/img/truck_msaa_comp.png)

No anti-aliasing compared to MSAA.

## Performance Analysis
Here we compare the performance of our rasterizer under basic feature, 4xSSAA and 4xMSAA.

![](/img/performance.png)

This is the performance graph of rendering the milk truck. In MSAA we separate and perform depth test before rasterization, in order to render pixels based on nearby positions later in rasterization step. We can observe that MSAA is much faster than SSAA, as we are only super sampling pixels on fragment edges.

![](/img/performance_duck.png)

This is the performance comparison of rendering duck. It shows similar results as the earlier graph. Also we could observe the proportion of processing rasterization is not as large as rendering milk truck. This is because in this case the fragment pixel count is not as large as the previous example.

### Credits

Expand Down
Binary file added img/overall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/overall1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/overall2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/overall3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/overall4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/overall5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/performance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/performance_boundbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/performance_duck.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/performance_naive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/truck_bi_comp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/truck_coord.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/truck_first.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/truck_msaa_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/truck_msaa_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/truck_msaa_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/truck_msaa_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/truck_msaa_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/truck_msaa_comp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/truck_pers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/truck_pers_bilinear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/truck_ssaa.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/truck_ssaa_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/truck_ssaa_comp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ set(SOURCE_FILES

cuda_add_library(src
${SOURCE_FILES}
OPTIONS -arch=sm_20
OPTIONS -arch=sm_61
)
Loading