SCASM 2.88

textures and polygons


command index:
back to main index
Bitmap( )
RepeatBitmap( )
BitmapMode( )
Smoothing( )
POverride / Inst_7D
MipMap( )
TextureBounds( )
TextureEnable( )
Palette( )
CustomColors( )
Poly( )
Concave / ConcavePoly
ShadedPoly( )
TexPoly( )
TexPolyShading( )
ShadedTexPoly( )
VecPoly( )
TexVecPoly( )
TexWindow( )
ElevationMap( ) / TexRelief( )
PolyM( )


FS5 - FS98, (FS2000/FS2002)
Bitmap( name.ext x dx dz dy )

Load a bitmap (texture) file from the active TEXTURE directory.
in FS5.0 and FS5.0a this is usually:
in FS5.1 this is could be:

Bitmap usualy have extensions '.R8' or '.txr' but there are also bitmaps with other extensions. I think the '.R8' extension should be reserved for the "global" textures which are stored in the genaral texture directory. Therefore I recommend to use your own extension if your texture is not supposed to be shared with other sceneries. However, some authors and users prefer to use always the .R8 extension for easier recognition of texture files. Therefore it is important to mention these extensions in your scenery documents.

name.ext  The name of the bitmap file. You cannot specify any drive or path name in this instruction (limit in BGL file format).
dx  x offset in RefPoint units
dy  y offset
dz  z offset, normaly 0
unknown (decimal). Often found values: 0, 1, 8

Note: The bitmaps for FS5 are a simple 256 x 256 pixel (/texel) arrays using 1 byte per pixel. Note the following x, y pixel adress:

top left 0
top right 255 0
bottom left 255
bottom right 255 255

For some reasons bitmaps drawn with Bitmap() - StartSurface - MovetoPt() ... Endsurface are drawn top down !
The standard color palette is stored in FS5.PAL (in FLTSIM5\TEXTURE dir). You cannot view/edit these bitmaps with normal drawing programms but there are several "R8" editors available in the web.
For CFS/FS2000 and later better use LoadBitmap.


FS5 - FS2000
RepeatBitmap( dx dz dy )

Repeat/reactivate a still loaded bitmap. Parameters are the same as in Bitmap().


FS5 - FS98 (FS2000)
BitmapMode( first_color )

It seems this command controls the handling of the pixels in a bitmap. This command sets the first color index number which is copied ito your scenery. Use this instruction only with TexPoly().

first_color  Decimal value 0 .. 255. This is the first color number to be copied. Do not forget to change back to 0 (normal). All colors from 0 to this value appearing to be transparent.

Note: It is reported to me that this command causes problems if used with the new FS2000 LoadBitmap() command. So use it only with the old FS5 Bitmap() command.


FS5 - FS98 ?
Smoothing( state )
AntiAlias( state )
Inst_81( state )

This instruction is found very often just following the Bitmap() instruction. It seems this instruction controls the image smoothing for ground textures. It comes into effect when the option image smoothing is set in the preferences display option menu.
TexWindow(), ShadedTexPoly()

state  0 off
1 on


FS5 - FS2002

Perspective Override
This instruction causes FS to use a special processor for the next 3 or 4 vertex textured polygon. This reduces the texture distortion.

This instruction is used very often just before TexPoly() and ShadedTexPoly(). It seems this instruction prevents the bend up effect of the bitmaps when getting close to it.


FS98 - ?
MipMap( state )

This instruction switches mipmapping on/off. This command is mentioned in the FS98 SDK but doesn't seem to work as expected.

state  0 off
1 on


FS5 - FS98
TextureBounds( x1 y1 x2 y2 )
MoveTexture( x1 y1 x2 y2 )
See FS98 SDK


2.20 | FS5 - FS98 ?
TextureEnable( s )

This instruction disables or enables an texture. Mainly this instruction is used to disable a texture after drawing a textured river or an textured taxiway to avoid strange effects on other objects.

state, s = 0 disabled, s = 1 enabled


FS5 - FS98 (FS2000 ?)
Palette( name.ext )

The color palette file 'name.ext' is loaded. You cannot specify a drive or path name since this BGL code only supports 8.3 DOS name convention. You do not need this instruction if you are using the FS5 default color palette for your bitmap/texture files.
Note, if you are using FS5.1 you will also need a corresponding *.HAZ file otherwise you cannot use the haze option with your scenery.


