Jump to content
Sign in to follow this  
Guest christian

tutorial 3: LOD and gmax

Recommended Posts

Guest christian

If you want to design scenery that has a lot of detail, but is also framerate friendly, there is no way around LOD (level of detail) models. The theory behind LOD models is to use several models of different detail, and displaying one of the models depending on how far you are away. If you are very close FS2002 should display a very detailed model, so you can see all the detail. When the you are far away, the model is much smaller on the screen, due to the perspective, and you can't see all that detail (on top of that the scene gets rendered to pixels, which only give a limited resolution). So drawing a detailed model would be wasted computing / rendering power. It makes more sense to use a less detailed model in that case.FS2002 allows for different LOD models and for 'per parts LOD' which allows to switch parts of your model on and off depending on distance. Per parts LOD can be done in gMax directly and doesn't require any source code modifications. However, per parts LOD has one disadvantage. You can't use it to have a seperate shadow model. Computing a perspective shadow is demanding a bit of processing power, so the less detailed the shadow model is the better. Usually, it doesn't matter if the shadow isn't very accurate, so using your lowest LOD model for rendering the shadow is mostly a good idea.On a side note, you can do even more advanced things with LOD models. For example, if you are using billboards (i.e. polygons that rotate towards the viewer) to render trees, you wouldn't get a very realistically looking tree shadow (i.e. it would be rectangular). You could make a simple 3D model for the tree that would cast a more realistic shadow instead.Making LOD models isn't all too hard. First, you'll have to create your models. Since buildings don't have all that much detail, I usually make 2 or 3. You don't want to create models that have too many changes, i.e. a sequence of models with small changes is ideal (but also more work). The reason for having multiple objects is that you want to have as few visible changes as possible. Changing from one model to another will be noticable (the so called popping effect), and ideally this is minimised by placing the transition so far away that changes are barely visible. However, sometimes the popping effect can't be avoided, for example, if you place a one million polygon city next to an airport. If the player's aircraft is in the vicinity of the airport, only a low detail city should be used, otherwise the amount of polygons to render might push the framerates to a limit where landing will become more of a gamble. Chances are the player is busy concentrating on the airport anyway rather than on the high detail city.Once the models are done, you'll have to rename them. Change the suffix of the gmax BGLC files, eg _0 becomes _0, _1, _2, etc. These will be your model files. Then you'll have to add this to your wrapper file (the one without a suffix), after the crash call: BGL_CALL model_0000_crash (insert after this) IFSIZEV object_LOD_0000_1L, 10000, 1000 BGL_JUMP_32 LOD_0000_0Lobject_LOD_0000_1L label word BGL_JUMP_32 LOD_0000_1LThe IFSIZEV controls the distance of LOD change, i.e. 10,000m correspond to 1000 pixel on the screen. In other words, when each pixel corresponds to 10m of the building (e.g., the building is 100m high and is rendered onto 10 pixels) the rendered model gets exchanged with another LOD model. There are other commands you could use, but this is what Microsoft used in the default scenery.At the end of the wrapper file you need something like this:LOD_0000_0L label word include object_0.asmLOD_0000_1L label word include object_1.asmThis will call your LOD model source files. Compile your wrapper file and drop it into your scenery folder.

Share this post


Link to post
Share on other sites

I missed this post somehow when it first was published, but it speaks to an area of scenery design that I'm attempting to master right now. However, in following the instructions to the letter (or so it seems), I'm getting a lot of "symbol redefinition" errors at compile time. Can someone post a simple example of an asm file with pointers to multiple LOD models? Either that or the wording for how one might reference, say, three levels of detail? There's no need ot include the actual _0 files, just the wrapper. The example seems to be for two, and only one of them has the LOD draw distances specified. I'm attempting to create 3 LODs for each bldg in my scenery to avoid "popping", and I'm hitting a wall.thanks,


Bill Womack

------------------------------------------------------------------------------------------------------------------------------------------------------

Visit my FS Blog or follow me on Twitter (username: bwomack).

Intel i7-950 OC to 4GHz | 6GB DDR3 RAM | Nvidia GTX460 1gb | 2x 120GB SSDs | Windows 7 Ultimate 64Bit

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...