- Are imports sensible?
- Are the shaders near the top?
- Does each shader have a filename comment?
- Is every code block introduced with a colon?
- Does the final code file have appropriate line spacing?
- Are there any unexplained unwraps/expects?
- Are there any unnecessary // ... comments?
- Fix up imports to avoid long type paths in parts 1 through 4
- Use ManuallyDrop! It's stable now!
- Rename all
skybox
tosky
- Rename all
rtt
to something more descriptive - Rename all
postprocess
totoon
- Add a comment to each shader block showing the filename
- Part 7: Indexed drawing
- Draw a skybox using an index buffer
- "while we're at it" load a sky texture into another desc set
- Conclusion:
- Looks nice and now we know how to draw multiple kinds of thing
- But the skybox shouldn't be lit! We need to use a different shader
- But how?? Find out next time!
- Part 8: Multiple pipelines
- Have a nice new shader for the skybox
- Might involve a new desc set layout?
- Make a new pipeline for it
- Make the skybox clear the screen, but the other objects not
- Conclusion:
- Definitely looks nicer, but I'm getting vertigo!
- Some ground would really make this place more grounded.
- That doesn't sound too interesting in and of itself, but
- there's some interesting stuff you can do with ground
- Part 9: Stencil buffer
- OK this is getting a little contrived, but
- Draw a box for the ground that occludes part of the teapot
- But use the stencil buffer to draw a silhouette of the teapot through
- Conclusion:
- Now that I can see half a spinning teapot with x-ray vision,
- I'm really starting to feel at home.
- But occluding the teapot has got me thinking about things I can't see
- I wonder if we could expand our view of the scene somehow, without
- having to write any complicated code to move a camera, of course.
- Just something to reflect on for next time!
- Part 10: Render-to-texture
- Like many great astronauts, I want to see the dark side of this teapot.
- But I already have my viewport set up real nice an simple, and I don't
- want to stare right into the light
- So let's add a mirror behind the teapot and get the best of both worlds!
- Conclusion:
- Hope you liked this contrived example.
- I think this will be the end, for now.
- Call it Season 1 of these tutorials.
- I have a few ideas for more, but they'll have to wait.
- Things I learned:
- Never make two of something if one will do:
- Don't make two textures if you can atlas them together
- Don't make two descriptor sets if you can just use different Push Cs
- Don't make two vertex buffers if you can put your meshes into one
- Don't write two shaders if you can tweak the inputs of one
- Don't make two pipelines if one will cover it
- Never make two of something if one will do:
- Indexed drawing
- Instanced drawing
- Multiple render (sub-)passes
- Multiple vertex buffers
- Multiple vertex buffer types
- Multiple descriptor sets
- Multiple pipelines
- Multiple textures/texture array
- Cube maps
- Compute pipelines?
- OpenGL support
- WebGL/WASM support
- Don't write descriptor sets in a command buffer or you'll get a race condition: