Lab: Terrain
Lately we've been learning how to turn a grayscale image into a navigable terrain model. In this lab, you'll build your own terrain renderer. You are encouraged to add a terrain to your project, so no starting repository is provided.
Terrain
Follow these steps to get terrain in your renderer:
Read in a grayscale heightmap image. You are encouraged to make your own.
Make a
Heightmap
class. Give it a behavior that produces a VertexArray
object. To match up with Cannon, which we'll incorporate in a later lab, make the implicit z-coordinates negative. Omit blerp
and most other behaviors, because Cannon will handle placing objects on the terrain for us.
Render the terrain as points initially—to minimize the opportunity for bugs.
Place a camera in the scene so you can move around and inspect the terrain. Don't worry about adjusting the camera's height to glide along the terrain. We'll use Cannon for that later on.
Render the terrain as triangles.
Give the monochromatic terrain some spice either through random colors or normals and diffuse lighting.
Submission
To receive credit for your lab work, follow these steps:
Share a video of your renderer in a post on the
#lab-gallery
channel in Discord. Tag your group members.
Push your code to GitHub.
Only labs submitted on time will be granted credit. Late labs or forgot-to-submits are not accepted because Wednesday at noon is when your instructor has time to grade.