Earth Moon System

In this tutorial, you will create the Earth and the Moon, and make the rotation and revolution of them.

The file of this tutorial can be found at the scenes/tutorials/EarthMoonSys.sce.

 Features Covered in This Tutorial

 1. Creating mobiles
 2. Setting background color
 3. Creating light
 4. Adding textures to scene
 5. Designing material
 6. Creating shots, setting animation keys, assign controller for animated parameter
 7. Adding action to shot

 

Create  the Earth and the Moon

1. Choose "Create>Mobile..." in main menu, select "/models/sphere.tri" in the file dialog box that appears, then click "Open" button.
2. A sphere will appear at ( 0,0,0 ) coordinate. If you can't see it, click on the main toolbar. A properties panel will appear for this new mesh. In the Mesh Properties Panel, change the name of the object from "sphere"  to "Earth".
3. Click the button at the left of "Rotation:" in the Mesh Properties Panel, set "Y" to 360 in the Vector Dialog Box that appears. There are three buttons for setting mesh's Position, Rotation, Scale respectively.
4. Similarly, create a sphere and name it with "Moon". Set it's Position to ( -300, 0, 0 ), Rotation to ( 0, -90, 0 ), Scale to ( 0.27, 0.27, 0.27 ).

 

Set Background Color

There are four viewports in Awakening, and every viewport have own color setting. When you save scene, Awakening will use the active viewport's background as scene's background. Commonly, we use the bottom-right viewport as main stage of scene. Now let's set scene's background color to black, just like in outer space.

1. Click in bottom-right viewport to active it. A yellow frame bounding the viewport indicate this is the active viewport.
2. Right-Click at the top left corner of the active viewport, choose "More Options..." in the pop up menu. The Viewport Options Dialog will appears, you can change Text Color, Background Color, FOV and Background Image in this window. Now click the color button at the right of "Background color:", select Black color in the Color Pick Dialog that appears.

 

Create a Directional Light to simulate sunlight

1. Click the drop down arrow right at in main toolbar, select 'Light' in the popup menu.
2. Click anywhere in viewport, a light will be created.
3. In light's properties panel, change Color to slight darker; change Type to "Directional"; set Position to ( 400, 0, 0 ); set Direction to ( -1, 0, 0 ); set Range to 9000.

Because light is small, it's inconvenience that finding & selecting lights sometime. To change light's size, choose "Options>Miscellaneous...", adjust "Size of light" in the dialog box that appears. Another choice, you can click in main toolbar, or press H when in viewport, the Object List Dialog will pop up, you can easily find/select objects in this window. 


Add Textures and Assign to Mobiles

1. Switch to Texture Panel, and right-click in the texture browse window, then select "Add Texture". Select "earthcloudymap_1024x512.jpg" and "MoonMap_1024x512.jpg" "in "/textures" folder in the file dialog box that appears.
2. Select the "Earth" mobile  in viewport, then click the earth map image in texture panel, this will set mobile's own one layer texture. Similarly, set the Moon's own texture with moon map image. 

When you select a object in viewport, the properties panel will immediately change for selection. But sometime this bring inconvenience, you can use "Lock tab" to disable this feature.

 

Design Material and Assign to Mobiles

1. Switch to Material Panel, and click "New" button to create a new material. Name it with "moon".
2. The default setting of material is some dark for the Moon. Click the first long button in "D3D Effect" group, select "/effects/Diffuse mul Texture 2X.fx" in the file dialog box that appears. The edit box that under this button should displays shader codes.
3. First select the Moon in viewport, then switch to Material Panel, select the "moon" material, then click "Assign" button. Similarly, assign this material to the Earth.


Now, we have finished the static scene. You can choose "Tools>Play Scene" in main menu to view your work in Winds3D Player. Not bad, is it? Let's take a rest while you enjoying your work. In next section, we'll animate the scene.


Create Shots, Set Animation Keys

1. Switch to Shot Panel, and click "New" button to create a new Shot. Name it with "Rotation".
2. Check "Not Affect Camera" style. We no need to animate camera, so disable it. Check "Circle" style, this means shot repeat playing.
3. In Animation Panel, set total time length to 8 seconds. This means we'll create a eight seconds time animation.
4. Select the "Earth" mobile. Drag the time slider to 0.0 in Animation Panel, then click the "Set Key" button. You should see a black mark: on the time ruler. This mark indicates there is a animation key on the time pointed by mark. Again, drag the time slider to the end of the time ruler ( 8.0 second ), then set Rotation to ( 0, 0, 0 ) in the Mesh Properties Panel, click the "Set Key" button, here we create another animation key. OK, we've finished "Rotation" animation for the "Earth". Now try to drag move the time slider, do you see the "Earth" rotating?

5. Similarly, create a new Shot and Name it with "Revolution", also check "Not Affect Camera" and "Circle" style.
6. Set animation time length to 36 seconds. The period of Moon's revolution is long than Earth's rotation, but we not use the real scale; otherwise the animation is too slow.
7. Select the "Moon" mobile, create 5 animation keys use the same method as the steps on the "Earth". Below is parameters list for animation keys:

 Time Position Rotation
0 ( -300, 0, 0 ) ( 0, -90, 0 )
9 ( 0, 0, -300 ) ( 0, -180, 0 )
18 ( 300, 0, 0 ) ( 0, -270, 0 )
27 ( 0, 0, 300 ) ( 0, -360, 0 )
36 ( -300, 0, 0 ) ( 0, -450, 0 )

8. OK, now click the button in Main Toolbar, see the "Moon" running circle the "Earth" with synchronous self-rotation?
Look carefully, is there problem somewhere? Yes, the "Moon" suddenly bounce at somewhere of it's orbit. Right-Click in viewport, check the "Select Object>Trajectory" in popup menu. Select the "Moon", you should see a pink trajectory show the orbit of the "Moon", it's shape some like a peach, that's not we want obviously. Let's correct this problem: In the
controller box of  the Mesh Properties Panel, Right-Click on the animated parameter "Position", choose "Assign Controller>Spline (continuous)" in popup menu. Well, now the trajectory become round.

9. The last mission: adding action to shot. Because only play the exclusive selected shot when Winds3D Player load a scene file, we need do some to let all two animations are running. Switch to Shot Panel, select the "Rotation" shot. In Command Target box, click the "Add Action" button, then choose: "Message: Shot Begin; Function: PlayAnimate; Object: Revolution" in the "Action Define" dialog that appears; Click the "OK" button, a new action will add to Actions List of Command Target box. This action means: when the "Rotation" animation start, play the "Revolution" animation.

Finally, we have finished this task. Don't forget save your work to disk. Play this scene in Winds3D Player, you can see a running "Earth Moon System".