LAST EDITED ON Aug-02-02 AT 09:55 PM (EDT)
Below is a fragment from the top of my Series 30000 cab (cvf) file. I've deliberately split it into 3 blocks showing the front, left & right view segments (using ----, which are NOT in the real file). Each contains the same set of definitions, but the details and values will vary. I'll explain why below...Tr_CabViewFile (
CabViewType ( 1 )
-------------------------------------------------
CabViewFile ( 30k-cab-fwd.ace )
CabViewWindow ( 0 0 640 300 )
CabViewWindowFile ( 30k-cab-fwd.ace )
Position ( 0 3 5.25 )
Direction ( 10 0 0 )
--------------------------------------------------
CabViewFile ( 30k-cab-left.ace )
CabViewWindow ( 0 0 640 370 )
CabViewWindowFile ( 30k-cab-left.ace )
Position ( 0 3 5.25 )
Direction ( 5 -57 0 )
---------------------------------------------------
CabViewFile ( 30k-cab-right.ace )
CabViewWindow ( 0 0 640 370 )
CabViewWindowFile ( 30k-cab-right.ace )
Position ( 0 3 5.25 )
Direction ( 5 57 0 )As you see, there are 5 definitions for each view. Here's what they are for:CabViewFile - defines the graphic (ace) file used for the view. This will be different for the 3 views. Usually they are front, left and right - but some folks use the "left or right" to show maybe a view through a rear window. Regardless, 3 ace files are needed.CabViewWindow - the 4 coordinates describe the upper left and lower right corners of the approximate area that will be transparent (using the alpha channel in the ace file) such that the outside world will be visible through windows. This rectangular area should be slightly larger than the area needed. If it's too small in either axis, you'll see part of the outside world missing, being replaced by a white area. You have to estimate the area needed and "try it and see" until you get it right. Arguably you could use a top-left of 0,0 and a lower-right of 640,480, but if you don't really need an area that big, you're wasting compute cycles as the graphics engine keeps testng and realizing that the cab does indeed occlude that outside view for some areas and it should paint the cab interior and not the outside view.
The 4 values represent, in order:
Xmin, Ymin, Xmax, Ymax.CabViewWindowFile: I usually define this the same as the CabViewFile.The final 2 (position and direction) are critical to getting the views to match the cab ace file views. If they're wrong, the overall effect of the cab interior and the "out the window" view just won't look right. Here's what the values mean and a few tips on getting them right (or at least, close).Position (X,Y,Z)
This represents the position of the "driver's head" (actually, eyes) and thus presents an outside view based on that position. The X,Y,Z refer to the coordinates of the "eyes", where X = left/right (0 = center of cab, negative = left, positive = right), Y = up/down (positive is up), Z = forward/backward (positive = forward).These position coordinates should be the same as the camera location used to create the cabview graphic (e.g. in 3D Canvas). If you're working from a photo (or photo/graphic mix), then you'll have to estimate and "try it and see" until it looks right.Direction(X,Y,Z)
These define any rotation (0,0,0 would be straight ahead & horizontal) about the specific axis. This takes a little visualizing. Changing the X value does NOT cause a left/right swivel of the head (as you might imagine), but rather a rotation about the X axis. As the X axis runs left/right, rotation would be similar to aircraft pitch (nose up/down) or "tilt" if you imagine a camera. Similarly, Y axis rotation (Y is the up/down axis) would cause rotation similar to a camera "pan left/right". It is rare to have the Z axis rotation be non-zero, as this would imply the driver's head was leaning to one side (aircraft roll motion, or the cameraman leaning over to one side).You have to figure out the position and rotation for the 3 views. The above example (from the cvf file) shows front, left and right. Let's now examine the values and figure out what we should see...Position -- all 3 views (in my case) use the same position. The driver is thus securely seated and not wandering about the cab, peering out the back window, or whatever. The values of 0, 3, 5.25 indicated the view is centered (left/right), is +3 up and +5.25 forward. I determined these from the coordinates I used in 3DC to create the graphic files. Again, if you're working from an existing photo or graphic and don't know these values, you have to experiment. You can usually judge the X fairly closely. E.g. roughly how far from the center of the cab is the view from? If the driver is sitting on the right and the cab is (say) 3 meters wide, then you mght start with X = (about) 2 to 2.5 (i.e. close to the right hand side). For the Y value, you have to look at the in-game view and decide. If you set it too low, the rails will appear too high up. Too high, and you'll appear to be way high above the tracks.The Rotation values, however do differ for each view as they represent where the driver is looking (think of a camera panning left/right and tilting up/down) -- the important values being Y and X respectively.In my example cvf file above, we see:Front rotation = 10, 0, 0.
This is a view straight ahead (Y = 0) and looking slightly downwards (X = 10). Again, this matches my 3DC graphic, but a value of between 0 and 10 should be close. This implies the driver is looking somewhere between the horizon and a point close to the train. I chose to have him look down a little from the horizon. The Z value is zero, implying the driver is awake and doesn't have his head lolling to the side Left rotation = 5, -57, 0
Y = -57 says we are loking 57 degrees to the left. This, again, matches my left view 3DC graphic. I noted afterwards that 57 degrees is almost exactly 1 radian. Whether is is meaningful or purely a coincidence I'm not sure. The angle just looks right. 45 deg doesn't seem enough, 90 deg seems overkill. However, if you aew working from a photo you will need to match this angle as best you can. If it's off, the scenery will not appear to pass by at the right angle (i.e. it won't appear to be parallel to the trains direction of motion). The X = +5 says we are looking down (tilt) slightly.Right rotation = 5, 57, 0
The only difference to the left view is the "pan left/right" is now +57, not -57. We are therefore looking right, not left. All else is the same.If you want to create a different view (say, out the back window), you will have to determine both the position and rotation coordinates for that specific view. Views need not be front/left/right, although it would be hard to drive without a front view, I feel Hope the above sheds some light on the mysteries of the cvf cab view and also that anyone else who knows will, without hesitation, correct any accidental mistakes I may have have made in the descriptions.Best regards, Jimi
Alert | IP
[ Home | MSTS Forum | MSTS FAQ | File Library ] Copyright © 2002 by Nels Anderson. All Rights Reserved.