Lightmapping question

Blitz3D Forums/Blitz3D Programming/Lightmapping question

John Blackledge(Posted 2005) [#1]
I hope someone can save me the time of converting my B3D's to X etc just to find out....

- but is lightmapping only supported through the B3D format?
(By that I mean the usual MyModel.B3D + MyModel_lm.bmp situation.)

In other words if I have MyModel.3DS + MyModel_lm.bmp will this still work, or does Blitz only go looking for a lightmap if the model is in B3D format??


Mustang(Posted 2005) [#2]
lightmap is just a texture (using spesific blend mode) and can be applied to any model (format) that supports at least two UV sets (and the UV set meant for lightmapping purposes has to match the actual lightmap texture of course). B3D format doesn't have any automatic lightmap loading itself. 3DS doesn't support more than set of UVs and is crap in every other imaginable way too. Do NOT use .3DS format if you can use .B3D.


John Blackledge(Posted 2005) [#3]
Thanks, Mustang.

But I think to say "B3D format doesn't have any automatic lightmap loading itself." is incorrect.

If I load MyModel.b3d, and MyModel_lm.bmp exists, then the lightmap will automatically be loaded and implemented by Blitz.

I just called my mate Ipete2, and he confirmed that Blitz will do this for b3d models, but if the model is a .x or .3ds then the lightmap texture must be loaded separately and implemented as layer 1.


Mustang(Posted 2005) [#4]

If I load MyModel.b3d, and MyModel_lm.bmp exists, then the lightmap will automatically be loaded and implemented by Blitz.



Really? If so, that is new to me.


AdrianT(Posted 2005) [#5]
John are you the artist? or coder. It's always possible that an engine was coded to load a texture with the _lm flag. However i'm pretty sure this isn't normal.

Like mustang said, the normal way is to assign a second texture layer on UV2 with fullbright and or 2xmultiply blendmode on. Normaly you would want to give your artists as much flexibility as possible, but a lot of shareware tools don't support multiple UV's. In which case adding the _lm nametag in code makes sense.


John Blackledge(Posted 2005) [#6]
I'm acting really thick these days aren't I?
Anyone who's been reading my threads must think I'm losing it. -Overworked and underpaid.

OK. You're right.
I imported the model (Church.x) into Quill, lightmapped it and saved is as a Church.b3d.
Quill also exported Church_lm.bmp, and of course the reference to this file is built into the exported Church.b3d.

So, one the one hand there was no more coding for me to do than just LoadMesh(), but on the other hand Blitz _does_ automatically load the lightmap.


Naughty Alien(Posted 2005) [#7]
..appart from B3D, it is possible to use 3DS or X files with lightmaps...of course it will not happen just with loading of the mesh, such as case with B3D, but its possible..


Function MapVertices(textured_model,model_textured_with lightmap,lightmap_texture)

for n=1 to countsurfaces(textured_model)
surf=GetSurface(textured_model,n)
next
For n=1 To CountSurfaces(textured_model)

surf=GetSurface(textured_model,n)
lsurf=GetSurface(model_textured_with_lightmap,n)
For v=0 To CountVertices(surf)-1

tu#=VertexU#(lsurf,v)
tv#=VertexV#(lsurf,v)
tw#=VertexW#(lsurf,v)
VertexTexCoords surf,v,tu,tv,tw,1
Next




TextureCoords lightmap_texture,1
EntityTexture textured_model,lightmap_texture,0,1

For e=1 To CountChildren(textured_model)
limb=GetChild(textured_model,e)
limb2=GetChild(model_textured_with_lightmap,e)
MapVertices(limb,limb2,lightmap_texture)
Next

End Function




so, you have to load 2 meshes, one fully textured and then one textured just with lightmap, but geometry must be same..after calling this function simply just call FreeEntity Model_Textured_With_Lightmap and FreeTexture Lightmap_Texture, and thats it...it will work..


John Blackledge(Posted 2005) [#8]
Thanks Alien.

I think I'll stick with the B3D format, but I'll tuck your code away in case.


Tom(Posted 2005) [#9]
Yes John.

B3D is the only format for which Blitz3D will automaticlly import & apply multitexturing if it's specified in the file.


John Blackledge(Posted 2005) [#10]
Er, this may be a silly question, but what does everyone else outside the Blitz community do for lightgmapping?


Beaker(Posted 2005) [#11]
Take a look at the gile[s] forum to find out. There are all sorts of nasty ways, but many engines: DBpro, Ogre, and some others, have their own file format like Blitz.


AdrianT(Posted 2005) [#12]
Giles is by far the best affordable lightmapping tool avaliable, particularly if you use blitz. High end 3D apps can produce better results but also requre more work and understanding of the tools. Whether it's worth that extra effort I'm not sure. I guess it depends on whether you want to sdpend a considerable ammount of extra time :)

I've used max a lot and dabbled with giles on occasion, The part I like best of all with Giles is the Auto UV mapping, which is superior to any general purpose 3D art tool I have used. That and not having to plan to far in advance as to what objects share which lightmaps, which is kind of nice as it takes away a lot of prep time before you actualy start the lightmapping itself.


John Blackledge(Posted 2005) [#13]
Actually what I meant was 'what are people outside the 3D-modelling/gaming community using?'

And I think the answer is that they don't.

They just seem to use 3DSmax or some other high priced software, and create beautiful (but static) shots.

I don't think they know that realtime exists yet.
And of course for them realtime will still carry the stigma of 'gamey!'


AdrianT(Posted 2005) [#14]
yeah, outside of games most 3d is pre rendered, instead of rendering lightmaps all the lighting is rendered per frame. Or in the case of radiosity a lighting model is created once (in a static scene) and rendered per frame from there.

In many ways it's a lot easiuer than making game art, allthough the latest shader 3 type stuff is starting to introduce more pre rendered features. Getting the same visual quality in realtime isn't really possible. You can get good results for a non interactive tech demo.

Can't wait till new tech becomes mainstream, complex shaders can make the texturing side of game art and lighting much easier, and more natural to an artist than faking everything the way it's done now.