teaching machines

Cube

May 11, 2021 by . Filed under public, slai-2021.

This post is part of a course on geometric modeling at the Summer Liberal Arts Institute for Computer Science held at Carleton College in 2021.

In this exercise, you will break into the third dimension and model a cube. We start on paper, progress to a disappointing rendering, and iterate toward a satisfactory rendering with 3D shading.

Drawing

As always, we start our thinking on paper in order to get ideas out in front of us. Follow these steps to lay out the groundwork for our cube.

Keep your drawing nearby and modify it as you find ways to improve upon your initial sketch.

Render

Turn your drawing into an interactive rendering by completing the following steps:

In your browser you should see a cube that you can rotate and zoom. Discerning the faces is difficult, because there is no shading. All the pixels of the cube are assigned the color that you set in the material.

Lighting

To properly see 3D geometry, you need to add lighting and use a material that supports lighting. Follow these steps to shade the cube’s pixels based on a light source.

When you reload the scene, you should see a black cube. The shading isn’t working yet.

Normals

Besides adding a light source, you also need to provide information about the orientation of the surface around each vertex. In particular, you need to provide a normal for each vertex. A normal is a direction that is perpendicular to a surface. A normal that aligns with the direction to the light source means the surface is fully illuminated. As the surface tilts away, it receives less light. Follow these steps to add normals to your cube:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *