FLATLAND TUTORIAL Flatland home
texture styles orientation guide tips,tricks more blocks actions sprites popups lighting sound linking orientation textures navigation mulitilevels body tag head tag starting welcome
7 | THE <CREATE> TAG: CREATING AND CHANGING TEXTURES

All of the 3DML blocks are assigned particular textures, and sometimes sounds or other attributes. With the <CREATE> tag, you can customize many of these features. The <CREATE> tag works by telling the browser to take a Block it already knows, change a few things about it, and give it a new ASCII symbol to represent the new Block in the map.

Each kind of Block that is used in a 3DML file has a number of "parts" that make up its shape. You can change the texture of each of these parts with the <CREATE> tag. For example, the FULL block has 6 parts corresponding to the six sides of the cube. They are refered to as "n, s, e, w, top, and bottom", with n,s,e, and w, corresponding to north, south, east, and west.

Lets take a look at a sample <CREATE> tag:

<CREATE SYMBOL="a" BLOCK="FULL">
<PART NAME="n,s,e,w" TEXTURE="images/brick.gif" />
</CREATE>

This tag tells the browser that we are going to make a new Block, which will be referred to in the map as the ASCII character "a", and which will be shaped like a FULL Block. Then we tell the browser to change the texture on the 4 sides of the cube to be the file "brick.gif", located in the "images" folder. Note that the "top" and "bottom" parts of the block haven't been changed, and will appear with the default texture.

Image File Formats.
Rover supports .gif files, including animated or transparent gifs, and jpeg files.

Syntax Rules
There are some syntax details you'll need to keep in mind:

<CREATE> tags are placed in the <BODY>, before your first Level.

If you want to change all of the parts of a block to be a single texture, you can use "*" to refer to all parts at once:

<PART NAME="*" TEXTURE="images/brick.gif" /> would change all parts of a block to the brick texture.

In the BLOCK attribute, you can refer to the Block type either by its name "FULL", or by its default ASCII symbol "#". You can also reuse the ASCII characters that are assigned as defaults. For example, if you aren't going to use any unaltered FULL blocks in your spot, then you can assign the "#" character to one of your changed Blocks:

<CREATE SYMBOL="#" BLOCK="FULL">
<PART NAME="*" TEXTURE="images/brick.gif" />
</CREATE>

Now everytime you use the "#" character in your map, you will get FULL Blocks that are textured with brick.gif, rather than the default texture.

All blocks have default textures that arrived when you originally downloaded the blockset. If you want to use one of these textures on a different part or different block, you can do so by preceeding the texture name with a "@"

<CREATE SYMBOL="#" BLOCK="#">
<PART NAME="top" TEXTURE="@clouds.gif" />
</CREATE>

This would put the texture clouds.gif, which usually appears as the default sky texture, on the top of the FULL block.

Texture STYLEs
By default, textures will be "stretched" to fill the PART in question when you change a texture. If your texture is 64x64 pixels, and the part you are placing it on is 256x256, then the texture will be stretched to the appropriate size to fit the part. In this case, you would be making the texture 4 times its original size, which would probably cause the texture to pixelate (or lose resolution.) You also have a couple of other options if you use the STYLE attribute in the PART tag. With STYLE, you can set the texture to scale up to fill the PART, or you can set it to tile to fill the PART. STYLE="scaled" will simply grow the texture to the size of a full block (256x256), and apply that texture to the part in question. STYLE="tiled" will lay the texture out side by side of itself like tiles to fit the PART in question.Here are some examples of all three styles.

Texture PROJECTION
On some blocks, textures may not always appear exactly as you expected. This happens on curvy blocks, like spheres, domes, and the curvein and curveout blocks. To make a long story short, the way Rover usually projects textures onto blocks just doesn't work well for these curved blocks. For these blocks, it works best for the texture to be projected from just one side, and you can specify which side with the PROJECTION parameter. Possible values are "top|bottom|north|south|east|west". PROJECTION is only necessary with textures that are "tiled" or "scaled" onto curved blocks. "Stretched" textures do not need the PROJECTION parameter.

Texture Orientation
Occasionally you may want to change the orientation of a texture on a part. For instance, you may want it to display upsidedown. You can achieve this by adding an ANGLE parameter to the create tag. Possible values for the ANGLE parameter range from 0-359. The texture will be rotated in a clockwise direction. ANGLE="180" would turn the texture 180 degrees clockwise, in effect turning it upside down.

