LOD

Level of Detail Object Replacement Plugin

Introduction

Downloading and Installing LOD

Using LOD


Summary: This Lightwave Layout plugin allows the user to specify replacement objects in a scene based on the distance from the object to the camera.

This plugin was inspired by Jason Booth's BML Level of Detail script (although it is not a direct translation).



Introduction

As the camera moves farther away from an object in a Lightwave scene, the viewer can distinguish fewer details on the object. Therefore, an object far from the camera needs fewer details (smaller number of polygons, less surface texturing, etc.) than an object closer to the camera. This plugin uses Lightwave Layout's Object Replacement capability to allow an animator the ability to use multiple objects with various levels of detail in a scene. Based on the distance between an object and the camera position, this plugin replaces the current object with other user specified objects.



Downloading and Installing LOD

The LOD plugin is currently available for SGI, Amiga, Alpha, Intel, and Macintosh platforms. If you compile this plugin for any other platform, please let me know and I will include it on this page along with a thanks for doing so.

To install LOD, just copy the lod.p file into your Lightwave plugins directory. Run the Lightwave Layout program and from the Options panel choose Add Plug-ins. After you select the lod.p plugin from the file requester, you should see a message that says the plugin was successfully added to the database.

IMPORTANT NOTE for LW6.5b users: Lightwave 6.5b will put up a modal dialog box everytime it does an object replacement. To eliminate this annoying behavior, go into the General Options panel and set the Alert Level to "Expert".



Using LOD

Before you can use the LOD plugin, you will need to make sure you have saved multiple files of your object with varying levels of detail. (NOTE: object designers can make multiple resolution objects using spline patches, the Metaform tool, and/or MetaNURBS. Another method for creating lower detail objects from existing highly detailed ones is to use a polygon reduction plugin such as Decimate or qemLOSS2.)

You will also need to create a text file (I'll call it an lod file) that describes which object should be used at what distance from the camera (one of these days I might add a GUI to the plugin by learning to use Arnie Cachelin's lwpanels.p plugin, but for now this was the easiest way to make this plugin work on all platforms). Here is what needs to be in the lod file:

Line 1: Number of levels to be used.
Line 2: Filename of object with the most detail.
Line 3: Distance (meters) which the object in line 2 will appear (usually 0).
Line 4: Filename of object with fewer details.
Line 5: Distance (meters) which the object in line 4 will appear.
Repeat Lines 4 and 5 for the remainder of the levels specified in line 1.

Here is an example lod file for a Saguaro cactus object with 4 levels of detail:

4
objects/cactus/saguaro_h.lwo
0
objects/cactus/saguaro_m.lwo
150
objects/cactus/saguaro_l.lwo
400
objects/cactus/saguaro_p.lwo
600

In this example, the high resolution saguaro_h.lw will be used when the camera is between 0 and 150 meters from the object. Saguaro_m.lw will be used between 150 and 400 meters, saguaro_l.lw between 400 and 600 meters, and saguaro_p.lw will be used anytime the camera is farther than 600 meters away from the object.

Once the multiple objects and lod file have been created, you are now ready to use the LOD plugin. In Layout, load a stand-in object which will be replaced later by the LOD plugin. I usually use the lowest resolution of the object that I have, but you can use any object that you prefer (even a Null object is fine if that gives you enough information to position and/or animate the object). Then click the Obj Rep Plug-ins button for that object, and choose the LOD plugin from the pop-up menu. Now click on the Options button, and you will be presented with a file requester from which you will choose the lod text file you created earlier. Once the lod file has been selected, you are now ready to return to the Layout screen and animate the object and/or the camera. Later, when you save the scene, the LOD plugin information will be saved for the chosen object.

The LOD objects will not replace the existing object until you either "Make Preview" or "Render" the animation. During the Preview/Render stage, the LOD plugin will replace your stand-in object with the appropriate LOD object for each frame. When either the Preview or Render is complete, your Layout scene will now contain the objects that were actually replaced into the last frame of your Preview/Render.

After previewing or rendering a scene, you may decide an object's LOD distances are wrong. To change the LOD information for an object, edit the appropriate lod file with your favorite text editor. Now select the appropriate object in the Objects panel and click on the Obj Rep Plug-ins button. The LOD plug-in should already be showing in the pop-up menu, so just load the editted lod file by clicking on the Options button again.

I have created a sample scene that you can download to try out this plugin. The archive files below contain the scene, object, and image files. There are also lod files in the objects directory that were originally loaded from the lod File Requester when this scene was created. You do not need these lod files if you load the lod.lws scene file from the scenes directory, since all the information is saved in the scene file; they are only there to provide sample lod files for your perusal. All the archives below contain the same objects and images, I just created 3 different types of archives to make it easier for users on different platforms.