Tutorial Home / Environmental Objects / Creating a Gradient Background

return to Environmental Objects


Overview

The background node in VRML allows you to specify gradient colours to represent the ground and sky or alternatively, photorealistic textures projected onto the 6 sides of an infinitely large cube (called a Sky Box in gaming circles). You can use a combination of gradient colours and transparent textures together in the one background but this is not properly supported in all VRML plug-ins.

Because the background node is infinitely far away at all times, you can never reach the horizon. Also the background node is unaffected by lighting, fog and visibility limits.

To create a default background in Cosmo Worlds you use the Create Background icon on the Create Extras toolbar (View Menu > Toolbars > Create Extras if it is not already visible). Once created there is no visual tool to modify the background properties. You must manually enter sky/ground angles and colours in the Outline Editor.

In VRML angles are measured in radians (3.14 radians = PI = 180°). Colours are specified by 3 floating point numbers between 0 and 1 representing the colour's Red, Green and Blue components (eg. red = 1 0 0, green = 0 1 0, blue = 0 0 1, yellow = 1 1 0, white = 1 1 1, black = 0 0 0, pink = 1 0.5 0.5 etc).

Example
To achieve the sunset effect illustrated, the following numbers need to be entered into the respective Background properties in the Outline Editor:

skyAngle 1.05
1.57
skyColor 1.0 1.0 1.0
1.0 0.8 0.0
1.0 0.4 0.0
groundAngle 0.785
1.57
groundColor 0.0 0.4 0.0
0.4 0.6 0.0
0.6 0.6 0.4
Click here to view or download the example background.

back to top | return to Environmental Objects


Required Files

Download and unzip the following file (using WinZip) into the relevant folder of your working directory.

models_axes_rotated.zip (50.5Kb)

This file contains:

back to top | return to Environmental Objects


Tutorial

Launch Cosmo Worlds and Open the file camera_axes.wrl
Switch to the Perspective View

+ P

Note: the background is only visible in the perspective views.

 

 

Create a new default background node.

Note: The Background Icon is on the Create Extras toolbar which is not visible by default. To activate it use View Menu > Toolbars > Create Extras.

In the Outline Editor open up the Background node by clicking on the
Open up groundAngle by clicking on it then right-mouse-button click and select Insert Field Value from the pop-up menu.
Type an angle of 1.15 in the new field and hit ENTER.
Repeat the above steps to add another field with a value of 0.9. This completes the ground angles.
Use the same techniques to complete the remainder of the background node as per illustration.

The final gradient colour background should look something like this.

Experiement with the colour and angle numbers to better understand the RGB (Red, Green, Blue) and radian notation.

Save your work.  
Preview in Cosmo Player.  

back to top | return to Environmental Objects