Week 9: 3D Graphics

Key Points

  • Today's Lab: Model Citizens
    • [ ] What are the main stages of the 3D graphics pipeline?
    • [ ] How does an application send commands to the GPU to render a scene?
    • [ ] How are swapchains related to framebuffers?
    • [ ] What are vertex and fragment shaders and how do we define them?
    • [ ] Why do we need so much code to draw a triangle?
    • [ ] What is a buffer (in the context of WGPU) and what are some things buffers are used for?
    • [ ] What is a diffuse texture, and what other sorts of textures might there be?
    • [ ] How do we set up vertices and textures at runtime instead of from compile-time constants?
    • [ ] What are uniforms and how do they relate to shaders?

Check-in: Wrapping Up the 2D Games

Get into groups of three and discuss what you've been up to with your 2D game. What have you implemented so far? What are the roadblocks you're up against? Can you figure out together a way to solve them or work around them by tweaking the design?

You've only got a week left to have two games, so make good use of this time to plan your final steps!

Model Citizens

Today will be a little different. Walk through this book and post a screenshot of your code running at the end of the Model Loading section.

I really advise reading and retyping the code from the tutorial rather than copying it or checking out the tutorial entries. A couple extra resources may be useful reading during this adventure to reinforce the very task-oriented Learn WGPU:

Unit 3 Features

Your feature count is the union of your feature count in up to two games. Both games must share at least three features; if you're only making one game, there must still be a clear game/engine split. Options marked with * are recommended.

Grade assignment:

Three or fewer features
Four features
Five features
Six features


  • (*) Collision beyond AABBs, for example GJK collision or sphere-swept-volume collisions
  • (*) Particle system effects
  • (*) Fancy math—use rotors + bivectors for angular orientation and velocity/momentum
  • Fancy physics—rigidbodies, cloth, joints, physical particles, …
  • (*) Mixed 2D/3D with interesting camera effects
  • (*) Multiple graphics pipelines, off-screen render targets, reflections, or related effects
  • Advanced animation systems, e.g.:
    • Blend trees, additive blending, etc
    • Inverse kinematics
    • Procedural animation
  • AI characters that communicate and/or cooperate
  • (*) Gameplay-relevant shadows and lighting
  • (*) Shaders that relate to gameplay, e.g. to show characters obscured by walls
    • Using shaders written in rust-gpu
  • (*) Decals or related effects
  • Destructible/modifiable terrain
  • Voxels
  • Infinite Level of Detail
  • Streaming loading/unloading of assets
  • Spatial audio, footfalls, and 3D audio sources, tied into gameplay
  • Networking
  • Supporting 2D games from the previous unit using this engine
  • (*) Reuse substantial code from 2D engine
  • (*) Sub games/turn taking/menus/modal UI
  • (*) Save/load progress
  • A million objects live at once

If you'd like to propose an additional feature, let me know.

Your Unit 3 games are due before the scheduled final exam.