texture styles orientation guide tips,tricks more blocks actions sprites popups lighting sound linking orientation textures navigation mulitilevels body tag head tag starting welcome

We have already discussed the <AMBIENT_LIGHT> tag, which goes in the <HEAD> section of the 3DML file. Ambient_light lights everything in your SPOT evenly, without creating any shadows. If you are going to be using lighting effects in your SPOT, then you should set your ambient_light relatively low (around 50% or less), so that your other lights will show up more dramatically.

Aside from AMBIENT_LIGHT, there are three different categories of light: ORB light, POINT_LIGHT, and SPOT_LIGHT. ORB light is light that shines from a specific direction in the sky, illuminating the entire SPOT. POINT_LIGHT is light that shines in all directions from a specified location. SPOT_LIGHT is light that shines in a specified direction from a specified location.

The ORB tag
<ORB TEXTURE="folder/image.gif" POSITION="(turn,tilt)" BRIGHTNESS="percentage%" COLOR="(red,green,blue)"/>
The ORB tag allows you to place a light source in the sky that affects your entire SPOT, much like the sun or moon would in the real world. When you use the ORB tag, you also have the ability to "hang" a sun or moon texture in the sky. There is at least one default ORB texture that is included in each blockset. In the Basic Blockset, that texture is a bright sun. There is a full moon texture included in the Village Blockset. And of course, you can specify a texture of your own, in which case your "sun" may look like Geraldo Rivera if you wish. Its entirely up to you. The ORB tag is always placed in the HEAD section of the 3DML file.

No matter what texture you use in the sky, light will shine from the location of the texture illuminating the entire SPOT. Unlike AMBIENT_LIGHT, light from the ORB will create shadowed areas. Ambient light will illuminate all areas of a SPOT, regardless of whether or not they are exposed to the sky. But ORB light will only illuminate surfaces that face the light source.

Tilting your orb... POSITION refers to where the orb will sit in the sky. POSITION is expressed as a pair of angles called "turn" and "tilt". The turn angle specifies what direction the orb will be in. Possible values are from 0-359, with 0 refering to north, 90 to east, 180 to south, etc. The tilt angle defines how high in the sky the orb will appear. Possible values range from -90 to 90, with 0 being at the ground, or "horizon", 90 being directly overhead, etc.

BRIGHTNESS defines how bright the orb light will be. And TEXTURE defines what image will be displayed. BRIGHTNESS will be 100% by default, and the default ORB texture will be displayed in the sky if no other TEXTURE is specified.

COLOR allows you to define the color of the light, but colored light will only appear to users who have 3D acceleration hardware. Other users will see the normal white light.

You can also turn your ORB into a hyperlink by adding an HREF parameter:

<ORB TEXTURE="folder/image.gif" POSITION="(turn,tilt)" BRIGHTNESS="percentage%" COLOR="(red,green,blue)" HREF="url" TEXT="text" TARGET="target_frame"/>

Add ORB light to your SPOT.
First, you'll want to lower the AMBIENT_LIGHT in your SPOT so that your lighting effects will show up. In tallspot.3dml, change the <AMBIENT_LIGHT> tag in the <HEAD> to read:


Then place the following tag in the HEAD section of tallspot.3dml:

<ORB POSITION="(45,45)" BRIGHTNESS="60%"/>

There are two different styles of POINT_LIGHT: static and pulsate. Static POINT_LIGHTs are good for lighting a general area of a SPOT. Pulsating POINT_LIGHTs are good for alien abduction scenes. (OK, and a few other more mundane things as well. But alien abductions are the preferred way to use them!) The tag looks like this:

<POINT_LIGHT STYLE="static" POSITION="(x, y, z)" BRIGHTNESS="n%" RADIUS = "#_of_blocks" FLOOD="yes|no" COLOR="(red,green,blue)"/>

Here, POSITION refers to the placement of the light within the block space. POSTION="(0,0,0)" would place the light at the bottom southwest corner of the block. POSTITION="(128,256,128)" would place the light in the middle of the top of the block. Lights will be placed in the center of the block (128,128,128) by default if no POSITION is defined.

BRIGHTNESS defines how bright the light will be at the position of the source.

RADIUS defines how far from the source the light will be visible. If RADIUS="4" and BRIGHTNESS="90%", then the light will be 90% brightness at the location of the light source, and will fade gradually to whatever the ambient_light level is 4 blocks away.

