Note: this assignment description is largely incomplete - still working on it!
Summary | Raycasting is an old rendering technique used in video games and computer graphics that allows two-dimensional rendering of primitive shapes to be projected/portrayed into a three-dimensional environment. |
---|---|
Audience | Students with basic-to-intermediate computer science and programming knowledge are ideal candidates for this lab. Specifically, objects, methods, classes, iteration & selection statements, and variables. Knowledge of trigonometry and geometry is extremely helpful. |
Difficulty | Depending on the student's aptitude, this could easily be a one-to-two-week assignment if asked to create it from scratch. With starting supplemental files, though, it should be completable in, at most, one. |
Topics | Computer graphics rendering, collision detection, pseudo-3D graphics, rays, random number generation |
Strengths | Teaches students the basics of collision detection (i.e., ray to shape). Random shape generation in an environment. Shows students the connection between an overhead rendering perspective and how it translates to a pseudo-3D perspective. Allows students to break down the math of how a collision between a ray and a primitive shape is detected. Gives a fun and colorful environment and insight to how older computer games and graphics were simulated with lower-end hardware in decades past. |
Weaknesses | Some students may struggle with the graphical components of this lab, as well as keyboard listener input. The math is also less straightforward than other labs that do not focus on computer graphics, particularly since we are not using calculus or linear algebra. The assignment is also linear in that each piece is, ideally, constructed in succession to the final product. |
Dependencies | The current implementation aims primarily at students learning Java. However, this could easily be adapted to other languages that have a corresponding graphics library. We use Java Swing, whereas Python could use Tkinter, C with SDL, C++/C# with SDL (Simple DirectMedia Layer) or SFML (Simple and Fast Media Library). |
Variants | This lab is easily expandable to add sprites, colors, lighting, shading, different shapes in the environment, other entities in the world to interact with. |
By the end of this lab, students should be able to use iteration to determine the distance between a point and several objects in a plane, change angle-of-view and position via keyboard input, and modify graphics/shapes in a plane. Students should also understand how two-dimensional top-down rendering translates to a first-person, pseudo three-dimensional perspective.
Raycasting is an old rendering technique used in video games and computer graphics that allows two-dimensional rendering of primitive shapes to be projected/portrayed in a pseudo-three dimensional environment. Because of the complexity of rendering three-dimensional graphics, game developers decided to only render in two-dimensions while giving the effect of the third dimension! In this lab, you will create a small program that allows a user to traverse a two-dimensional world in the third dimension.