This assignment is due by April 23, 2021 by 11:59pm.
For this assignment, we will create a three pass rendering system to efficiently draw many complex particles. The three passes will correspond to the following steps:
- Movement Pass: Using transform feedback or a compute shader, update the position of each particle
- Geometry Pass: Using instanced rendering, write out the g-Buffer for our particles
- Lighting Pass: Using deferred rendering, shade all of the particles
We will implement these in the reverse order by implementing Instanced Rendering, then Deferred Rendering, and then finally the movement.
Part I - Shading Particles Drawn With Instanced Rendering
Your particle can be any object that has complexity equal to or greater than a cube. Feel free to use your teapot, or the posted trefoil code. Begin by rendering just a single instance of your particle and apply Blinn-Phong Shading to it.
Now generate an array of particles that results in a highly occluded scene using instanced rendering. Each particle needs an instanced attribute that corresponds to its translation to position. (As a tip to assist in future steps, do not store this value has the actual transformation matrix that we would multiply our point by. Instead, store it as a vector that we will add to our point.)
The goal is to render more than 5M triangles each frame. See how high you can push it while maintaining 60 FPS.
Part II - Draw With Deferred Rendering
Since our scene is highly occluded, we are doing the expensive shading calculations on many fragments that later get thrown away by future depth passes. Split your prior rendering in to two passes now:
- Geometry Pass: Write out to a g-Buffer the geometry information needed for the Blinn-Phong Shading. This will include the position, normal, and albedo information.
- Lighting Pass: Render a textured quad filling the entire screen and read the geometry information from the g-Buffer. Perform the Blinn-Phong Shading calculations on only the closest fragments to the camera.
This is a usage where one shading program with subroutines may make the most sense, but two individual shading programs can be used as well.
The goal is to render more than 5M triangles each frame. See how high you can push it while maintaining 60 FPS.
Part III - Make Them Dance
The last step is to now update the positions of each particle each frame. This can be accomplished with either Transform Feedback or a Compute Shader. Each frame, we'll update the instanced attribute that corresponds to the translation of our particle. You can decide how the movement occurs (in a fountain with gravity, in a sinusoidal pattern, etc.) but we should see the particles independently moving on their own individual paths.
If using transform feedback, this is a usage where one shading program with subroutines may make the most sense. If using a Compute Shader then a separate program will be needed.
The goal is to render more than 5M triangles each frame. See how high you can push it while maintaining 60 FPS.
Part IV - Create Your Website
In addition to creating this awesome looking teapot, modify your webpage from A2 to include several screenshots.
Documentation
With this and all future assignments, you are expeced to appropriately document your code. This includes writing comments in your source code - remember that your comments should explain what a piece of code is supposed to do and why; don't just re-write what the code says in plain English. Comments serve the dual purpose of explaining your code to someone unfamiliar with it and assisting in debugging. If you know what a piece of code is supposed to be doing, you can figure out where it's going awry more easily. (Interestingly enough, this code review of Doom 3's source code says the exact opposite - well written code should require no comments. Well, we don't work at id so we're going to comment.)
Proper
documentation also means including a
README.txt
file with your submission. In your submission folder, always include a
file called
README.txt
that lists:
- Your Name / HeroName
- Homework Number / Project Title
- A brief, high level description of what the program is / does
- A usage section, explaining how to run the program, which keys perform which actions, etc.
- Instructions on compiling your code
- Notes about bugs, implementation details, etc. if necessary
- How long did this assignment take you?
- How fun was this assignment? 1-10 (1 - discontinue this assignment, 10 - I wish I had more time to make it even better!)
Grading Rubric
Your submission will be graded according to the following rubric.
Percentage | Requirement Description |
30% | Instanced Rendering used to render many particles with unique instanced attributes |
30% | Deferred Rendering used to shade only closest fragments |
30% | Transform Feedback/Compute Shader used to update particle positions |
5% | Appropriately complex particle chosen |
5% | Submission compiles and includes README, source code, & website |
Submission
Please update your project so it produces an executable with the name
userName_A3. When you are completed with the assignment, zip together
your source code, README.txt, and www/ folder. Name the zip file,
userName_A3.zip. Upload this file to Canvas under A3.
This assignment is due by April 23, 2021 by 11:59pm.