Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

3 Dimensional Chat / 3ds max to Darkbasic/pro Lightmapping Tutorial

Author
Message
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 17th Jan 2004 22:57 Edited at: 8th Sep 2004 08:57
This is assuming you're using 3ds max:

Level Modeling:
The idea of modeling a level with a lightmap is to use as FEW objects as possible. If you have 15 objects, that means you'll have 15 lightmaps. The level I used in this example has only 2 objects. Lightmaps are usually larger than textures in terms of file size, so the less objects you have, the better. Learning max polygon editing is CRUCIAL. And don't forget to include the lights! You must add lights to this stage, and you can render it to see what the lightmap will look like while modeling.

Level texturing:
This can get frustrating, especially if you have very few objects, and you need multiple textures on one object. You're going to have to apply UVW maps to individual polygons, which takes a lot of trial and error. You MUST learn about multi/sub texture maps.

Lightmapping
When you've finished with the modeling process, save your scene as a SEPERATE FILE called sceneLightmap. From here on in, you cannot touch the scene. If you see a problem, you cannot fix it. The lightmap file and the scene file must have the EXACT SAME GEOMETRY.

Now, create a new texture. Make it white, but not blinding white. How dark this texture is determines how dark your lightmap is. It's generally bad to use a gray material because it will ruin specular highlight and make the level much too dark. A shade of white will do it.

Zoom out, and select every object in your level (drag a box around it). Then drag and drop the texture onto the selection. With the popup box, hit "Assign to Selection" and hit OK.

You're now ready to bake your textures! Again, select every object in the level. Go to
Render > Render to Texture

Under general settings, in Automatic Unwrap Mapping, change the Spacing to 0.

Scroll down to "Select Object Settings". Hit "Add". Select "Complete Map". Hit OK. Set the texture size to whatever you want, I use 500x500. Keep in mind, lightmaps have rather large sizes.

Hit "Render"

You now get to see your lightmap rendered out. Note, if you move the image file window out of the way, you can find a progress bar behind it. Very useful. When it finishes, you see your scene, completely lit.

You aren't done! This part is tricky, annoying, and stupid, but it must be done.

Open the material editor. You must create a MATERIAL FOR EVERY LIGHTMAP. This means, chose an empty material slot. Hit this button:

Then select "Bitmap" from the list. Then browse your files until you find the lightmap (it will be a TGA file). Then hit OK.

Don't forget to name the material so you can find it later!

Do this for evey lightmap. If there are 3 lightmap files, then you need 3 textures.

APPLY THE LIGHTMAP MATERIAL TO IT'S RESPECTIVE OBJECT. This is where naming the textures came in handy. If you select an object, it will tell you its name. The name of the lightmap will be something like objectNameCompleteMap.tga. Make sure you assign correctly!

Look at your level. It looks terrible the lightmaps don't align at all.

Trying to explain this would take forever. So! Do this for EVERY OBJECT:
-Select the object
-Go to the modify panel
-Delete the "Automatic Flatten UV's" by clicking the little trashcan when it's highlighted:

-Open the dropdown menu. Select "Unwrap UVW"
-Under "paramaters", click "Edit".
-Then select flatten mapping:

-Change the Spacing to 0. Then hit OK.
-Your object is now perfectly aligned to the lightmap!
-Repeat the above steps for EVERY OBJECT.

Alright. You've got two complete objects. One is textured, one has the lightmap. You're gold. Export both to .X files with Panda Exporter with THESE settings:
http://members.lycos.co.uk/mrdarclyte
In DBP, load both objects, ghost one, and you're DONE!


Then write your engine around that.

BEAUTIFUL!

If there are any questions, comments, or problems, you can either reply here, find me on AIM, my AIM name is DelvarWorld , or email me: delvarwo@delvarworld.com

I hope you gained something from this!

AlecM
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Concord, MA
Posted: 18th Jan 2004 01:01
I've got a few suggestions.

Don't use a complete map. Currently in DBP the best way to do a lightmap is 2 objects 1 ghosted. For your lightmap object add a very small push modifier in max. This will remove any z-buffer errors you would see in realtime. Also, I would use a different texture baking pluging, bakersfield. It won't mess with your UVs and you can have complete control. And for level texturing multi-subs are rarely neccesary. Especially since DBP wont load them. Also, dont use 500x500 lightmap images. Use 512x512, or 256x256.

Flatten mapping is really messy and should be avoided where ever possible. And if you wanted to do things more efficiently you can attatch all of your objects into 4 or 5 (or even 1) object for the lightmap model. This way you only have to deal with a few bitmaps and models for the lightmaps. (keep your original model intact)

Multiple UV support for DBP will be availible through DBO soon so all this will change.