That is, unless FLOOD is set to "yes". FLOOD="yes" will cause the light to flood the entire radius at the specified brightness level. In the above example, if FLOOD were turned on, then light would appear at 90% brightness for the entire 4 block radius, and the light would drop sharply to the ambient level at the edge of the 4 block radius. The FLOOD parameter defaults to "no".

COLOR allows you to define the color of the light, but colored light will only appear to users who have 3D acceleration hardware. Other users will see the normal white light.

Note that every polygon inside of a light's radius will not necessarily be illuminated. Only those polygons that face the light will be lit. A polygon that is within the radius of a light, but is not facing it, will not be affected by the light..

The tag for a pulsating POINT_LIGHT is slightly different:

<POINT_LIGHT STYLE="pulsate" POSITION="(x, y, z)" BRIGHTNESS="min%..max%" RADIUS = "#_of_blocks" FLOOD="yes|no" COLOR="(red,green,blue)" SPEED="cycles_per_second" />

Notice that the BRIGHTNESS parameter describes a range between two values. And there is an added SPEED parameter. If BRIGHTNESS="20%..80%" and SPEED="2", then the light level will pulse from 20% to 80% and back again twice every second. You can slow the pulse down by assigning a value less than 1 to the SPEED parameter. SPEED=".25" would create a light that takes four seconds to raise to its brightest level and back again.

Turn Smileys into Alien Abductors
Go back to the <CREATE> tag for your smileys in tallspot.3dml [the "c" symbol you created], and add the following POINT_LIGHT:

<POINT_LIGHT STYLE="pulsate" POSITION="(128,0,128)"
BRIGHTNESS="20%..90%" RADIUS="1" FLOOD="yes" COLOR="(0,0,255)" SPEED="1" />

So the entire <CREATE> tag for the "c" block will look like this:

<CREATE SYMBOL="c" BLOCK="ceiling">
<PART NAME="top" TEXTURE="images/smiley.gif" />
<PART NAME="bottom" TEXTURE="images/pinkmarble.gif" />
<SOUND FILE="sounds/guffaw.wav" VOLUME="100%" RADIUS="2" PLAYBACK="random" />
<POINT_LIGHT STYLE="pulsate" POSITION="(128,0,128)" BRIGHTNESS="20%..90%" RADIUS="2" FLOOD="yes" COLOR="(0,0,255)" SPEED="1" />

Pulsing... This will make a pulsating light UNDER all of your smileys. Remember, your smileys are ceiling blocks with smiley faces on the top of the block space. This POINT_LIGHT is assigned to the bottom of the block space. Your smiley textures will not be lit by it because they face away from it. In order to light the smiley textures themselves, you would want to place a light above the smiley blocks, in level 3 of your map.

There are 3 different kinds of SPOT_LIGHT: static, search, and revolve. A searching SPOT_LIGHT moves back and forth between 2 specified points. A revolving SPOT_LIGHT rotates in a defined circle.

The tag for a static SPOT_LIGHT looks like this:

<SPOT_LIGHT STYLE="static" POSITION="(x, y, z)" BRIGHTNESS="n%" RADIUS="#_of_blocks" FLOOD="yes|no" COLOR="(red,green,blue)" DIRECTION="(turn, tilt)" CONE=angle"/>

POSITION, BRIGHTNESS, RADIUS, FLOOD, and COLOR all work the same here as they do for POINT_LIGHTs.

DIRECTION describes where the SPOT_LIGHT is focused, and is expressed as a pair of angles. If no DIRECTION parameter is present, the light will face exactly north and horizontal to the ground plane by default, [or DIRECTION="(0,0)"]. The first angle is called the "turn". The turn angle describes rotation in the horizontal plane. Possible values range from 0 to 359, where 0 is north, 180 is south, etc. The second angle is called the "tilt" and describes how far above or below the horizontal plane the light points. Possible values range from -90 to 90, where 0 is horizontal to the ground, 90 points straight up, and -90 points straight down. With the turn and tilt angles, you can describe any possible direction for your light to point.

CONE describes how wide the SPOT_LIGHT is. CONE is the diameter of the influence of the light, expressed as a degree, (0 to 359). The default value for CONE is 45.

So a SPOT_LIGHT with DIRECTION="(45,0)" and CONE="90" would illuminate the northeastern corner of a scene (assuming that the SPOT_LIGHT is in the center of the scene.) The turn angle is 45 pointing directly northeast, the tilt angle is 0 pointing parallel to the ground plane, and the CONE is 90 which spreads the light out over a 90 degree area from the north axis to the east axis.

