Blender UV maps, textures and irrlicht materials

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Andreas
Posts: 166
Joined: Sun Oct 31, 2004 7:15 am
Location: Münster / Germany
Contact:

Blender UV maps, textures and irrlicht materials

Post by Andreas »

Hi everyone,

i'm currently trying to figure out how i can export a Blender scene (let's say a ground mesh and a tree mesh) and load it into irrlicht.

What works for me is having a single mesh (ground and tree joined in Blender), one UV map, a color texture and a lightmap texture together with irrlicht's EMT_LIGHTMAP material type. But this would required a really large texture for a forest scene.

So how can i use multiple textures per mesh, e.g. a texture for the tree's trunk and a different for the leafs? And how do i handle multiple meshes, not joined in Blender.
Additionally, if i use multiple UV maps in Blender (one for the color texture, a different for the lightmap) with two materials, the textures are not applied correctly to the mesh in irrlicht.

Can anyone point me to a tutorial about irrlicht's material, texture, UV map concepts? I think i simply don't get the whole material and texture handling with respect to meshes, mesh buffers, scene nodes and so on. :)

Ideally i would like to model a forest in Blender, use different textures / UV maps for the meshes and a combined texture / UV map for the lightmap. But i don't know if this is even possible.

Thanks
Andreas
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Blender UV maps, textures and irrlicht materials

Post by CuteAlien »

Maybe this glossary helps a little to understand the Irrlicht concepts: http://irrlicht3d.org/wiki/index.php?n= ... ommonTerms
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
Andreas
Posts: 166
Joined: Sun Oct 31, 2004 7:15 am
Location: Münster / Germany
Contact:

Re: Blender UV maps, textures and irrlicht materials

Post by Andreas »

Hi CuteAlien,

thanks for your reply. The documentation helped a lot. :)

But two things i still don't get:
Meshbuffer A meshbuffer does contain the geometric data [...] and exactly one material.
Does this mean i can combine materials for one mesh? E.g. use EMT_TRANSPARENT_ALPHA and EMT_LIGHTMAP_ADD in the same mesh?
Lightmap An additional texture which is put over all static (not moving) objects in a scene.
How do i configure a lightmap for all static objects in the scene? And what is the preferred way of generating the lightmap? Is this possible in Blender?

Best regards
Andreas
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Blender UV maps, textures and irrlicht materials

Post by hybrid »

Yes, you can use more than one material per object (i.e. mesh) by breaking up the mesh into several mesh buffers.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Blender UV maps, textures and irrlicht materials

Post by CuteAlien »

Ok, not my speciality, so maybe someone else knows more about lightmaps. But we used it once in Maya and I think the artist did some "baking" of the lights. And I think Blender also has this baking stuff where you can save the light-calculations as texture.

For combining lightmaps with other textures we used some workaround described here: http://sourceforge.net/p/irrext/code/91 ... oader/LMO/

There might be better solutions.
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
Andreas
Posts: 166
Joined: Sun Oct 31, 2004 7:15 am
Location: Münster / Germany
Contact:

Re: Blender UV maps, textures and irrlicht materials

Post by Andreas »

Hi,

i guess it's time for me to read more about mesh buffers and lightmap usage in irrlicht and experiment a bit...

Thanks for your help! :)

Andreas
Andreas
Posts: 166
Joined: Sun Oct 31, 2004 7:15 am
Location: Münster / Germany
Contact:

Re: Blender UV maps, textures and irrlicht materials

Post by Andreas »

Hi again,

so i tested and learned some more about mesh buffers, UV maps and lightmap baking. But there is still something i hope someone can help me with. :)

My problem is similar to the discussion in this thread: http://irrlicht.sourceforge.net/forum/v ... ap#p277233
Sadly there is no solution documented or at least i don't see it. :(

What i did:
- I created B3D model with two mesh buffers ("ground" and "tree"). Each mesh buffer has a separate color texture and UV map in Blender.
- In order to bake a lightmap i combine the mesh buffers in Blender, created a second UV map and baked the lightmap into a new texture.

So now i have:
- My model: "test.b3d" with a single mesh buffer
- Two color textures: "ground.png" and "tree.png"
- A lightmap texture: "lightmap.png"

Now using the EMT_LIGHTMAP Material in irrlicht, the first texture is used as color texture (where i have two!) and the second texture is used as lightmap (OK).

Is it possible to use all three textures in Irrlicht without using a custom mesh loader light CuteAlien suggested? I would like to keep the tool chain as simple as possible if irrlicht supports that. :)

Thanks
Andreas
Andreas
Posts: 166
Joined: Sun Oct 31, 2004 7:15 am
Location: Münster / Germany
Contact:

Re: Blender UV maps, textures and irrlicht materials

Post by Andreas »

I think i found the solution! Simply seperate the object into different mesh buffers again after lightmap generation. So each mesh buffer has two UV maps, one for the color texture and one for the generated lightmap texture. Then in irrlicht set the material of each mesh buffer to EMT_LIGHTMAP and assign the color texture to the first texture layer of the mesh buffer and the lightmap to the second texture layer. :)
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Blender UV maps, textures and irrlicht materials

Post by CuteAlien »

Yeah, sounds better than my solution :-)
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
Post Reply