[P4 2.8C @ 3.03 with an 866mhz FSB:: MSI Neo-2LS running PAT:: 1gb Mushkin PC-3500 DDR High Perf level 2@ 2,2,2 :: ATI Radeon9800ProAIW :: 120Gb SeagateBarracuda 7,200RPM SATA HD :: Antec Plus1080AMG]
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 18th Jan 2004 02:35
Uh...no, that was a lot of bad stuff. Adding a push modifier can have some very bad problems, you shouldn't do it. I've tried it. And multi/sub object texturing is VERY neccessary, especially with adding more than one material to an object. And I said you have to change the texture on the object, so complete map is the way to go.

And attaching objects can be the worst thing you can do to a model, especially if it's not a default object. Any kind of editable poly (and if you're watching your polycount, editable poly is the only way to go) that you try to connect to another object, the result is horrible.

Flatten mapping is what max uses by default for texture baking. It works very well, especially with 0 spacing. And a 500x500 texture can hold an amazing amount of detail for a lightmap.

So yeah.

Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 18th Jan 2004 03:29
If you're doing a complete map then you don't even have to use 2 objects. Just texture one with the generated complete map and that's it.


"Computers are useless they can only give you answers."
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 18th Jan 2004 03:57
Complete map + tiled textures = the no

AlecM
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Concord, MA
Posted: 18th Jan 2004 04:48 Edited at: 18th Jan 2004 04:59
QuoteTheRaven. There is nothing wrong with the push modifier or attaching objects into 1 limb. The way you have done it is horribly in-efficient and degrades texture quality. Don't dismiss things so quickly just because you didn't do it properly. The way im suggesting works and much more efficiently than creating seperate maps for all your objects.

"500x500 texture can hold an amazing amount of detail for a lightmap."


Thats not the issue. you must use a texture thats a power of 2 whenever doing anyting for realtime. This is because your video card will automatically scale the texture to the nearest map size and your textures come out looking much worse.


"multi/sub object texturing is VERY neccessary, especially with adding more than one material to an object"

If your doing things properly for DBP a multi-sub object texture is never neccesary and they wont load in DBP. Baking out 500x500 complete maps is a horrible waste of texture space and when max re-applies your UVs it scales/degrades your textures. Show me 1 example in that scene where a multi-sub was neccsary?


"(and if you're watching your polycount, editable poly is the only way to go)"

This is because editable poly mode support more than triangular polygons. However directX triangulates all models on runtime in reality converting a model from editable poly to editable mesh makes no change in polygon count.

[P4 2.8C @ 3.03 with an 866mhz FSB:: MSI Neo-2LS running PAT:: 1gb Mushkin PC-3500 DDR High Perf level 2@ 2,2,2 :: ATI Radeon9800ProAIW :: 120Gb SeagateBarracuda 7,200RPM SATA HD :: Antec Plus1080AMG]
AlecM
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Concord, MA
Posted: 18th Jan 2004 05:03 Edited at: 18th Jan 2004 05:03
QuoteTheRaven. There is nothing wrong with the push modifier or attaching objects into 1 limb. The way you have done it is horribly in-efficient and degrades texture quality. Don't dismiss things so quickly just because you didn't do it properly. The way im suggesting works and much more efficiently than creating seperate maps for all your objects.

"500x500 texture can hold an amazing amount of detail for a lightmap."


Thats not the issue. you must use a texture thats a power of 2 whenever doing anyting for realtime. This is because your video card will automatically scale the texture to the nearest map size and your textures come out looking much worse.


"multi/sub object texturing is VERY neccessary, especially with adding more than one material to an object"

If your doing things properly for DBP a multi-sub object texture is never neccesary and they wont load in DBP. Baking out 500x500 complete maps is a horrible waste of texture space and when max re-applies your UVs it scales/degrades your textures. Show me 1 example in that scene where a multi-sub was neccsary?


"(and if you're watching your polycount, editable poly is the only way to go)"

This is because editable poly mode support more than triangular polygons. However directX triangulates all models on runtime in reality converting a model from editable poly to editable mesh makes no change in polygon count.


"And I said you have to change the texture on the object, so complete map is the way to go. "

A complete map is not the way to go, a lightmap is.

[P4 2.8C @ 3.03 with an 866mhz FSB:: MSI Neo-2LS running PAT:: 1gb Mushkin PC-3500 DDR High Perf level 2@ 2,2,2 :: ATI Radeon9800ProAIW :: 120Gb SeagateBarracuda 7,200RPM SATA HD :: Antec Plus1080AMG]
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 18th Jan 2004 05:56 Edited at: 20th Jan 2004 01:29
The level in the screenshot, running with full collision in game, runs at about 170 fps on my machine, following those exact steps in the tutorial. So far, it's working very well. Oh, and you should try attaching editable poly objects with deleted faces.

