Jump to content

Lightmap Creation


Recommended Posts

I have finally gotten around to creating a simple tutorial on how to get lighting effects from 3DSMax 8 into Renegade, Some would call this "lightmapping"
when using this and some other tools TT have developed you too can get professional looking shadows, lighting effects... just one thing i should mention, this method is not dynamic lighting, but rather static baked in lighting
Let's begin
post-10309-0-10158700-1425104333_thumb.jpg
Open your completed level, textures are optional, but recommended that the level be completely textured before starting the process. Just easier to render and see the effect the lighting will have on the level
post-10309-0-08601600-1425104334_thumb.jpg
Here I have placed some lights and other atmosphere effects to the scene.
post-10309-0-32529400-1425104335_thumb.jpg
Let's render [F9] the scene and check out how the lighting looks, Everything looks fine, When you happy with the final product move on to the next step. **Remember to render often to check for lighting errors or glitches be sure to look at all surfaces etc..
post-10309-0-93069300-1425104335_thumb.jpg
Now that our lights are done, lets hide them and just keep the terrain I want to lightmap visible, First thing you want to do is clone all the terrain pieces you wish to apply the lighting to... In my case, it is the concrete boxes and ground. [Right Click > Clone]
post-10309-0-60345900-1425104336_thumb.jpg
Now both pieces are cloned simply move them to the side, Leave it there for now, we will work on that in a bit.. As you can see I've moved mine a bit off from center.
post-10309-0-25647500-1425104337_thumb.jpg
Now select the original two pieces and remove the materials from them [utilities Tab> UVW Remove>Materials Make sure "Set Gray" is checked]
post-10309-0-95345100-1425104337_thumb.jpg
With the materials off the original meshes, we need to combine them for the lightmap. [utilities>Collapse>Collapse Selected] This will make the pieces into one mesh.
post-10309-0-74223500-1425104350_thumb.jpg
Now that it is one mesh, we need to apply a UVW unwrap, Select the mesh [Modifiers>UV Coordinates>Unwrap UVW]
post-10309-0-58549500-1425104352_thumb.jpg
Now that it has applied a UV unwrap we need to flatten all faces for the lighting information. ** Before moving on set the "Map Channel" to 2, we will need to remember this for later
post-10309-0-49954300-1425104353_thumb.jpg
Under "Selection Modes" click on the third button to the left "Face Sub-object Mode" then select all faces in the scene [Ctrl+A] to select all, then we need to flatten, [Mapping>Flatten Mapping].
post-10309-0-27741300-1425104354_thumb.jpg
Once that is done just use the defaults that are displayed on my screenshot. Click "Ok" when done.
post-10309-0-21979700-1425104355_thumb.jpg
The modifier should auto-flatten to something similiar to what i got pictured above. Once that is done, move on to the next step.
post-10309-0-93633100-1425104355_thumb.jpg
Now we need to render the lighting information to a texture, [Rendering>Render to Texture]
post-10309-0-96300500-1425104356_thumb.jpg
This will provide a pop-up of the settings of the texture we will render, Set the Padding to 64, Object should "Use existing Channel" then set the channel to 2, we set this channel from earlier...
post-10309-0-81249500-1425104364_thumb.jpg
Continue down to "Add" button, Click on it and select "Lightingmap" after it will provide you with the ability to change the file name and type of the texture output [To change output location click on the " ... " ] **For lightmaps I tend to make them DDS with DXT-1 settings, and Use a 256x256 size
post-10309-0-81467300-1425104366_thumb.jpg
Once you are happy with file name and output location press "Render", You should see a pop up with the lightmap texture, something like my lightmap pictured above. Once rendered close the pop up windows
post-10309-0-52664400-1425104367_thumb.jpg
Now the lightmap texture is applied to the original mesh, At this point we need to detach the single mesh back into the orginal two pieces we started with.. [Right-Click on the mesh>Detach with the element tool] Once complete move on to the next step.
post-10309-0-23605400-1425104368_thumb.jpg
Now this is where the cloned copy of the original comes into play, We need to attach the cloned pieces to the lightmapped pieces. Ground>Ground, Concrete Boxes>Concrete Boxes... Once you attach the cloned copy to the lightmap meshes a pop up will appear [Pictured above] leave those default settings and press Ok.
post-10309-0-13656200-1425104376_thumb.jpg
Now that the pieces are attached together we need to re-apply the materials over the meshes, Once complete move to next step
post-10309-0-67755400-1425104377_thumb.jpg
Now the two pieces are retextured we need to get rid of the cloned mesh we made earlier [Mine was the top one] just make the mesh editable and select and delete the cloned mesh [Pictured above]
post-10309-0-84198100-1425104368_thumb.jpg
We are left with the one piece, Now we need to apply the lightmap texture we made earlier to the materials of the Ground and Concrete Boxes.. Go into the material editor [ M ] and apply the next step settings to the materials.
post-10309-0-37070600-1425104369_thumb.jpg
  • Vertex Tab, Stage 1 Mapping should be set to 2
  • Shader Tab, Pri-Gradient set to "Disable", Detail Color to "Scale"
  • Textures Tab, Check Stage 1 Texture, And place the Lightmap texture you output earlier here, Click on "Clamp U" and "Clamp V"
  • Once completed close material editor and Export your scene into a W3D

Once all is complete and lightmap textures are applied to the mesh/meshes.. You will need to add a user defined parameter.. Right click, goto properties and goto User Defined tab... There you will see a text box add the line [ Prelit=true ] - everything in between the brackets.. And apply this line to all lightmapped mesh.. This is so that the Renegade vertex lighting system ignores these pre-baked light meshes
post-10309-0-89826600-1425104369_thumb.jpg
post-10309-0-08618700-1425104379_thumb.jpg
Here is my completed level with Lightmap applied in W3D Viewer...
Enjoy! and experiment!!
UPDATE: There maybe some possible issues that result from using this method
  • Alpha blended materials will break once "Pri-Gradient" is set to disable. To fix you will need to set to "Modulate" for any mesh that is lightmapped and has alpha blending.
  • Tree, Shrub etc. Shadows not displaying properly in render or lightmap, You will need to follow this Alpha material tutorial for proper display of alpha enabled textures.
This is what the model looks like without a lightmap texture and using default vertex lighting instead
post-10309-0-03495900-1425104380_thumb.jpg
Hope you guys learned a bit from this... you can now go and create some cool looking levels with this method of lightmapping I've provided for you...It can get very complex for larger, more detailed levels, so you will need to dedicate quite sometime to do it right! I've only covered the basics on this tutorial, but I'm sure you guys can experiment and achieve more... Good luck and please feel free to post any questions you might have about Lightmapping in this tutorial thread... :smug:
Edited by Mauler
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...