World Wide Guide to FS Scenery Design | Knowledge Bank | Buildings


Complex buildings: How to solve drawing problems

by Greg Smith, Melbourne, Victoria, Australia
<GSmith@vnpbanp1.telstra.com.au>

Two common problems with complex buildings in MS Flight Simulator are:

  • Polygon vector calculation for correct surface drawing
  • Object drawing order - viewing angle dependency.

View/Download the Silo

SCASM Macro
by Greg Smith

I was designing a SCASM macro for some grain silos for the Wimmera region of Victoria, Australia, and encountered these problems. I think I have found a different solution to these problems to those described by Peter Jacobson for the SCASM compiler.

Background

The silos consisted of 3 cylinders joined together, a roof, two huts (houses) on top of the roof, and two more cylinders attached to the main silo tower, for example:

                ---  ---
                | |  | |
           ------------------
            |    |    |    |
      /\    |    |    |    |    /\
     /  \  /|    |    |    |\  /  \
    /    \/ |    |    |    | \/    \
    |    |  |    |    |    |  |    |
    |    |  |    |    |    |  |    |
    ---------------------------------
                    ^
                Refpoint

(Excuse the crude graphics -- that shows my UNIX background).

To treat this as a single SCASM macro, one would normally put the Refpoint at the centre of the object, define the points and draw the object. With the silos I had many of the polygon vector problems and surface drawing order problems. As an outer cylinder surface curves toward the Refpoint we have the vector problem which can be hard to resolve without resorting to manual vectors.

My Solution

The solution to these problems I found to be to treat each part of the building as a single object (entity) and a new PerspectiveCall. This is possible with SCASM 1.7 or later because we can use the relative (delta) Refpoint command to build a new Refpoint for each part of the building with each Perspective call.

For example:

Area( 5 %1 %2 21 ) ;Building called.
PerspectiveCall( :PC01 ) ;Perspective for object 1.
Jump( :E1 )
:PC01
Perspective
RefPoint( 7 :SubEnd1 1.00 d 0 0 v1= 20000 )
RotatedCall( :B1 0 0 %3 )
;%3 = rotation.

... ;code for center of building here.

Return
:E1
;End Object 1

; Object no.: 2 ;still part of same building
PerspectiveCall( :PC02 ) ;a new perspective call in the same area
Jump( :E2 ) ;for next part of building
:PC02
Perspective
RefPoint( 7 :SubEnd2 1.00 r %3 19 v1= 20000 )
     
;relative Refpoint so we can rotate
RotatedCall( :B2 0 0 %3 );building. %3 = rotation.

:SubEnd2
Return
:B2
ShadowCall( :C2 )
:C2
VecPoints( xy 0 0 60 0
; 0

.... ;and so on.

With this, I can build a part of the building with less concern over the vector calculation and the Refpoint, and I can then add the parts together without concern over the viewing angle, as the PerspectiveCall takes care of that.

Performance

I don't know what the impact of a separate PerspectiveCall for each part of the building has on the frame rate, or if there are any other side effects. So far, however, this seems to work for me...


Last updated 3 May1997 by Gene Kraybill. All rights reserved.