GattoSF
20
Years of Service
User Offline
Joined: 18th Dec 2003
Location:
Posted: 22nd Jan 2004 16:00
this is for sure a good method to use some-kind-of-fake-light-maps while waiting for patch 6.

coming soon
Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 22nd Jan 2004 21:59
where can I find this bakersfield plugin?



Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb
Genesis Rage
20
Years of Service
User Offline
Joined: 5th Oct 2003
Location:
Posted: 22nd Jan 2004 23:34 Edited at: 22nd Jan 2004 23:39
im getting a slight problem here... looked into this method before... and ran into the same problem... unless you found a way to get past this...

here is a screenshot of what it looks like in DBP...


havent tried a push modifier yet... that might actually help a bit... its just that DBP gets confused when there are 2 surfaces that are exactly lined up... it doesnt know when to hide and show the right one

QTR... this thread seems fairly familiar to one that we started a long time ago... didnt i suggest this to you... but you said with all the new image files that it would eat up a lot of space on your disk?

AlecM
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Concord, MA
Posted: 23rd Jan 2004 00:00
bakersfield can be found here:
http://www.chuggnut.com/scripts/bakersfield/bakersfield.htm
I dont know if it will work with max 6 though

QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 23rd Jan 2004 02:43 Edited at: 23rd Jan 2004 02:45
Quote: "im getting a slight problem here... looked into this method before... and ran into the same problem... unless you found a way to get past this..."


yes, I've seen that happen before. As I said, the levels have to be exactly the same. Did you connect anything when you made your lightmap? That can cause problem. If the polygons line up exactly then it will texture correctly, connecting can hinder that. As I said, the only thing you can do to your lightmap object is change it's texture.

Quote: "QTR... this thread seems fairly familiar to one that we started a long time ago... didnt i suggest this to you... but you said with all the new image files that it would eat up a lot of space on your disk?"

Yeah, this is in fact what you suggested to me, but that was when I had no idea how to model levels and my object count was 15 or so. I didn't realize that the fewer objects, the better.

Genesis Rage
20
Years of Service
User Offline
Joined: 5th Oct 2003
Location:
Posted: 23rd Jan 2004 02:52
actually i think i connected the objects on the lightmap object... gonna try again... hopefully it wont mess up this time

hope that U6 will have some better lightmapping commands... then we can just delete the second lightmapped object

Genesis Rage
20
Years of Service
User Offline
Joined: 5th Oct 2003
Location:
Posted: 23rd Jan 2004 03:11
-->froggermon
you using Max 5? and if you are, anything special you had to do to get bakersfield working... it wont run at all on mine

Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 23rd Jan 2004 14:38
thanks froggermon, btw I use max 5



Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb
GattoSF
20
Years of Service
User Offline
Joined: 18th Dec 2003
Location:
Posted: 23rd Jan 2004 16:32 Edited at: 23rd Jan 2004 16:34
yes i got it to work, nice looking but it is just a temporary solution, since you cant duplicate your models as many time as you uv channels ;P ;P when patch 6 will be out, it would be nice if we could apply many uv channels ad their respective maps, (so come on shadow/lighting/blend/detail maps ;P)

in the meantime, take a look at the first screenshot of my project, it is just at the beginning of course, few hours of work

http://www.system-failure.it/cherryblossom/cherrybg3.jpg
(it is 800x600 size, so no direct linking for 56-k users ;P)

coming soon
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 23rd Jan 2004 17:20
Is that in game? Very nice

Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 23rd Jan 2004 19:19
link doesn't work for me



Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb
AlecM
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Concord, MA
Posted: 23rd Jan 2004 20:39
Nothing special to get it working. As with many scripts you need to add it in the UI set up

GattoSF
20
Years of Service
User Offline
Joined: 18th Dec 2003
Location:
Posted: 23rd Jan 2004 22:39
yes it is in-game thanks )

here goes another pic showing the light mapped on the model :9

http://www.system-failure.it/cherryblossom/cherrybg4.jpg

coming soon
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 23rd Jan 2004 22:46
Yay...I've written a tutorial that's helping people! go me!

Genesis Rage
20
Years of Service
User Offline
Joined: 5th Oct 2003
Location:
Posted: 23rd Jan 2004 23:57
well i got the Bakersfield in the right directory... and i have also set it up in the UI (so its in the render menu)... but it wont save the image file... tried it in many directories, and image formats... and it wont save the image file

id be happy with U6 if it just had support to have multiple UVs... even if it could only be used for lightmapping effects

GattoSF
20
Years of Service
User Offline
Joined: 18th Dec 2003
Location:
Posted: 24th Jan 2004 04:14
Quote: "Yay...I've written a tutorial that's helping people! go me!
"


yeah!

coming soon

Login to post a reply

Server time is: 2024-04-24 04:46:46
Your offset time is: 2024-04-24 04:46:46