Not signed in (Sign In)

Discussion Tag Cloud

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    •  
      CommentAuthorPhyter
    • CommentTimeFeb 2nd 2014 edited
     
    Note: I switched from spheres to teapots halfway through the making of this tutorial. Just wanted to mention that in case there was any confusion about the file or object names.



    NoLimits 2 features a number of optimization features that you can take advantage of to improve frame rate in highly detailed scenes. The ability to create custom levels of detail (LODs) for your scene objects and set Z-clipping distances for objects is extremely powerful and can have dramatic results.

    First, what is an LOD? An LOD is simply a copy of the 3D object but with a reduced polygon count to improve performance. These copies are then set to appear within a certain distance from the camera. Lower detailed LODs are set to appear in the background and higher detail LODs are set to appear when the object is very near the camera.

    You can have as many LODs as you like, but it is common practice to have at least three. The figure below shows A, B and C levels and the number of associated faces.



    You can tell that a scene comprised strictly of the C level objects would run more smoothly than a scene comprised of only the A level objects because the computer has to do substantially less work to render 256 faces versus 14400 faces.

    The first step is to create three files for each of our LODs. It is important that all of the objects are the same name; in other words each of these three files contains an object named "sphere". In this example we only have one object each file, but there may be more than one. And so the object names must match otherwise the system will not know which of the sub objects to affect.



    In the NL2SCO editor, create a new file and assign the "A" level object as the main model in the file.



    Go to the LOD tab and add the "A" level model. Even though the "A" level model is already assigned to the scene object file we still have to specify at what distance from the camera it will display. Let's set it to display from a distance of 50 ft.



    Set the LODs for the other two models at distances of 150 and 300 ft. respectively.



    Finally, let's set all meshes to clip at a distance of 500 ft. This is the distance at which the objects will disappear entirely, useful for crowded scenes where you're not going to be missing a lot of extraneous detail at far off draw distances.



    Now save the .nl2sco file and import it into the scene... about a million times!



    If you do a comparison between pre and post-optimized scenes the results can be significant. LODs not only provide you the opportunity to improve your frame rates, but also to cram more detail into your scene while maintaining a smoother and less variable frame rate.

    Watch a video comparison of the teapot park scene.
    • CommentAuthorC-A_99
    • CommentTimeFeb 2nd 2014
     
    How does NL2's built-in LOD setting affect custom object LOD's? Or does it not affect them at all?
    •  
      CommentAuthorPhyter
    • CommentTimeFeb 2nd 2014 edited
     
    The LOD option in the settings does not affect custom LODs. Happy to consider that as a future feature though.

    My bad, custom LODs are affected by the LOD setting! I do not know the formula. You are just going to have to experiment.
  1.  
    Excellent video and post Phyter, thanks.
    •  
      CommentAuthorL Bosch
    • CommentTimeFeb 2nd 2014
     
    Following the tutorial, I've started with my first LOD models today and I'm already running into problems:

    ...\example-lod1.3DS: Mesh/layer with the name 'example2169' not found in base LOD object. Mesh/layer will be ignored in this LOD.
    Of course my LOD1 model consists of less/different objects than my LOD0 model does, but other than that both models were set up exactly the same. In addition to these warnings the LOD1 model is looking strange in NL2b and not how it was set up to look like. I would be glad for any help.
    • CommentAuthorBuster
    • CommentTimeFeb 2nd 2014
     
    I think the error message explains it.
    On Lod1 there's a layer which is not in Lod0. That layer will be ignored (not rendered). If that layer is missing, it's likely that it looks strange.
    Make sure that you have consistent names in all Lods and don't introduce new ones.
    •  
      CommentAuthorL Bosch
    • CommentTimeFeb 2nd 2014 edited
     
    1. I'm not sure what you mean by layers. I have set up layers in 3ds Max but these are consistent though.
    2. I thought that the engine simply replaces the object source file once the LOD1 distance is reached, no matter of what the new object is. I wasn't aware of the ludicrous restriction of having to have the exact same object names, which is difficult for me as I usually rebuild a lot of meshes for the lower LOD version and it's not a simple teapot object.

    The given restriction makes sense, though, as I saw that the engine replaces each and every mesh that reaches the LOD threshold distance instead of replacing the whole 3ds file at once. Is there a way of telling the engine to let meshes no longer existent in lower LOD levels disappear without having to manually set up Z-Clipping?

    I also have multiple meshes in LOD0 (a 3d catwalk railing) that becomes a single mesh (an alpha texture railing) in LOD1. I guess I will have to combine these meshes in order to make things work. Setting up LODs in complex scenery objects seems to be a difficult task...
    •  
      CommentAuthorPhyter
    • CommentTimeFeb 2nd 2014 edited
     
    Posted By: L BoschOf course my LOD1 model consists of less/different objects than my LOD0 model does


    You can't do that. Each of your LOD files (LOD0, LOD1, etc..) must contain the same number of objects with the same exact names. In other words, if LOD0 contains objects sphere01 and box01, then LOD1 and LOD2 must also contain objects named sphere01 and box01 EVEN IF (and this is the important bit) only sphere01 changes from level to level. Does that make sense?

    Posted By: L Bosch2. I thought that the engine simply replaces the object source file once the LOD1 distance is reached


    No, the system is not replacing files it is replacing objects within the file. This a very important distinction to understand. The engine replaces the objects in the LOD0 file with the objects of the same name in LOD1 file when the distance is reached. So depending on your distance to the objects you may be seeing part of the LOD0 file and part of the LOD1 file simultaneously. So if certain LOD files are missing objects or object names have changed, then it will throw the "not found" exception that you're getting.

    Posted By: L Bosch wasn't aware of the ludicrous restriction of having to have the exact same object names,


    This is knee jerk reaction. It is not a restriction, it is a feature, and a very good one in our opinion. If we didn't require you to match names in the LOD files, then the LODs would only work on a per file basis rather than a per object basis, and that would be a lot less useful. The naming requirement actually opens things up and in the end will make things much easier, because it allows you to build LODs from an overworld model and play with detail levels where it will help you the most. If you were limited to file per file LODs your work load would be huge; it would be unmanageable. So actually the name requirement is a good thing.

    Posted By: L Bosch I also have multiple meshes in LOD0 (a 3d catwalk railing) that becomes a single mesh (an alpha texture railing) in LOD1.


    You cannot combine meshes and expect things to work out that way. You could create a dummy object for the object name that is disappearing in LOD1; that would work. But the name has to be there one way or the other.

    Once you understand the rules of LODs you'll find it's a very powerful system.
    •  
      CommentAuthorL Bosch
    • CommentTimeFeb 2nd 2014 edited
     
    Thanks a lot Phyter for clearing things up. I think I got the main principles now and can start to put them to use.

    Posted By: PhyterIt is not a restriction, it is a feature, and a very good one in our opinion. If you did not match names in the LOD files, then LODs would only work on a per file basis rather than a per object basis, and that would be a lot less useful.

    My opinion is that both systems have their advantages and disadvantages, though I see that the implemented system is more versatile than merely exchanging 3ds files. Most importantly the explanation is now there so others can look it up if they are getting similar errors as I have.
    •  
      CommentAuthorPhyter
    • CommentTimeFeb 2nd 2014
     
    Always here to help! :D
    • CommentAuthorole
    • CommentTimeFeb 2nd 2014
     
    A) When speaking of layers, we are talking about LWO files. There are no objects in LWO files, instead there are layers which can have a name, so the engine treats a layer in LWO similar to an object inside 3DS.

    B) Each object (respectively layer) inside an LOD needs to have a corresponding object present in the base model, but not the other way around. Objects not having a lower LOD representation will not be reduced, this makes it a very powerfull system as Phyter described.

    C) The distances specified will be used when the "LOD Distance" is set to "Normal" inside NL2's Setup. When creating custom LODs, I therefore suggest to turn the LOD Distance slider to Normal. The other slider positions will use different factors applied to the distances (those factors are >1 for lower detail levels and <1 for higher levels, Normals level has factor=1). The factors might slightly change in the future, the are set to have a visually acceptable result even for the lowest setting.
    • CommentAuthorole
    • CommentTimeFeb 3rd 2014
     
    Unfortunately, Phyter's example is not optimal. It is not required to specifiy the A level that is already used as the base model as an LOD on the LOD tab. Only the lower levels need to be added here. The switch distances specify at what distance the model will be displayed. So in the example above, at 50ft it would switch from level A to level A (makes no sense and is redundant). At 150ft it would switch from level A to level B and so on.
    •  
      CommentAuthorPhyter
    • CommentTimeFeb 3rd 2014
     
    Makes sense. I was assuming too much. Sadly even as a dev I don't get to use the system as much as I would like. The A level is not actually required to be defined explicitly as an LOD. It is implicitly defined as the A level LOD by simply being the file defined in the nl2sco file.
    • CommentAuthorReal
    • CommentTimeFeb 3rd 2014
     
    Love the support you developers are giving us. Honestly its top notch stuff. This will come in handy as I recreat part of ____________ amusement park.
    • CommentAuthorole
    • CommentTimeFeb 3rd 2014
     
    No problem Phyter, thanks for the tutorial. Except for the Level A thing, it perfectly works as a tutorial. Some of the features I programmed 5 years ago or so, I forgot myself how they exactly work and I need to look at the code for that.

    It is a quite cool time right now for us developers to see how people make use of what is possible.