View Full Version : Polygon Textures
12-05-2001, 10:39 PM
I'm trying to place some photo textures in polygons. The problem is that when a place a 256x256 bmp in at a scale that should exactly fill the polygon, the bottom left corner of the bitmap is in the center of the polygon and it tiles the parts accordingly, so that the bottom left part of the texture is in the upper left, the bottom right is in the upper left, etc.
I assume that this is because Airport 2.60 places the corner of a texture in the center of the polygon. Is there any way to offset the textures so that they display correctly.
I'm using a scale of 2 so that a 256x256 bmp covers a 512m x 512m area.
12-06-2001, 05:35 PM
I don't know that Airport intentionally puts the bitmap corner in the center. The SCASM code for the polygon loads a bitmap file and then passes along the outline of the polygon. How SCASM and FS internally deal with that is beyond my scope of knowledge. The scale factor is an interesting parameter that I'm not sure I fully understand anymore. It goes on the refpoint() command and changes the scale of the coordinates of the outline, but I'm not sure what it does with the bitmap scale. When time permits I'll try to find what the SDK says about this.
12-13-2001, 07:17 PM
I did some checking in the scasm code and checking in the scasm reference. With a square polygon Airport computes the Lat/Long RefPoint at the center of the polygon. This is also the RefPoint for insertion of the bitmap. Since Airport then offsets the corners of the polygon to draw it, the corners of the polygon and the corners of the bitmap no longer coincide. If I change the offset in the Bitmap line to match the lower left point in the polygon I can then get the bitmaps to come in correctly.
The following line:
Bitmap( PVU1r1u.bmp 0 0 0 0 )
when changed to
Bitmap( PVU1r1u.bmp 0 -127 0 -127 )
will offset the origin of the bitmap down and left by 127 pixels in each direction (1/2 of a 256 pixel bmp).
This will then line up the bitmap correctly.
It is a bit tedious to go into the scasm file and change the insertion point for the bitmaps (thank goodness for find and replace!) but this is the workaround that I found.
Tom, I don't know if in the future you might include an option on polygons to place the RefPoint coincident with point 1 of the polygon.
12-16-2001, 08:39 PM
Instead of trying to use a regular polygon for photo-real or edited images, the "Textured Polygon" or TexPoly is usually used within FS for this purpose.
Although Airport doesn't support TexPolys yet I've written two tutorials about editing and adding photo-real images with the freeware Ground Maker program that does include TexPolys within it's menu. You'll find the tutorials on the Scenery Design Help and Tools web page found within the Airport Help menu. Or you can download them here as well:
I also think it should be noted that polys and or texpolys can only be placed as FLAT images onto a FLAT FS surface and this works well for use within FS2000 and earlier FS versions but FS2002 views these as backward compatable as a new format TMF (Terrain Mesh File) is now the default type of ground covering.
The new technique of adding Terrain Files can be used with or without terrain data and will place your created image onto the FS surface as WET tissue paper conforming to the elevations of the default FS surface. You'll also notice the new type texture format within FS2002 called DXT1 bitmaps which are placed onto the FS ground with the above mentioned Terrain File. The new water effects can be simply added to areas of the image by placing a transparant black alpha channel color.
You'll find more information about the new process within the FS2K "Terrain SDK" documentation and at the ##### scenery design forums.
I hope this helps
12-17-2001, 09:03 AM
You're right about how airport uses the center point for the reference point. This is a design feature from day 1 of the program, but I was not aware of it's impact. One reason to use the center point is to keep the coordinates within the limits of integers, especially when a scale factor is less than one. For example, a polygon can go from -20000 to +20000, but can't go from 0 to 40000. (32767 being the limit). But this can be worked around also.
Changing this is not a big deal - I'll look at it. Putting in Ken's Texpoly would be great also but maybe more work. I'll see what I can do on the next build.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.