Name ______

Date ______

Recoloring the Universe Virtual Lab

Click on the first activity “recolor”. On the page that opens, click “Login” and create a username and password (assigned by your teacher).

Recolor

In this activity you will see how computers use the RGB color model to create color. Your code goes on the left of the screen, and the output will appear on the right of the screen. Color values in the RGB color model can range from zero to 255. The preset values will change the entire image (initially a rainbow of colors) to all red. Press the “run program” arrow button in the center of the screen to run the code. The result will display on the right. It should be entirely red. Then change the code to make the image all green.

Make the following colored images and write the values used to make each:

whiteR:______G:______B:______

blackR:______G:______B:______

cyanR:______G:______B:______

magentaR:______G:______B:______

greenish whiteR:______G:______B:______

very dark greenR:______G:______B:______

yellowish white R:______G:______B:______

Practice making various colors. Choose an interesting color that you have made, and name it. Write the name and the color values used below:

color: ______

R:______G:______B:______

Scene – Return to the homepage and click on “scene”. Log back in.

In this activity you will recolor an image of flowers by changing the RGB values for all the pixels in the image. This activity also includes the “recolor” function that you saw before. The function has three inputs of “r”, “g”, and “b”. You can enter any of these three inputs for any of the three-color outputs. Run the preset code of “r” for red. This shows how the scene would appear if you could only see red.

Set the code to show red and blue but not green. If you couldn’t see green light, what color would the following appear?
sky:

yellow flowers:

red flowers:

Why do the green stems and leaves appear gray but not black?

Try out different input combinations until you can identify the colors present in each part of the image.

Now try shifting pixel colors before applying a filter. For example, entering blue = r (and zero for the other inputs) will shift red pixels to blue before displaying the blue colors. Entering red = 0, green = 0, blue = r means you can see blue light, AND red pixels have been shifted to blue as well.

Use this technique to make the sky magenta and the flowers blue.

red:______green:______blue:______

Next, make the sky purple and the flowers red. red:______green:______blue:______

Now make the sky and flowers purple. red:______green:______blue:______

Next try increasing the color value of an input. For example, enter red = r + 100, but keep other inputs at zero. What effect does this have on the image? What effect would decreasing the color value have?

You can also multiply inputs. For example red = r * 1.5 or red = r * 0.5.

Experiment to create an interesting filter, then name it and indicate the color values below:

name: ______

red:______green:______blue:______

Flowers– Return to the homepage and select “flowers”. Log back in.

In this activity you will combine colors from two images of flowers. The red flower image is “1” and purple flower image is “2”. The input determines which colors are displayed from each image. Display the following:

only the red from image 1: red:______green:______blue:______

only the red from image 2: red:______green:______blue:______

only the green from image 1 and the blue from image 2:

red:______green:______blue:______

only half of the green from image 1 + half of the green from image 2:

red:______green:______blue:______

Try shifting colors and/or adding value to colors as seen in the previous activity. Create an interesting “mashup” of the two images, then name it and indicate the color values below:

name: ______

red:______green:______blue:______

Now change the images that are being used. You’re going to combine images of a beach and an elephant by changing the images to: “/img/400x600-beach” and “/img/400x600-elephant”

Play around until you create an interesting color combination. Name it and indicate the color values below:

name: ______

red:______green:______blue:______

Supernova- Return to the homepage but do not open “supernova”. Select “input data” under “supernova”.

In this activity you will combine multiple images of one supernova remnant, the structure resulting from the explosion of a large star at the end of its life. It is a large structure of hot gas and dust, bounded by a shock wave expanding through space. Each image is a different part of the EM spectrum, taken by a different telescope. You will have images from the IR, optical (visible), radio, and x-ray parts of the spectrum. These are all gray-scale, and you will eventually assign colors to each.

First view each of these images by selecting “input data” on the homepage and opening each image. Make note of what parts of the supernova and surrounding area are shown by each image. Do your best to describe each.

ir: ______

optical: ______

radio: ______

x-ray: ______

Now open the “supernova” activity and log back in. You are looking at Kes 73, a young supernova remnant in the Milky Way with an x-ray bright, radio-quiet central source called a pulsar. Choose a thoughtful color scheme that you would like to use to display the structure of the supernova in a thoughtful way based on your descriptions above (something different from the presets). Experiment by adding and multiplying inputs to create a uniquely colored output that you think best represents the supernova in the most informative and aesthetically pleasing way. Discuss with your teacher why you chose this color scheme. Indicate this input and output below:

red: ______

green: ______

blue: ______

Starforming – Return to the homepage but do not open “starforming”. Select “input data” under “starforming”.

A star-forming region, or stellar nursery, is where huge clouds of gas and dust collapse under the pull of gravity to form new stars and solar systems. Most stars formed in these regions are smaller than the sun and are optically blocked from view by surrounding gas and dust. This gas and dust is more transparent in the IR and x-ray parts of the spectrum.

In this activity you will combine images from six different wavelengths, including images of shock waves in two parts of the spectrum, to visualize a star-forming region. Start by viewing the input data on the homepage.

blue: ______

irshocks: ______

xray: ______

ir: ______

optshocks: ______

red: ______

Now open the “starforming” activity and log back in. Again change the inputs to create a uniquely colored output that you think best represents the star-forming region in an informative and aesthetically pleasing way. Discuss with your teacher why you chose this color scheme. Indicate this input and output below:

red: ______

green: ______

blue: ______

For homework or extra credit, you can also complete the “keplersnova” and “blackhole” data sets.

Acknowledgements:Recoloring the Universe with Pencil Code was created by volunteers David Bau (developer of Pencil Code and a Google employee), August Muench (astronomer for the American Astronomical Society), Kim Arcand (visualization lead for NASA’s Chandra X-ray Observatory), and Sydney Pickens and Matthew Dawson (computer science educators with Google CS First). This classroomvirtual lab sheet was created by Tammy Kjonaas at the Wheeler School in Providence, RI.