CSC 240: Computer Graphics
Homework 6: Solar System in OpenGL
Due: Thursday, Nov. 12, 11:59pm on Moodle
The goal of this homework is to put together several important
concepts in 3D graphics:
- Viewing through projection (orthographic vs. perspective)
- Lighting
- Hierarchical models
Credit: Joe O'Rourke
Write an OpenGL program that will display an animated, lighted
solar system, which consists of (at least) the following components:
Solar system components:
- The Sun.
- The Earth orbiting the sun.
- The Moon orbiting the earth.
- The orbital paths should be either circular or elliptic.
Viewing requirements:
- Hidden surface removal should be turned on.
- Select a viewpoint so that the lighting effects on the planets
are noticable.
No need to arrange for the camera to move around:
one good viewpoint suffices.
- The sun, earth, and moon should all be different colors.
Hierarchical modeling requirements:
- The motion of the components must be controlled using
hierarchical models (use
glPushMatrix() and glPopMatrix()).
Lighting requirements:
- There should be one (or more) light sources above the
plane of rotation, lighting up the entire solar system.
Maybe not too bright.
Perhaps you will need some ambient component to this source.
- The sun itself should be co-located with a light source, so
that the sun illuminates the planets as well.
(The sun sphere will not block the light from coming out of its
interior.)
- The sun should be emissive so that it glows (but this does not
constitute a light source).
NOTES:
- It is not essential to make the moon orbit at precisely
the correct rate relative to the earth rotating around the sun (although it is not too hard to get it
roughly correct.)
-
Suggestion: first draw the components and find a good viewpoint. Then
get the animated motion working without lighting effects. After that
is working, add the lighting.
- After this is working, feel free to create a solar system that
either incorporates more realistic components (planets, etc), or
create a solar system that has nothing to do with reality or
physics. I would love to show some examples in class!
- Submit your code on Moodle.
PAIR PROGRAMMING OPTION:
For this assignment, you are welcome to use pair programming (but
please switch frequently!) You can turn in one assignment, or you can
get the main code working together and turn in separate extensions or
experiments. Let me know if you used this option at the top of your
code.
UPDATE:
Here is an example of a sun with no emitted light (left) and a sun
with emitted light (right). It may not be as dramatic a difference as
you're looking for, but it should be different. The only difference
between the code for these two examples is one line commented out:
glMaterialfv(GL_FRONT, GL_EMISSION, mat_emission)