status of blender 2.44 lightmapping

Post your questions, suggestions and experiences regarding to Image manipulation, 3d modeling and level editing for the Irrlicht engine here.
Post Reply
Jacky_J
Posts: 55
Joined: Fri Apr 27, 2007 5:01 am

status of blender 2.44 lightmapping

Post by Jacky_J »

First off, does anyone know if it is possible to export a lightmapped scene in blender and have it load directly into irrlicht (via a format such as .x, .3ds, etc...)?

I can get the lightmaps generated in blender by roughly following this tutorial
http://www.continuousphysics.com/lightm ... orial.html

But the problems comes when exporting. I can't figure out how to export both uv layouts. It only exports the one that is selected under the mesh panel. So i guess this is more of a blender question, but any pointers would be appreciated.

Thanks
roxaz
Posts: 575
Joined: Tue Jan 23, 2007 8:35 pm
Location: LT

Post by roxaz »

you see, blender isnt only modeling program. its a game engine. i dont rly know this, but i gues that blender can not export lightmapped meshes. you will have to do it yourself with an external tool.

EDIT:
Or maybe im wrong. check this
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

Bledner has now multiple UV, bake and all needed. Only thing is the scirpt exporting that. I doubt b3d plugin at svn is able to export that, as was made before those features came...but probably will in a future.

Right now, I dunno if collada would do, either...
Finally making games again!
http://www.konekogames.com
CuteAlien
Admin
Posts: 9644
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

I've just added the method which we used to get lightmaps from Maya to Irrlicht to my irrlichtpage. Maybe this will also work for Blender (it should): http://www.michaelzeilfelder.de/irrlicht.htm#Lightmaps

Basically the trick we are using is to merge two files in the obj format and modify the obj loader somewhat so it will create a lightmap material for those files.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

yay, that was my suggestion to Murphy, when he did the mim and oct tools...

Indeed, is a nice idea, and more flexible than ppl think...As also doesnt tie to any tool, anything that can bake lighting -heck, or even 3d painting of shadows, if you'r a good painter ;) -

Kudos for doing that.

Anyway, was looking at 2.44 blender. It's starting to kick some... heck, the video features page is amazing..

whatever, gotta look in depth some more internal changes, which are as intersting.

To the point: maybe if the original poster is in a lot of hurries, can also use collada or fbx (dunno if we have fbx loader: I think is better et collada than fbx, by far)

but didnt know about the obj made universal, huge kudos there...Indeed, go that route if u can...
Finally making games again!
http://www.konekogames.com
CuteAlien
Admin
Posts: 9644
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

vermeer wrote:yay, that was my suggestion to Murphy, when he did the mim and oct tools...
Ah, yes - that was where i got the idea from ;-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
dwmitch
Posts: 52
Joined: Thu Nov 09, 2006 9:29 pm

Post by dwmitch »

The B3D exporter doesn't do multiple coordinates as far as I know. I've been searching the modules in Blender and as far as I can tell I don't think you can even access more than one UV layer with the current Python API.

I'm hoping I'm wrong, and if I am I'd like to see how to do it.
Those who call the faithful 'sheep' do not realize that they themselves are sheep. We follow one shepherd, they follow another.
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

blender should probably soon have it...as allways, pitty is we don't know exactly when.Should come logically, as many formats, like collada, other game formats, etc, will rquire it.

but if you are in a hurry...you can use that idea sugested above: just using OBJ export, export the model twice:

-one obj model with standard texture and the UVs needed for that tetxuring.
-One other obj model with the needed lightmap UVs, and the bitmap file (tga, png...) result of a Blender "bake".

You will need an special loader/format (like Murphy's Mim stuff) or irrlicht code/tool of whatever the sort , to put that into multiuv mesh, lightmapped , ingame.

This method has its advantages,(flexibility in post editing, etc) while probably a b3d file with multiple UVs direct from blender, would be easiest for the artist. Or not. The obj2mim was pretty easy to use, only thing I had to care was...using same copy of OBJ for both, and just only modify the UV mappings and material/texture asignment in blender.

The obj way I did tests of it using obj2mim's murpphy tool,and using mim loader, as mim supported 2 uv channels and that multimaterial structure.
Finally making games again!
http://www.konekogames.com
BMCha
Posts: 2
Joined: Tue Jun 05, 2007 11:14 pm
Location: USA

Post by BMCha »

DOn't you just export the mesh and the baked lightmap, and then set the mech's material to a lightmap, and apply the textures. I'm not sure how to program that, but in irredit, you just set the material to a lightmap, and then apply the textures in the first texture slot, then put the lightmap texture into the second texture slot.
Image
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

probably you mean irredit or your code, allows you to export obj with certain uvs and the baked lightmap as texture, export obj with othe ruvs but standard texture asigned, build the whole final thing in irredit or by code..

you wish to have different UVs for lightmaps, is no good to use same ones than with textures.... So need the two meshes, or, once it's evolved in Blender api -I dunno- and the plugin for blender is completed for that too, when that momet comes, you could export a b3d file which already would be multimaterial, multi UV level, which you save and pass it with its textures and lightmap bitmaps, to the engine b3d loader....
Finally making games again!
http://www.konekogames.com
dwmitch
Posts: 52
Joined: Thu Nov 09, 2006 9:29 pm

Post by dwmitch »

In the time since I last posted in this thread I have discovered that there is a new Blender release with an updated Python API.

It is now possible to access UVLayers from within the code. For example (rough outline, as I don't have access to the error notices to correct me):

Code: Select all

import bpy
sce = bpy.data.scenes.active
obj = sce.objects.active
mesh = bpy.data.meshes.new()
mesh.getFromObject(obj)

layers = mesh.getUVLayerNames()
for f in mesh.faces:
     mesh.activeUVLayer = layers[0]
     print f.uv
     if len(layers) > 1:
          mesh.activeUVLayer = layers[1]
          print f.uv
It's untested, since I don't have a copy of Blender here to run it on and I don't fully remember what I typed in a script I'm working on, but that should print out the UV coordinates of layers one and two.

Of course, someone with knowledge of the file formats Irrlicht supports will have to implement this, because I only know the obj file spec and have a vague understanding of the X file format.
Those who call the faithful 'sheep' do not realize that they themselves are sheep. We follow one shepherd, they follow another.
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

cool...

I am terribly sorry, I can't code.

But to me this would be great to try implementing in the Blender B3D exporter...

OBJ do not support 2 UV channels. X supports it in dx9 spec, if I am not wrong, by something called FVF or something, often not exported by 3d tools. While is really common that b3d exports in 3d tools have polished a lot the lightmapped scene export: uvs and textures asigned correctly. Go for b3d...
Finally making games again!
http://www.konekogames.com
Post Reply