DIRECTION="(0,-90)" would create a light that points straight down.

Searching SPOT_LIGHT
The tag for a searching SPOT_LIGHT would look like this:

<SPOT_LIGHT STYLE="search" POSITION="(x, y, z)" BRIGHTNESS="n%" RADIUS="blocks" FLOOD="yes|no" COLOR="(red,green,blue)" DIRECTION="(turn1,tilt1)..(turn2,tilt2)" CONE = "angle" SPEED="cycles_per_second" />

In a search style spot_light, you can define 2 different DIRECTIONs and the search light will move smoothly back and forth between the two DIRECTIONs. The path that the search light takes between the 2 defined DIRECTIONs is determined by which DIRECTION has a higher value for its turn angle. (This may get a little complicated, so hold on tight.) The light will always travel from the lowest turn angle value to the highest. Values for the turn angles can range from -359 to 359. To make a search light that moves between a point directly north to a point directly east, you would designate DIRECTION="(0,0)..(90,0)", and the light would travel clockwise from the north horizon to the east horizon. But what if you wanted a light to travel between the same 2 points, but to go the long way around, passing by the south and west horizons on the way? Then you would change the value of the eastern direction to read (-270,0). DIRECTION="(0,0)..(-270,0)" would create a light that travels clockwise from the eastern horizon to the northern horizon and back again, passing through the south and west on the way.

SPEED determines how fast the search light will move between the 2 DIRECTIONs. SPEED is expressed as cycles per second. SPEED="2" would make a light that moves from DIRECTION 1 to DIRECTION 2 and back again twice per second.

Revolving SPOT_LIGHTs.
To create a revolving SPOT_LIGHT use the following code:

<SPOT_LIGHT STYLE="revolve" POSITION="(x, y, z)" BRIGHTNESS="n%" RADIUS="blocks" FLOOD="yes|no" COLOR="(red,green,blue)" DIRECTION="(turn1,tilt1)..(turn2, tilt2)" CONE="angle" SPEED="revolutions_per_second"/>

This tag is very similar to the syntax for the search light, but the light will continue in a full circle through the 2 specified directions. If the turn angle of the first DIRECTION is smaller than the second one, then the light will rotate in a clockwise direction. If the second turn angle is smaller, then the motion will be counterclockwise.

Placing Lights in Your SPOT
There are three different ways to describe light in a 3DMLfile:

1. Adding lights to blocks using the <CREATE> tag

2. Assigning lights to particular locations in the map.

3. Using LIGHT Blocks

The tags that describe POINT_LIGHTs and SPOT_LIGHTs can be placed in the <CREATE> tag of any block. Remember that a light included in a <CREATE> tag will appear in every instance of that block in the map. Note that a block can only have one light assigned to it.

Alternately, a light can be assigned to a specific location in your map, regardless of what block might be there. To do this, simply put your light tag in the body of your 3DML file (usually near the end with your entrances and exits). You will also need to add a LOCATION parameter to the light tag to place the light at a specific location in the map. The LOCATION parameter works just the way it did for sounds:

LOCATION="(column, row, level)"

Add a Search Light.
In tallspot.3dml, add the following tag to the end of the BODY, just before your entrances and exits:

<SPOT_LIGHT STYLE="search" POSITION="(1,1,128)"
DIRECTION="(17,3)..(132,3)" CONE="30" SPEED=".5" />

This should give you a SPOT_LIGHT that searches back and forth between the two portals on level 1 of tallspot.3dml

New Blocks
The POINTLIGHT Block "'" (that's a single quote)
The POINTLIGHT Block has no 3D model. A visitor won't see any object where the POINTLIGHT Block sits, but light will emanate from it, lighting the surrounding blocks. By default, the POINTLIGHT Block is a static POINT_LIGHT at 100% brightness and a RADIUS of 4.

Add a LIGHT Block
Now change the code for Level 2 to look like this:


This should give you a bright light over the ramp area.

Downstairs in the tall spot.
Save your file and open it in your browser to see the light. (Don't you wish illumination was always this easy?) You should see pulsing lights in the four corners of the first level of tallspot.3dml (and they will be blue if you have 3D acceleration hardware), a search light that roves between the two portals, and a constant bright light over the ramp area. You will also notice that the ORB light is visible even when you are "inside". Lights in 3DML do not cast hard shadows. The ORB light shines right through the "roof" and illuminates the walls that face it inside as well.

code spot next

Copyright 1999, 2000 Flatland Online, Inc.