Ground polygons (ASM tweak): Difference between revisions
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
How to create ground polygons with GMax is an often asked question. This article will try to guide you through that process, as it takes some tweaking the get the correct results. | |||
How to create your ground polygons is outside of the scope of this article. Basically you can just draw them like any polygon and then map the texture you want on it. The only difference is that the polygons are on the ground, so they have a z-coordinate of zero. | |||
Please note that if you want your ground polygons to be compatible with FsX (with the SP1 installed), you need to make sure that the vertices of your ground polygons are not further away from each other then 100 meters. So if you have a big polygon, you might have to split it into smaller pieces. If you keep this additional restriction in mind, you will not have trouble with the added earth curvation of FsX. | |||
==Fs2002 gamepack== | |||
The first complication is that you need to use the Fs2002 gamepack. This is because the MDL format used by the Fs2004 and FsX gamepacks is not really suitable for creating ground polygons. When using them you for example get flickering polygons and the shadow of other objects is also not displayed correctly on it. With the Fs2002 gamepack we can apply some tweaks to prevent these trouble. | |||
But you can not download the Fs2002 gamepack from the internet, some files only came with the Fs2002 Pro CD. So if you don't own that version of FS (anymore) you have a little problem. A work around is to use MDLCommander with the Fs2004 gamepack and then run the [http://www.fsdeveloper.com/wiki/index.php?title=Saving_X_files_using_MDLCommander X file] that you saved through the Fs2002 MakeMDL manually. | |||
Be sure that you use the [http://www.scenery.org/tutorials_fs2k2_SDK.htm latest version] of the Fs2002 MakeMDL, as the initial version does not allow you to save the ASM source files that you need to tweak later on. For a basic introduction to saving and compiling ASM source, please refer to this [http://www.fsdeveloper.com/wiki/index.php?title=Beginners_guide_ASM_tweaking article]. | |||
==Tweaking the ASM code== | |||
So now that you have saved your ASM source files, it is time to start tweaking them. What we are going to change in the ASM file are a few commands that by default call your polygons as if they are a 3D object. But there is also another call for ground polygons, when this call is used the flickering and shadow problems are solved. | |||
In | So open your main ASM file and look for the following lines of code: | ||
OBJECT_0_START label word | |||
IFIN1 OBJECT_0_FAIL, image_complex, 2, 32767 | |||
ADDOBJ OBJECT_0_SCALE | |||
SHADOW_CALL OBJECT_0_SCALE | |||
OBJECT_0_FAIL label BGLCODE | |||
In this code the ADDOBJ command is the one that is calling your polygons as a 3D object. So this is the one we will change in the ADDCAT command used for ground polygons. The ADDCAT command also has an additional parameter that sets the layer of your ground polygons. So this can be used to layer different ground polygons on top of each other. In this article we will set the layer to 8, it is common practice to use only layers that are a multiple of 4 (so 0, 4, 8, 12, 16, 20, ...). | |||
We will also remove the SHADOW_CALL command, as ground polygons are not really able to cast a shadow on the ground. So after applying these two tweaks you are code should look something like this: | |||
OBJECT_0_START label word | |||
IFIN1 OBJECT_0_FAIL, image_complex, 2, 32767 | |||
ADDCAT OBJECT_0_SCALE, 8 | |||
OBJECT_0_FAIL label BGLCODE | |||
One final note. This change only works if your source only contains ground polygons. If you have a scene with both ground polygons and 3D objects, use the "Export selected..." feature from GMax to export the ground polygons and the 3D objects seperately from each other. | |||
[[category:Scenery design]] | [[category:Scenery design]] | ||
Revision as of 14:56, 12 July 2007
How to create ground polygons with GMax is an often asked question. This article will try to guide you through that process, as it takes some tweaking the get the correct results.
How to create your ground polygons is outside of the scope of this article. Basically you can just draw them like any polygon and then map the texture you want on it. The only difference is that the polygons are on the ground, so they have a z-coordinate of zero.
Please note that if you want your ground polygons to be compatible with FsX (with the SP1 installed), you need to make sure that the vertices of your ground polygons are not further away from each other then 100 meters. So if you have a big polygon, you might have to split it into smaller pieces. If you keep this additional restriction in mind, you will not have trouble with the added earth curvation of FsX.
Fs2002 gamepack
The first complication is that you need to use the Fs2002 gamepack. This is because the MDL format used by the Fs2004 and FsX gamepacks is not really suitable for creating ground polygons. When using them you for example get flickering polygons and the shadow of other objects is also not displayed correctly on it. With the Fs2002 gamepack we can apply some tweaks to prevent these trouble.
But you can not download the Fs2002 gamepack from the internet, some files only came with the Fs2002 Pro CD. So if you don't own that version of FS (anymore) you have a little problem. A work around is to use MDLCommander with the Fs2004 gamepack and then run the X file that you saved through the Fs2002 MakeMDL manually.
Be sure that you use the latest version of the Fs2002 MakeMDL, as the initial version does not allow you to save the ASM source files that you need to tweak later on. For a basic introduction to saving and compiling ASM source, please refer to this article.
Tweaking the ASM code
So now that you have saved your ASM source files, it is time to start tweaking them. What we are going to change in the ASM file are a few commands that by default call your polygons as if they are a 3D object. But there is also another call for ground polygons, when this call is used the flickering and shadow problems are solved.
So open your main ASM file and look for the following lines of code:
OBJECT_0_START label word IFIN1 OBJECT_0_FAIL, image_complex, 2, 32767 ADDOBJ OBJECT_0_SCALE SHADOW_CALL OBJECT_0_SCALE OBJECT_0_FAIL label BGLCODE
In this code the ADDOBJ command is the one that is calling your polygons as a 3D object. So this is the one we will change in the ADDCAT command used for ground polygons. The ADDCAT command also has an additional parameter that sets the layer of your ground polygons. So this can be used to layer different ground polygons on top of each other. In this article we will set the layer to 8, it is common practice to use only layers that are a multiple of 4 (so 0, 4, 8, 12, 16, 20, ...).
We will also remove the SHADOW_CALL command, as ground polygons are not really able to cast a shadow on the ground. So after applying these two tweaks you are code should look something like this:
OBJECT_0_START label word IFIN1 OBJECT_0_FAIL, image_complex, 2, 32767 ADDCAT OBJECT_0_SCALE, 8 OBJECT_0_FAIL label BGLCODE
One final note. This change only works if your source only contains ground polygons. If you have a scene with both ground polygons and 3D objects, use the "Export selected..." feature from GMax to export the ground polygons and the 3D objects seperately from each other.