Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 45 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,53 @@ CUDA Rasterizer

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

* (TODO) YOUR NAME HERE
* (TODO) [LinkedIn](), [personal website](), [twitter](), etc.
* Tested on: (TODO) Windows 22, i7-2222 @ 2.22GHz 22GB, GTX 222 222MB (Moore 2222 Lab)
* Eric Chiu
* Tested on: Windows 10 Education, Intel(R) Xeon(R) CPU E5-1630 v4 @ 3.60GHz 32GB, NVIDIA GeForce GTX 1070 (SIGLAB)

### (TODO: Your README)

*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.
![](./renders/truck-texture.PNG)


### Credits
## Description

* [tinygltfloader](https://github.com/syoyo/tinygltfloader) by [@soyoyo](https://github.com/syoyo)
* [glTF Sample Models](https://github.com/KhronosGroup/glTF/blob/master/sampleModels/README.md)
This project implements a rasterized graphics pipeline using CUDA programming and GPU hardware. Features include lambertian shading, UV texture mapping, and point and line rasterization.

## Performance Analysis

The following charts show a time breakdown for rasterizing the duck and truck model with various settings: point rasterization, line rasterization, triangle rasterization, and triangle rasterization with perspective correct UV mapping and bilinear texture filtering. We can see that the primitive assembly and vertex shading stages are same throughout the various settings, and the majority of the pipline is spent in the rasterization and fragment shader stages. This is probably because there are more fragments and triangles than vertices that the computer has to process. Another observation is that for the truck, the rasterization stage takes significantly longer with triangle rasterization. A possbile explanation is that the truck model covers many more pixels on the screen than the duck model, so our rasterizer has to iterate through more pixels.

![](./renders/duck-chart.png)

![](./renders/truck-chart.png)


## UV Texture Mapping

When UV texture mapping with barycentric coordinates, without the consideration of depth information and perspective correctness, bending artifacts start to appear on the object as shown below.

![](./renders/checkerboard-no-perspective-no-bilinear.PNG)

By taking into consideration of depth information from interpolated positions of triangles, the texture coordinates become perspective transformed, as shown below.

![](./renders/checkerboard-no-bilinear.PNG)

We can further improve UV texture mapping by anti-aliasing using a method called bilinear filtering. The idea of bilinear filtering is that instead of sampling a texture at a single point, we interpolate the color values of the four pixels around the selected point. This will remove jagged texture edges as shown below.

![](./renders/checkerboard.PNG)


## Point and Line Rasterization

Another feature of this rasterizer is point cloud and wireframe display. This can be achieved by adding a primitive type flag and modifying the rasterization stage, so that it processes vertex information differently depending on the primitive type.

![](./renders/duck-point.PNG)

![](./renders/truck-point.PNG)

![](./renders/duck-line.PNG)

![](./renders/truck-line.PNG)

![](./renders/duck-texture.PNG)

![](./renders/truck-texture.PNG)
Binary file added renders/checkerboard-no-bilinear.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 renders/checkerboard.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 renders/duck-chart.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 renders/duck-line.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 renders/duck-point.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 renders/duck-texture.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 renders/truck-chart.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 renders/truck-line.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 renders/truck-point.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 renders/truck-texture.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