This page contains the (2023) latest versions of a number of demos from the TSBK07/TSBK11 lectures that have not been uploaded before, usually because I didn’t feel they were “mature”, they needed to be a bit more tidy so they are not confusing.
All demos are in C++, but I have not had time to do it with the current “common” for C++ so you may need to make some adjustments, like changing to VectorUtils4.
This includes, at this time:
BetterFrustumDemo
Flat bunnies (3 demos)
Light attenuation
Shadow cubes
Simple shadow plus
Two lights
Conflict free portal demos (three demos plus variations)
Better frustum demo
Many years ago, I made a demo of frustum culling that I really like, but it was getting really, really old. So more recently I decided to modernize it… and it was a mess. So, I started over and made this from the ground up.
The demo uses GLUGG for all geometry, the spheres and the frustum polygon. Note: The frustum is only showed as its middle plane, which can make the result slightly odd. No, I don’t know why I did it that way and I may change that for a future version. This was the straight forward way to get it up fast.
Better frustum demo
Updated to latest common 2024.
old: download
Flat bunnies
Three demos of picking items by color!
“Flat bunnies” shows the bunnies with colors used for identification.
“Flat bunnies 2 pass” renders the scene twice, once for identification and once normally. This is how you should usually do it.
“Flat bunnies trackball” is a variation where you can click-and-drag on the bunnies to rotate them,
Flat bunnies
Flat bunnies, 2 pass
Flat bunnies / trackball
Updated to latest common 2024.
old: download
Light attenuation
Positional light needs attenuation to feel right, especially in dark scenes. This shows a simple scene with cubes, where the light source is at the camera.
Light attenuation
Updated to latest common 2024.
old: download
Shadow cubes
This demo shows an easy (but not efficient) way to get shadows on arbitrary surfaces, from knowing distances to the objects. This doesn’t scale well for many objects so for a large scene you need some subdivision approach.
I really should do this for a more complicated surface. Or maybe you will? Try this on the terrain like in lab 4!
Shadow cubes
Updated to latest common 2024.
old: download
Simple shadow plus
The shadows above are good for arbirary surfaces, but the shadows have to be just a soft spot since the surface doesn’t know the shape of the objects. For a flat surface, however, you can make perfect shadows. The simplest case is just to flatten the shape. See TSBK03 for the case where it is projected as well. I have an older version of this demo there, but this is nicer, with an explicit surface.
This is the absolutely easiest to make a shadow, but it has to be black. This is also addressed in TSBK03.
Simple shadow plus
Updated to latest common 2024.
old: download
Two lights
I keep insisting that you need to clamp the light so we don’t have negative light. Why not having a demo of the effect? This demo shows the lab bunny with yellow and magenta light, but if we don’t clamp, the negative light will cancel some colors and we will get areas that are blue and green!
Why? Yellow is (1, 1, 0) and magenta is (1, 0, 1)) so yellow - magenta is (0, 1, -1) (green) and magenta - yellow is (0, -1, 1) (blue).
SimpleGUI was used to turn the clamp on and off on-screen.
Two lights
Updated to latest common 2024.
old: download
Conflict free portal demos
PRELIMINARY. These demos are a bit questionable, not because they are not interesting bit because they are rather long and include geometry shaders, which is beyond the course. However, the geometry shader is only there to handle the textures, so you can ignore them.
These demos are part of a larger set, where the other demos are even more beyond the course goals, while the important parts of what you see here are just the transformations which is perfectly within our scope.
The demos are in three parts, The Wall, Corridor and Multiple Rooms. Each come in more than one variant.
This is the very first upload of these demos. I don’t know how useful they are. They grew a bit too much and I would like to make a simpler variant, especially of The Wall.
download no longer recommended unless you want a straight C version
New version 2024-04, C++, latest lab material, Linux makefiles:
The wall, a single cell with a portal looking straight back into itself.
The corridor, a single portal looking into the same cell from the back, creating the illusion of an endless corridor.
Multiple rooms, “auto” version with markers on the walls. Variants with up to six rooms connected so they look like eight.