In the last lesson you saw how you can set a camera position for your scene. Well guess what? You can also set the position of the lighting source for your scene.
That's right...with such graphics, you get to set where you want the light to be coming from, much
as if with a real camera, you might be concered with where the sun is positioned during your shot.
When you call scene3d(), we default the light source to position to (x=0,y=0,z=1000), but with the light() function shown here, you can set the camera to any position you wish, and see how it affects your scene.
Move the mouse over a dotted box for more information.
Let's again use scene3d() and sphere() to draw some spheres,
but let's now move the light source around and see how things look in response.
First, try moving the light source left and right:
Move the light to (100,0,100)
Now to (-100,0,100)
What do you notice? Now try moving it up and down
Move the light to (0,100,100)
Now to (0,-100,100)
Now you try. Try moving the light source around and seeing how it affects your scene.
Type your code here:
See your results here:
Show a friend, family member, or teacher what you've done!
Here is a share link to your code:
Does your code work? Want to run it on your iPhone?
Here's your code:
Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.
Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into
Then click the "Use on iPhone" button that you'll see.