New theme added have fun on this forum gr Wizart :)

Lightmapping mini walkthru

Here we will collect answers to frequently asked questions and provide some user tips...

Moderators: spanner Verified, Vital Verified, fossil Verified, HowardC Verified

Post Reply
voodooscientist Verified
Posts: 204
Joined: 11 Mar 2004, 01:55
Local time: 08 Dec 2025 02:53
Location: That creepy castle on the hill over there...
Contact:

Lightmapping mini walkthru

Post by voodooscientist Verified »

I've made this for peter, but other people might find the mini walkthru usefull as well...

you will need the latest fe-beta/lightmappingtool for lightmapping to work

this is all for max5, in max6 there might be some different steps/results

- attach all meshes together you want to share the lightmap
- unhide surroundings/turn on lights
- select your model
- select Rendering > Render to Texure

render to texture dialog box:
- general settings:
-- objects to bake: selected objects
- automatic unwrap mapping:
-- check On, Rotate Clusters, Fill Holes
-- Treshold Angle: 45 (make a note of what you enter here! experiment with this to split or keep elements together in the lightmap)
-- Spacing: 0.03 (make a note of what you enter here! spacing of the different lightmap-parts)
- use render settings:
-- Production
- display and materials:
-- uncheck Create baked materials
-- check Display Frame Buffer
- automatic map size:
-- Scale: 1.0
-- check Nearest power of 2
-- Min: 32
-- Max: 2048
- file output path:
-- enter the path you want the lightmap saved to
- per object settings:
-- check Enable
-- Use Channel: 2
-- Edge Padding: 3 (repeats pixels at the edges of the lightmap elements, should be lower or equal to spacing)
- generated texture elements:
-- Add a LightingMap
- selected element common settings:
-- check Enable
-- change the name/filename if you like
-- Width: 512 (256 and lower gets ugly)
-- Height: 512
- selected element unique settings:
-- check Shadows, Direct Light On, Indirect Light On

- click Render and it should render a nice lightmap file to your output path.
- close the dialog box
- select your model and remove the automatic flatten modifier from the stack if there is one
- do you have a dummy object to hold the lightmap grouped to your model yet? if not create a single face and apply a new material with the lightmap as a diffuse texture(make a note of the texturename!) to it, then put it somewhere it won't be seen and group it up with your model.
- double-check for unique material/texture/object -names
- rightclick the group > transform > Properties > User Defined
- enter lightmap=yourlightmapname; and hit return so the cursor goes to the next line (yourlightmapname is the name of your lightmaptexture, not the lightmapmaterial!)
- export selected group to .w3d (geometry quality: 100, texture quality: 100), this will be the destination model.
- save your max file

now to get the lightmap model:

- open your group
- select your model
- apply a UnwrapUVW modifier to your models empty stack
- Parameters: click Edit
- Edit UVW's window opens
- make sure nothing is selected by clicking in an empty space then select Mapping > Flatten Mapping in the menu bar
- at Face Angle Treshold and Spacing enter what you have noted earlier in the Render to Texture dialog and check/uncheck the same fields here
- after you confirm with ok you will be presented with the texture layout - the model will probably look rather strange now
- close the Edit UVW's window
- apply your lightmapmaterial to the model

you should have a lightmap-only model now. collapse the stack, close and rename the group, export to .w3d with the same settings as the destination model => this will be the source model

- start the lightmappertool
- load your lightmap-only model
- load your destination model
- enter the name of your lightmaptexture (you wrote it down, haven't you? )

after some calculation the lightmappertool should show the lightmapped model

questions, suggestions, bugs etc. please reply to this post

VS
"Igor - where is my signature?" "I'm motht terribly thorry, marthter - it'th thtill at the cleanerth..."
scapino Verified
Posts: 104
Joined: 14 Jun 2003, 04:34
Local time: 08 Dec 2025 10:53
Location: Portland, Oregon

Post by scapino Verified »

Thanks voodoo!

I'll give it a try. Me happy!!! :)

Kurt
)p( Verified
Site Admin
Posts: 5714
Joined: 01 Jan 1970, 02:00
Local time: 08 Dec 2025 02:53
Location: The Netherlands
Contact:

Post by )p( Verified »

i updated the lightmapgenerator a bit. Main new feature is that it is no longer nescessary to remeber the name of the lightmap texture. The generator now gets it form the property set in max.

The included ini will make the mappe run windowed (tip rename it to fe3darcade.ini this will make the fe run windowed ;-) )

http://www.i-modernist.com/temp/lightmapgenerator.zip

peter
)p( Verified
Site Admin
Posts: 5714
Joined: 01 Jan 1970, 02:00
Local time: 08 Dec 2025 02:53
Location: The Netherlands
Contact:

Post by )p( Verified »

ok i found two issues...the need to break vertices and a small issue with the lightmapper...and hopefully solved them ;-)

quote of the problem:
"The destination model MUST have more list entries than the source model.
Why? Simple, if a vertice happens to be shared in the destination, but is
not shared in the source (it has more texture coordinates, as example), the
destination model will only show one of the texture coordinates, since that
vertice can't show more than one. A simple way to get around this is always apply the "Unwrap UVW" modifier to the destination model, then edit
the UVW settings and select "BREAK" in the modify menu. This will make all
vertices unique, avoiding shared texture coordinates, and leaving room for
the duplicated ones if necessary."


