Luminous is a lightmap generation pipeline targeting games based on the W3D engine using Max2W3d plugin by Tiberian Technologies. Luminous automates various time-consuming tasks to pull hours (or even days) of work into just few minutes. Luminous is written in MAXScript and is tested on 3ds Max 2023.
Download and copy luminous.ms to your "scripts" folder. Usually, it's located at C:\Program Files\Autodesk\3ds Max 2023\scripts\.
Then, execute the script by following "Scripting > Run Script..." in 3ds Max UI.
This section details operating Luminous.
- Luminous generates a lightmap for each root (top-level) element which can be a single object, or a group of objects. For example, only one lightmap is generated for a top-level group with any number of objects. Elements in the scene should be logically grouped (preferably by their size either) and ordered.
- If you mave multiple small objects, consider grouping them.
- If you have one large object, consider splitting it up into smaller pieces without grouping, instead of using large texture sizes. This helps Vis culling too.
- If there are any invisible/hidden objects such as Vis planes and blockers, right click on them and select "Hide Selected".
- Disable lightmap generation for unwanted objects.
- Right click on the object, and select "Object Properties".
- Go to the "User Defined" tab.
- Add
NOLUMINOUStag, then click OK. - Objects with "Prelit" option checked in W3D Export settings are automatically ignored.
- Disable applying lightmaps on unwanted materials.
- Set all of their color channels (Ambient, Diffuse, Specular and Emissive) to the same color. (for example, fully white or fully black)
- If that can't be done, "Detach" them from that object and add
NOLUMINOUStag to the object as mentioned earlier.
- Save the scene & take a backup before running Luminous.
- Run Luminous. Set the ambient color, texture size and format. Then click "Start".
- Once the initial validation is complete, it will prompt for an export name and path.
Consider a scene with a large terrain "TERRAIN", a GDI Tiberium Refinery that has all meshes grouped under "MGREF", and a light "Omni001".
Since the terrain is large, it should be split up into multiple pieces first. For that,
- Go into Polygon sub-selection mode.
- Select an adequately sized set of polygons.
- Click "Detach".
- Repeat until all terrain sub-objects are about the same size.
- Fix appropriate flags in "W3D Export" settings.
Then, Vis planes and blockers on the Refinery should be hidden. Suggested method is:
- Ungroup "MGREF".
- Select all Vis planes, blockers and proxies. Group them as "MGREF_INV".
- Select rest of the meshes. Group them as "MGREF_PHYS".
- Right click on "MGREF_INV" and select "Hide Selected" to hide all blockers & Vis planes on the scene.
We also don't want disabled runlights on Refinery to be lightmapped, otherwise they may not appear as black when Refinery dies.
- Select the runlight material by clicking on it in the scene using "Pick Material from Object" tool of Material Editor. No need to ungroup.
- Set all of its colors to black.
Finally, save the scene and take a backup. Then, run Luminous and click "Start". When asked, enter an export name and path.
Luminous makes assumptions while generating lightmaps. The scene is automatically checked for eligibility before starting the lightmap generation. If a validation error occurs, Luminous displays them in the log window moves and moves no further. These requirements are:
- User is expected to configure the renderer to "Scanline Renderer" with settings of their liking.
- Lights in the scene must be "Standard" lights which are "Omni", "Target/Free Directional" and "Target/Free Spot". Use of Arnold lights, Photometric lights or any other light type are not supported.
- All materials in the scene must be W3D material, or Multi/Sub-Object with only W3D material(s). Use of any other material will fail validation and should be migrated to W3D material.
- Materials with all color channels (Ambient, Diffuse, Specular and Emissive) set to white or black are ignored while applying lightmaps.
Luminous performs following tasks in order:
- Conversion to Editable Mesh: Unifies the base object type to Editable Mesh.
- Material Cloning: Makes a clone of each material and applies it to the respective object. This is needed for lightmap generation as a lightmap can't be applied to a material used in multiple objects.
- UV Unwrapping: Objects are automatically unwrapped before lightmap generation.
- Render to Texture: Bakes every root object into textures. For groups, automatically merges each texture into one.
- Applying Lightmaps to Materials: Applies lightmap to materials automatically with necessary attributes.
- Save and Reload Scene: Saves the scene and reloads from the file. This is to solve rare cases of lightmap appearing wrong in the W3D export.
- W3D Export: Automatically exports the map using W3D Exporter to the provided export path and name.
- WLT Export: All scene lights are exported for dynamic object lighting (vehicles, infantry, etc.) in the game.
There are various challenges and aspects that are not yet implemented or not possible to implement, which are:
- Textures with an alpha channel casts a full shadow, instead of casting a shadow of only visible parts. This is planned to be addressed in a future update.
- Linked objects are not tested and may not work correctly.
- As stated in Requirements, lightmap generation with other materials, including the DirectX Shader material, is not supported.
- Groups under root elements are not supported. Groups must only appear at the root level for correct lightmap generation.
- Skylight is baked during lightmapping, but exporting in WLT format is not supported.
- In rare cases, automatic W3D exports may contain corrupted lightmap information. In this case, try re-exporting manually.