Automatic Lightmapper

Right thread?

I recently moved a project to the UDK, and while working in the UDK, I realized that their lightmapper is really easy. Press a button and it works. So then I thought how hard could it be to code something similar into blender?

So I spent a few days working on a lightmapper in blender, with one goal, to be simple. My lightmapper only has 2 buttons, one to bake the lighting, and one to reset to the original material. No messing around with materials, textures, uv layers, or images. Its all automatic.

I also plan to integrate a light-LOD system, or possibly simple spherical harmonics, so the player will still be light by the appropriate lights but there will be only 2 (or so) lights in the scene.

Plus, they look good (ignoring the programer’s art) :slight_smile: - Note: In most of these scenes, there are no lights!






Wow, this ll be amasing Excallabber, I m waiting to see this working!

Does it automatically generate UVs?
If it really is as easy as you describe it, it sounds awesome!

Phenomenal - thanks for doing this. Can’t wait to try it out!

this almost sounds to good to be true. I won’t believe it until I see a video or something similar :smiley:
Somehow I think this is an april 1. joke ^^

So you put out the lights and then press a button and it bakes onto the unwrapped texture without having to go into photoshop and add a second layer and mess around with it?

haha. Trust me, its not an april fools joke. :wink:

Video of proof:

So I plan to release it in a few days(ish). I want to add a few features, and options to customize the lightmaps.

Thanks
Ex.

Does this map light map all objects in a scene, even with different materials? Or is it per object?

In short yes. It will lightmap all the objects that you select. It preserves all the materials and textures, and will treat all the objects as individuals (so no shared lightmaps).

Beautiful. So it will create a new texture, a light map, based on all the lights in the scene (multiple lights), and somehow assign a new texture channel?

Pretty much. I wrote a list of the things the code does, but I rather it have a magical feel to it :wink:

But yeah it does everything needed to lightmap the objects, it also names everything for convenient editing, and with the new options in the code, you will be able to edit the lightmap settings - Size, Quality, etc.

I tried to make it that one magical button to make a game look good. haha
Ex.

Interesting work - does this work for shadows as well? I was just thinking that maybe if the light map has the dark regions for the entire level, that objects’ positions would influence which part of the lightmap influences them.

Good work, I’ve used the UDK tools for development before and having easy method to get light maps like this is a plus. I’d like to see your results once you get it to a sharable state.

@ SolarLune, sorry I cant seem to understand your post? But I’m glad you posted, cause I was just about to PM you about permission to use/edit your lightmap charactor shadow script and bundle it with my addon?

Thanks
Ex.

What I was saying was basically, ‘Does the script just make a light map for an object for the shaded portion of it, or is it a whole level image that has shading?’ Never mind - I didn’t really think about your first post.

As for the question, yeah, sure, you can include my script, thanks. In fact, I was working on using Vertex Colors to get realtime shadows on objects, even in Multitexture mode. It was slow, but it worked. LOL

hey… now this looks really great!!! :slight_smile:
I am excited to test this out!!!

thanks for your contribution!

I have another question - does it require using the second UV map layer? Also, is it possible to build a ‘Shadeless’ button on the side to make all materials that you baked shadeless? That would be useful, especially if you just baked the lightmaps of several objects at once.

@@vitorbalbio: wow, I completely missed that thread, if I had known I would have suggested to combine efforts right away.

@solarlune: You can chose an option to turn on or off shadeless, but it turns it on by default. It creates a new UVLayer and calls it Lightmap so it doesn’t interfere with the material textures.

Might as well release it: v0.05: http://www.pasteall.org/blend/5919

There are a few missing features that I took out because they made the code unstable.
There is only 1 bug that I can think of, that if you select multiple objects to bake when it unwraps the UV it takes all the objects into account, should be an easy fix once I find a good replacement for that part of the code.

EDIT: since this is my first time coding a blender addon, I am clueless how to bundle them, so I have included a blend with the code on the left, just run each of the script files by right clicking and selecting Run Script. Thanks

Screen:

Attachments



Looking good. I’ll have to try it out - thanks!

You are one if the people who make blender very powerful!Cant wait to try!