Solution:

first here is an updated lightmapper exe.
http://www.i-modernist.com/temp/lightmapgenerator.zip
Try this first this already might work ok if your model does not have the above quoted issue.

ok the steps i took to resolve the quoted issue...some steps may be redundant

dest model
-i opened the group and selected the model
-i added an unwrap uvw modifier > selected edit from the parameters roll out > selected all > break from the Tools pulldown menu
-exported it to w3d

source model
-i opened the group and selected the model
-assigend the light map to the model
-i added an uvw unwrap modifier > edit > flattened map along vs's instructions
-converted it in to an editable mesh
-i added an unwrap uvw modifier > selected edit from the parameters roll out > selected all > break from the Tools pulldown menu
-exported it to w3d


Peter
Last edited by )p( Verified on 29 Sep 2004, 17:43, edited 1 time in total.
)p( Verified
Site Admin
Posts: 5714
Joined: 01 Jan 1970, 02:00
Local time: 08 Dec 2025 02:53
Location: The Netherlands
Contact:

Post by )p( Verified »

I tested this now on several models and it works flawlessly...so finally straightforward burned textures / lightmaps !!!!!!!!!!!!!!!!!!

VS, D and me all got pretty frustrated over this, but it looks like our efforts will pay off in the end...

:hathat49:


peter
Guest
Local time: 08 Dec 2025 01:53

Post by Guest »

Man, I'm just curious... what does this do?

It sounds cool. Would any of you gurus care to give a simple answer to what this will do for the FE?

Muchas Gracias!
)p( Verified
Site Admin
Posts: 5714
Joined: 01 Jan 1970, 02:00
Local time: 08 Dec 2025 02:53
Location: The Netherlands
Contact:

Post by )p( Verified »

There are several reasons:

-Lightmaps can be used to replace real lights. Lights are performance killers. So less lights in a realtime 3d environment can help a lot.

-Lightmaps can give subtil light effect on surfaces. What is even more importent it can be used with tiles surfaces to show more detail. For example imagine a brick wall with a tiles brich texture..a light map can be used to give the whole wall for example a noise effect so it not looks artificial.

-And last but certainly not least. The creation of lightmaps can be automated in prgrams like 3ds max. You setup your scene in max using lights...then you use the render to texture feature..which will burn the lights on a texture that wraps around the whole model. If you now kill all lights in the scene...the result will look the same as with the lights. Also the quality of the renderer in a 3d program is much better then any realtime lights...So you can use less lights in an environment but with greater detail...a win win situation...

peter
User avatar
DeNiro Verified
The Cool Dude
Posts: 814
Joined: 12 Sep 2003, 11:27
Local time: 08 Dec 2025 02:53
Location: Kingdom of Denmark

Post by DeNiro Verified »

Thanks for the walkthrough VS, was a blessing. It was so long ago, and so brielfy, that I had forgotten most of the quirky steps.

Heres a few notes of my own :

Theres no need to break the actual vertices, just break the ones on the uvw mapping.

I think the <strike>light</strike> shadowmap gain strength, if all the affected textures on the destination model has selfillumation set to #FFFFFF. That makes it light up like a lightbulb where there is no shadows, and makes it completely unreliant on any lights in the scene.

Considering that the FE now loads an external lightmap, I find it gives more freedom to simply export the destination model (which IS done before the source model) with a dummy lightmap, and then just add the lightmap in the folder with the arcade (named "[arcadename]_lmp"). This way you can further refine the lightmap. And watch the changes immediately.
)p( Verified
Site Admin
Posts: 5714
Joined: 01 Jan 1970, 02:00
Local time: 08 Dec 2025 02:53
Location: The Netherlands
Contact:

Post by )p( Verified »

I updated the lightmapgenerator to use a difference instead of equals style of matching between the vertices of the source and destination models. This was nescessary because of the exporter making rounding errors and therefore it could happen that some vertices could not be matched resulting in facres with a not the correct mappin coordinates of the lightmap.

Finally it should be now a straightforward task to get the desired error free result ;)

http://www.i-modernist.com/temp/lightmapgenerator.zip

peter
User avatar
DeNiro Verified
The Cool Dude
Posts: 814
Joined: 12 Sep 2003, 11:27
Local time: 08 Dec 2025 02:53
Location: Kingdom of Denmark

Post by DeNiro Verified »

More notes :

1. REMEMBER TO KEEP THE UVW-MODIFIER ON BOTH MODELS.. hehe.. Took me a while to figure that one out..

2. There seems to be no need to break the vertices on the UVW-mapping of the source model.. ? (I´ll check that some more, sometime)
User avatar
DeNiro Verified
The Cool Dude
Posts: 814
Joined: 12 Sep 2003, 11:27
Local time: 08 Dec 2025 02:53
Location: Kingdom of Denmark

Post by DeNiro Verified »

Was completely thrown off by a very annoying "bug". Seems my PC is too slow to handle two complex w3ds, and thus the automatic LOD kicked in, making it impossible to have two matching models. Expect an updated lightmapper shortly..
Post Reply