exporting a material for each object.

efkoj

10-04-2006 00:58:40

Hey,

When i try to export with the check option create material for each object. It crashes.

This is what the ogre log file says.

01:33:04: Creating resource group General
01:33:04: Registering ResourceManager for type Mesh
01:33:04: Registering ResourceManager for type Skeleton
01:33:04: Registering ResourceManager for type Material
01:33:04: An exception has been thrown!

-----------------------------------
Details:
-----------------------------------
Error #: 4
Function: MaterialSerializer::exportQueued
Description: Queue is empty !.
File: C:\ogre3d\OgreMain\src\OgreMaterialSerializer.cpp
Line: 2684
Stack unwinding: <<beginning of stack>>


I would need this to be able to use lightmaps. Since you have to attach them to each material but i use the same material for different objects in the scene.

I dont know if this bug is already known or if iam doing something wrong.

Thx in advance,
Grtz,

Lioric

10-04-2006 17:01:59

This is a know issue and its fixed in the current build that will be uploaded soon

efkoj

10-04-2006 17:14:29

when will it be uploaded? :)
any idea? Do you know of alternatives to do the lightmaps then?

Lioric

10-04-2006 18:20:22

Do you want to use the same material name for different objects but with different settings (textures) ?

Are those objects in different scenes?

Why dont use an atlas texture for the lightmaps?

efkoj

10-04-2006 22:14:39

Do you want to use the same material name for different objects but with different settings (textures) ?

It does not have to be the same material name. But at this point it is in max. Becouse i reused the same material for different objects when exporting it doesnt make a material for each object.

Are those objects in different scenes?

No they are not.

Why dont use an atlas texture for the lightmaps?

I quickly searched this on the net but it seems complicated and we have to deliver our project friday so i dont have allot of time to learn it.
I guess there will be no lightmaps for us unless there is still an other alternative then using atlas texturing?

Lioric

10-04-2006 23:18:06

A workaround to that issue is:

In the "Scene settings" panel set a sky technique (the skyplane will do it)
Click on sky material and assign a default material from the material editor (can be a blank standard material)

And the scene can be exported with the "Per object material file" option

But i dont see how using the same material name for different materials wont produce an error in your application, when the different materials are parsed and they use the same name an error is reported, and if you continue the first loaded material with that name will be used for all entities that reference that material name

You can use the maxscript support to change and rename duplicated material names in your scene automatically, i.e


local array or map
for i in selection do (
get selected object material
if materialName is in the map (or iterated array) do (
rename material
)
add material to a map with materialName as the key (or add to the array)
)

efkoj

10-04-2006 23:39:04

Thx for your quick reply.
Your workarround works fine but i was confused i thought that the option Per object material file would generate a different material for each object in my scene thats what i need to.

Becouse at this point i have a light map for every object(mesh) but i cannot appoint it to my meshes becouse the meshes share the same materials.

I thought the option would generate a material for every object (mesh) in the scene even when its not defined in max.
But iam wrong sorry for this confusion.

Does this mean i have the bad approach i did your lightanimation tutorial a few times but it only has 2 objects my scene is much bigger.

Hope you can point me in the right direction.

Thx for your patience,

Evak

11-04-2006 00:14:47

It's a bit of a pain, but I'd recommend either attaching all the same material meshes and applying a lightmap to them all at once, and then seperating them again afterwards.

You might want to try the multiUVW script that lets you map several objects in UVunwrap, and then pretta button to seperate them back into seperate meshes.

Another solution is to use a third party tool like giles to create your mapping coordinates. It's a material based global illumination lightmap editor, rather than a per object one. And does have import features.

Having a lightmap per object is probably going to be expensive, I'm pretty new to ogre so I don't know how it renders exactly but with other engines its better to have fewer larger lightmaps shared over several seperate objects.

If your interested in GILE there's a link here.

http://www.frecle.net/giles/

It has a AUTO UV tool considerably better than 3ds maxes and is very quick to set up. and there is an ogre exporter. And a Giles .gls 3ds max importer.

I actually use it for quick uv mapping my scene and only render lightmaps in 3dsmax if the extra effort warrants it. Takes me a couple of days to do a complex environments mapping efficiently in Max, and that part can be done multiple times faster, an hour or so the AUTOUV's are that good.

Evak

11-04-2006 00:23:55

Multi Objects Unwrap:

http://users.skynet.be/arketip/arketip_ ... rapENG.htm

Another good script I use is Bakersfield

http://www.chuggnut.com/scripts/bakersf ... sfield.htm

This one simply makes the lightmapping process a lot easier, and keeps track of your lightmapped scene better. It also doesn't reset the UV channel to 3 everytime you load the scene up :)