Lightmapping with IrrEdit

A forum to store posts deemed exceptionally wise and useful
Post Reply
dejai
Posts: 522
Joined: Sat Apr 21, 2007 9:00 am

Lightmapping with IrrEdit

Post by dejai »

Hello!
Today I will be discussing how to use irrEdit and the irrlicht mesh format .irrmesh to make simple work of light map editing. First of what is light mapping? Light mapping is the pre rendering of static shadows, say you have a building the shadow is not going to be changing, unless you have real time day / night cycles. For this we can simply render the shadows before hand and make them part of the textures. So in a sense you are basically applying shadows to the textures or applying them on top of the textures and so lots of processing power can be saved.( Correct me if I am wrong..)



What you will need for this short tutorial is blender and IrrEdit:
Download Blender:
www.blender.org


Download IrrEdit:
http://www.ambiera.com/irredit/
Image


Blender - Section 1 Making the Room
(Can be skipped if you have your own room model, but you may just learn how to make simple rooms easily with blender if you do read this section):
---------------------------------------------------------

The first thing that we will be doing is opening up blender. You will be confronted by a cube, press the x key and delete it.

Now press the space bar, and choose mesh->plane.

Now you should see a plane, press Tab->S->5 and the plane will be set to 5 times the size.

Now press W and then choose Sub divide Multi and we will be using 15 segments for today.

Now press Ctrl +Tab and then 3 or select the faces option.

You should see a 15x15 board with all highlighted squares. Like this:

[Sourced from http://www.imhere.nystic.com/]
Image

Make sure you are in top view and press a.

Now all the squares should turn to a grey colour.

Use the left mouse button + Shift and highlight a border around the outside to create a box.

When that is done, press E and select regional. Now go to side view and drag the wall up making sure it is straight.


You can then press a and then use alt+ mouse button to look around and see if you have done it correctly, it may need some tweaking.

Now press f2 and save your work as a .blend for back up. (optional)

Now go into object mode, hit a to select all and export the file to .obj

IrrEdit - Section 2 LightMapping and exporting to .irrmesh
------------------------------------------------------------------

Now open IrrEdit.

File->Import->Static 3d Mesh

Then click on the mesh, click the materials tab and check lighting.

Now go click on the light bulb in the tool bar.

Place the bulb in the area you wish you can add more.. with ctrl copy.
You can resize the bulb via its diameter in the attributes box.

Now you think you have it in the right place click the show light mapper button, which is the icon of the terminal with the bulb on it.

Click apply in the right hand window and you should see it doing some loading.

Now you should see the modifications to the project as they would appear light mapped. You can tweak this again and again till its just right..

Now export the mesh, by highlighting it and then selecting File->export->irrmesh and type map.irrmesh.

Now you have created your first light mapped scene! Yay! If you open the .irrmesh file with notepad or open source equivalent "text editor" you will be able to tweak the mesh even further, and change texture paths etc.

This can then be loaded like any other mesh or octtreescenenode.. See tutorial 1 if you don't know how to do that.

I hope this was helpful.


Image
Programming Blog: http://www.uberwolf.com
Dog-E
Posts: 28
Joined: Sun Mar 30, 2008 5:52 am

Post by Dog-E »

If I follow your exact steps, I get my regular model with my own texture and no lightmaps. I see the shadowed version in irrEdit however none in my own code.
dejai
Posts: 522
Joined: Sat Apr 21, 2007 9:00 am

Post by dejai »

you probably forgot to set EMF_Lighting to false?

It would have worked if you exported it to a .irrmesh after you had burned the lightmap on.
Programming Blog: http://www.uberwolf.com
Post Reply