FS5 - FS98
CustomColors( dec_num )

This command is used to reduce the number of customised colors (normally 64) in the active color palette to gain some space for special night color effects. You must have (or generate) a matching color palette file.


FS5 - FS2002
Poly(vattr[ vx vz vylen ]pnum1 ... pnumn )
Poly(m  vx vz vylenpnum1 ... pnumn )
Poly(a    pnum1 ... pnumn )

A polygon is drawn with the points pnum1 to pnumn of the actual point list and with the actual surface color.
Note: All polygons are only visible only from one side. The vector parameters indicate the direction from where the polygon can be seen. The brightness of the used color varies with the angle of the light source (the sun, day of time).
It seems FS5 cannot handle more than 100 vertices in any single Polygon. Therefore SCASM now generates an error message on every ..Poly..() command if more than 100 vertices are detected. (in FS98 the limit may be 80 vertices) -> SurfaceColor(), -> Points()


FS5 - FS98

Indicate to the drawing system that a concave polygon follows. Does not work with bitmaps in FS5.0. Do not use this command if the following polygon is not concave since this slows down the frame rate.
- Poly(), - StartSurface - Move..() - Draw..() - EndSurface


FS5 - FS2002
ShadedPoly(vattr[ vx vz vylen ]pnum1 ... pnumn )
ShadedPoly(m  vx vz vylenpnum1 ... pnumn )
ShadedPoly(a    pnum1 ... pnumn )

A shaded polygon is drawn. The shading requires 3D points defined with the VecPoints() statement and ShadedColor(). The shading is used to get a smoth change of the brightness from one polygon to the next. This can make an octagonal object looking perfectly round.


FS5 - FS98 ?
TexPoly(vattr[ vx vz vy len ]pnum1 bx1 by1... pnumn bxn byn )
TexPoly(m  vx vz vy lenpnum1 bx1 by1... pnumn bxn byn )
TexPoly(a   pnum1 bx1 by1... pnumn bxn byn )
TexPoly(at   pnum1... pnumn )

Draws a polygon covered with a texture bitmap. The points has to be defined with the Point() command. The polygon is always drawn with the same brightness, regardless to the location of the sun. The brightness can be changed using TexPolyShading() if the bitmap is prepared for that (see -> TexPolyShading() ).
The bitmap-point bx1-by1 is tied to ptnum1 and so on. Image smoothing does not work with this command. Color shading can be done with TexPolyShading() and a special prepared bitmap.
-> Bitmap(), -> Points(), -> TexPolyShading()

pnum#  number (index) of a point from the point list
bx#  bitmap x coordinate (usually 0...255)
by#  bitmap y coordinate (usually 0...255)
(SCASM accepts values from -32768 to 32767)
t,b,r  see vattr, texture automatic


FS5 - FS98 ?
TexPolyShading( vx vz vy )
TexPolyShading( p  el hd )

This instruction sets the shading intensity of building bitmaps (side#.R8) in conjunction with textured polygons (TexPoly()).
This shading requires a special prepared bitmap file with 8 areas one for each of the 8 intensity steps).

vx x-vector component
vz z-vector component
vy y-vector component
format flag -> polar coordinates, vector will be converted to FS5 format by SCASM.
el angle of elevation
hd angle of heading


FS5 - FS2002
ShadedTexPoly(vattr[ vx vz vylen ]pnum1 bx1 by1 ... pnumn bxn byn )
ShadedTexPoly(m  vx vz vylenpnum1 bx1 by1 ... pnumn bxn byn )
ShadedTexPoly(a    pnum1 bx1 by1 ... pnumn bxn byn )

Draws a shaded polygon covered with a texture bitmap. The points has to be defined with the VecPoints() command.
The bitmap-point bx1-by1 is tied to ptnum1 and so on. The shading is done similar to ShadedPoly(). Bitmap colors above 127 are shown as black!
Parameters see -> TexPoly() command.


FS5 - FS ?
VecPoly(vattr[ dx dz dy vx vz vy ]pnum1 ... pnumn )
VecPoly(m  dx dz dy vx vz vypnum1 ... pnumn )
VecPoly(a   pnum1 ... pnumn )

