Lab: Stroll
In this chapter, you've been learning about how to model cameras and a terrain. Let's apply this knowledge by building a renderer in which the user can stroll across a landscape. We won't be adding any new features to the camera or terrain. Rather we're just going to put everything you read about together.
Renderer
Your challenge is to render a terrain and a move around it with a camera. Follow these steps:
Clone one of your existing renderers that performs lighting into the folder
stroll
.
Generate a heightmap using Unreal PNG Heightmap or some other tool of your choosing. Save it in your renderer's folder.
Turn the heightmap into a
Trimesh
using the Field
class. Generate its normals.
Add a
FirstPersonCamera
.
Render the terrain model with three matrices:
clipFromEye
, eyeFromWorld
, and worldFromModel
.
Apply diffuse lighting from a light source sitting above the terrain.
Support smooth advancing and strafing with the WASD keys. Ensure that the camera's y-coordinate adapts to the elevation.
Support yawing and pitching with the mouse.
Submission
To receive credit for your lab work, follow these steps:
Non-host, download the
stroll
folder before the host closes the session.
Share a video of your renderer in a post in the
#lab
channel in Discord. No voiceover is necessary. Tag your group members with @
.
Push your code to your individual GitHub repository that your instructor made for you.
Only labs submitted on time will be granted credit. Late labs or forgot-to-submits are not accepted because Monday at noon is when your instructor has time to grade.