Color and Translucency
You can also use the <CREATE> tag to assign a color to a PART of a block, rather than a texture:

<PART NAME="name" COLOR="(red,green,blue)" />

You can also set a PART to be translucent:

<PART NAME="top" TEXTURE="painting.gif" TRANSLUCENCY="50%" />

The translucency feature will only show up to users who have 3D acceleration hardware installed. Users who don't will see all opaque textures.

The FACES parameter
FACES specifies whether a texture is displayed on one, both, or none of the sides of a polygon. The default value is FACES="1" which means that textures are applied to just one side of a polygon. So with a full block in its default state, you can see the textures from the outside of the block. But if you were to step inside the block itself, you would not see anything, because the textures are not displayed on the "inside" sides of the polygons. But if you specify FACES="2", then the textures will be displayed on both sides of each polygon. This is particularly useful if you use a translucent or transparent texture on one part of a block. For instance, if you use a translucent texture on the south side of a full block, and you use FACES="2" for all the other parts, then you will be able to see the inside of the block when you look through the south side.

The FACES parameter can also be used to make polygons invisible, by using FACES="0". This will prevent textures from being displayed on both sides of the polygon, making it invisible. You still won't be able to walk through it though.

The FACES parameter goes in the PART tag.

SOLIDity
The SOLID parameter determines whether or not your visitors will collide with that particular PART of a block. If SOLID="no", then they will be able to walk right through that PART. The default value is SOLID="yes".

So the syntax for the entire PART tag is as follows:

<PART NAME="name" TEXTURE="folder/image.gif" COLOR="(r,g,b)" STYLE="tiled|stretched|scaled" PROJECTION="top|bottom|north|south|east|west" FACES="0|1|2" SOLID="yes|no" TRANSLUCENCY="number%" ANGLE="0-359"/>

The PLACEHOLDER texture
When a visitor first comes to view your SPOT over the Internet, it may take a few seconds (or even minutes depending the size of your texture files and the speed of the visitor's Internet connection) to download the custom textures that you have assigned to your blocks. The shape of your SPOT will be displayed much more quickly however. If Rover is ready to display a block, but the texture has not finished downloading from the Internet, then a PLACEHOLDER texture will be displayed until the custom texture arrives. Every BLOCKSET has a PLACEHOLDER texture associated with it that will be used by default, but you can also assign a different texture to act as the PLACEHOLDER. The <PLACEHOLDER> tag goes in the HEAD of the 3DML file and has just one attribute: TEXTURE.

<PLACEHOLDER TEXTURE="image file path or URL" />

You can also use different colors as placeholders on specific blocks by using the COLOR attribute in the <CREATE> tag. If a <CREATE> tag has both a TEXTURE and COLOR attribute, then the color will be displayed as a placeholder until the image file arrives.  This feature is useful if you want to try to approximate your final textures before they download.  For instance, if one of your textures looks like water, then you could take a blue color from that texture and use it instead of the placeholder texture while the full texture downloads.

About Downloading Textures
Textures will be downloaded in the order in which they appear in the 3DML file, so it is a good idea to put the <CREATE> tags for the blocks that appear near the entrance to your SPOT first in your 3DML file. This way your visitors can begin to see your SPOT the way you intended without having to wait for the entire download to finish.

Or you can use the LOAD tag to force Rover to load textures in a different order. When Rover encounters a LOAD tag in a 3DML file, it will load that image at that time, before moving on to the next CREATE tag. The syntax for LOAD looks like this:

<LOAD TEXTURE="folder/image.gif" />

Change a texture in your spot
Put the following code in your tallspot.3dml file, just after the <BODY> tag:

<CREATE SYMBOL="#" BLOCK="full">
<PART NAME="n,s,e,w" TEXTURE="images/pinkmarble.gif" />
</CREATE>

<CREATE SYMBOL="-" BLOCK="ceiling">
<PART NAME="bottom" TEXTURE="@edgetop.gif" />
</CREATE>

Putting textures in your spot. Save your file and open it in your browser. The walls of your SPOT should now appear to be pink marble, and the ceiling should be a sort of metal screen-like texture. If you go up onto the roof, however, you will see that the top of the ceiling blocks haven't changed.

code spot next

 



Copyright 1999, 2000 Flatland Online, Inc.