A polygon is drawn with the point pnum1 ... pnumn of the actual point list and with the actual surface color.
This polygon command is very similar to the normal Poly(...) command. It seems the only difference is the origin of the visibility vector. In auto mode SCASM copies the coordinates of the first point (pnum1 -> dx,dz,dy) as the origin point of the vector and then calculates the vector components (vx,vz,vy) as usual.


FS5 - FS98 ?
TexVecPoly(a pnum1   bx1 by1 ... pnum#   bx# by# )
TexVecPoly(vattr   dx dz dy   vx vz vy
pnum1   bx1 by1
pnum#   bx# by# )

This is the textured VectorPolygon. This instruction draws a polygon using the points pnum1 to pnum#. Like other textured polygon commands each point is combined with a specific pixel of a bitmap.

vattr  vector attibutes (e.g. 'a') to indicate how SCASM should handle vector data.
automatic mode, dx,dz, dy, vx, vz, vy are taken and calculated from the first 3 points.
manual mode, all vector data must be entered.
t,b,r  see vattr, texture automatic.

dx,dz,dy  offset koordinates of a point on the polygons surface. You can chose one of the points defining this polygon.
vx,vz,vy  The 3 vector components.
pnum#  The point number (index)


FS5 - FS5.1
TexWindow(vattr[ vx vz vylen ]pnum1 ... pnumn )
TexWindow(m  vx vz vylenpnum1 ... pnumn )
TexWindow(a    pnum1 ... pnumn )

pnum# number (index) of a point from the point list

Defines a window through which a bitmap is shown. The window should not be concave.
Do not use it for FS6/FS95 or later sceneries !!


FS5 - FS2000
ElevationMap( ... )
TexRelief(x y   wx wy   dx dy
px py alt
px py alt )

A loaded bitmap is used to draw a textured relief on the ground. For this purpose a regular grid of rectangles is defined and each grid node is bound to a specific altitude and texture point.
Note, you are specifying the number of sides for the rectangels and the number of altitude points MUST match. The smallest grid is defined by X=1 and Y=1 and has 4 grid points (vertices).
This instruction should be used in a PerspectiveCall-ed subroutine. Be carefull, this command can be a real frame-rate killer.
Note: Since this instruction also includes crash detection you should use it only with RefPoint( abs ... ) and a corect altitude setting. In FS2000 it was also used with RefPoint( rel ... ).
-> PerspectiveCall, -> PerspectiveCall2()

x, y  amount of grid rectangles in x and y direction
wx  width of an grid rectangle in x direction (east-west
wy  width of an grid rectangle in y direction (north-south)
dx  x position offset of texture pixel 0, left bottom corner (related to the refpoint)
dy  y position offset of texture pixel 0 left bottom corner (related to the refpoint)
Pixel 0 is the south-west (bottom left) corner of the bitmap.
px  texture pixel x coordinate
py  texture pixel y coordinate
alt  altitude value for the given pixel and the current grid point (integer)


2.08 | FS98 - FS2000
PolyM(a    pnum1 ... pnumn )
PolyM(m  vx vz vylenpnum1 ... pnumn )
PolyM(vattr[ vx vz vylen]pnum1 ... pnumn )

This command draws a polygon similar to the Poly(..) type. A SurfaceColor() should be defined first. This polygon can be filled with a texture if the Bitmap() command is used. The advantage of this command is, that multible polygons can be drawn with this single command and every polygon can have one "concave point".
There is no need to use the ConcavePoly command, but you have to start with the "concave point". This point must be marked by a "-" sign, even if the point index is zero!
Note: Due to the binary format in the BGL code it is not possible to use point numbers larger than 127.

    Points( 0
        -327  0  861 ; 0
        -246  0  792 ; 1
        -101  0  619 ; 2
          43  0  135 ; 3
         309  0 -515 ; 4
         328  0 -740 ; 5
         269  0 -860 ; 6
         272  0 -540 ; 7
        -148  0  615 ; 8
        -260  0  751 ; 9
    SurfaceColor( 4 F0 )
    IfVarAnd( :B 340 FFFF )  ; textured ground ?
    Bitmap( desert.r8  8  128 0 128 )
    PolyM( a
        -8 9 0 1 2 3
        -7 8 3 4 5 6

TOP © Manfred Moldenhauer