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
60 changes: 54 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,64 @@ 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)
* Siyu Zheng
* Tested on: Windows 10, i7-8750 @ 2.20GHz 16GB, GTX 1060 6GB, Visual Studio 2015, CUDA 8.0(Personal Laptop)

### (TODO: Your README)
## CUDA Rasterizer

*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.
| Duck | Cesium Milk Truck |
| ------------- |:-------------:|
| ![](images/duckGIF.gif) | ![](images/truckGIF.gif) |

### Shading Methods
| Lambert | Blinn-Phong |
| ------------- |:-------------:|
| ![](images/lambert.png) | ![](images/blinn.png) |

### Credits
Use different shading methods to render the object.

### Perspective correct texture

| Non-perspective correct | Perspective correct |
| ------------- |:-------------:|
| ![](images/nonperspective.gif) | ![](images/perspective.gif) |

Use perspective-correct interpolation instead of barycentric inperpolation on z. Then update the depth if needed and do perspective correct inperpolation on non-positional vertex attributes of this fragment. It's quite obvious that without perpective correct interpolation, the display of checkerboard is wrong.

### Bilinear texture filtering
| Non-bilinear | Bilinear texture filtering |
| ------------- |:-------------:|
| ![](images/nobilinear.png) | ![](images/bilinear.png) |

Use four texture points nearest to the point that the pixel represents and interpolate the color value. As the graph shows, the edge in checker board with bilinear texture filtering is more smooth.

### Color Interpolation
| Triangle | Box |
| ------------- |:-------------:|
| ![](images/triangle_color.png) | ![](images/box_color.png) |

Assign red, green and blue for vertices of each triangle then use barycentric interpolation to calculate the color of each pixel in that triangle.

### Rasterize point and line
| Point cloud | Wireframe |
| ------------- |:-------------:|
| ![](images/point.gif) | ![](images/line.gif) |

For rasterizing points, check if that position of the fragment is in the screen and assign each fragment with a color on that pixel.

For rasterizing lines, loop all edges for each triangle and calculate the length for each line segment. Divide the line segment into tiny subdivision then assigned color on that pixel.

### Perform Analysis

![](images/time.png)

Recorded the running time for each process. In general, vertex transform and primitive assembly took about similar amount of time for different test files. We can see that in truck example, the rasterization took most of the time since Cesium Milk Truck has several different texture. For rendering, there is only some shading methods so it doesn't cost much of time. For sending image to PBO, it took similar amount of time for different objects.

![](images/primitives.png)

The running time for different primitive types. Rasterizing triangle cost a little bit more time than point and line.

### Credits
* [Bilinear filtering Wiki](https://en.wikipedia.org/wiki/Bilinear_filtering)
* [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)
Binary file added images/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 images/blinn.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 images/box_color.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 images/duckGIF.gif
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 images/lambert.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 images/line.gif
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 images/nobilinear.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 images/nonperspective.gif
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 images/perspective.gif
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 images/point.gif
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 images/primitives.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 images/time.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 images/triangle_color.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 images/truck.gif
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 images/truckGIF.gif
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_30
)
Loading