Easy Ogre Exporter for 3DSMAX

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

Hi,
I just commit a correction on the exporter (a crash on non valid texture channel but max return a number of channel)

as I said before I don't know where I could manage this sort of stuff directly with max interfaces :/
adding specific data on max node with an external plugin can make the max file crash if the plugin is not installed, as Ogre Max :/
OpenSpace 3D Project manager
http://www.openspace3d.com
Pulas
Halfling
Posts: 61
Joined: Sat Oct 29, 2011 9:39 am

Re: Easy Ogre Exporter for 3DSMAX

Post by Pulas »

arkeon wrote:adding specific data on max node with an external plugin can make the max file crash if the plugin is not installed, as Ogre Max :/
Yeah, this problem of OgreMax exporter has been bothering me a long time.

Additional, I have some other questions:
1. the option "Convert textures to DDS": texture will be converted to DDS file with DXT1? DXT5 for texture with alpha?
But after exporting with this option on, the exported DDS file is not compressed format. I checked it in DirectX Texture Tool.

2. the option "Use shared geometry(not supported by all cards)": Does this option is the same as checking instance of OgreMax? The copied instances will be exported to only one mesh?

3. the exporter doesn't check the name of SceneNode to be unique? If the name of child node is the same as the name of parent node, ogre Application will crash.
User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 16
Contact:

Re: Easy Ogre Exporter for 3DSMAX

Post by AshMcConnell »

arkeon wrote: as I said before I don't know where I could manage this sort of stuff directly with max interfaces :/
adding specific data on max node with an external plugin can make the max file crash if the plugin is not installed, as Ogre Max :/
Ah I see, that's a shame as that feature transforms 3dsmax into a level editor :(
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

Hello,

1. yes the DDS conversion use DXT1 and DXT5 for bitmaps with alpha.
compressionOptions.setFormat(bitmap->HasAlpha() ? nvtt::Format_DXT5 : nvtt::Format_DXT1);

2. Shared geometry is not for instances http://www.ogre3d.org/tikiwiki/tiki-ind ... 20Geometry
But EOE manage mesh references to export only one mesh when possible.

3. you're right I think I forgot this point


@AshMcConnell you could modify EOE for your needs, and if you find a good way to manage this you are welcome :)
OpenSpace 3D Project manager
http://www.openspace3d.com
User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 16
Contact:

Re: Easy Ogre Exporter for 3DSMAX

Post by AshMcConnell »

I would love to help, but I have no experience of 3dsmax coding. However I do have a friend who has, perhaps he could help, I'll see if he is busy :)

Thanks for a great exporter btw, I hope you don't think I was running it down! I just like to limit the pain for my artist by minimising the steps for 3dsmax to in-game :D
Pulas
Halfling
Posts: 61
Joined: Sat Oct 29, 2011 9:39 am

Re: Easy Ogre Exporter for 3DSMAX

Post by Pulas »

Hi again, I found some problems about exporting alpha_blend material:

1. When to determine the type of scene_blend of material, the bitmaps of texture map are created and loaded to determine if there is alpha channel, but the bitmaps are not deleted correctly. When exporting a big max file, the memory of 3dsmax will always increases.

I added following codes in ExMaterial.cpp, then the memory keeps right.
line 1019

Code: Select all

ExMaterial::loadStandardMaterial()
{
	......
	// delete the bitmap [12/7/2012 Pulas]
	bitmap->DeleteThis();
	TheManager->DelBitmap(bitmap);
	......
}
There are some more places like this, maybe they are all needed to add "bitmap->DeleteThis();".

Code: Select all

ExMaterial.cpp(549):TheManager->DelBitmap(bitmap);
ExMaterial.cpp(962):	TheManager->DelBitmap(bitmap);
ExMaterial.cpp(1020):TheManager->DelBitmap(bitmap);
ExMaterialSet.cpp(525):TheManager->DelBitmap(bitmap);
2. It is not always right to determine the type of scene_blend using this way whether bitmap file of texture map has a alpha channel. First of all, there is always a alpha channel for DXT file. DXT1 file has a one bit alpha channel, but it is not used for alpha blend generally. Additional, the speed of exporting will be very slow as result of opening every texture map file.
Maybe it is a better method to determine if there is a opacity map in Max material.

Code: Select all

ExMaterial::writeMaterialPass()
{	
		......
		// determine if having opacity map [12/6/2012 zhangzh]
		bool bHasOpacityMap = false;
		for (unsigned int i=0; i<m_textures.size(); ++i)
		{
			if(m_textures[i].type == ID_OP)
			{
				bHasOpacityMap = true;
				break;
			}
		}

		......

		//if material is transparent set blend mode and turn off depth_writing
		if (m_isTransparent || (m_bPreMultipliedAlpha && m_hasAlpha && bHasOpacityMap) && ((pass == ExShader::SP_AMBIENT) || (pass == ExShader::SP_NONE) || (pass == ExShader::SP_NOSUPPORT)))
		{
			outMaterial << "\n\t\t\tscene_blend alpha_blend\n";
			outMaterial << "\t\t\tdepth_write off\n";
		}

		if(m_hasAlpha && !m_bPreMultipliedAlpha && bHasOpacityMap)
			outMaterial << "\n\t\t\talpha_rejection greater 128\n";
		......
}
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

Hi !

thanks for the issues i'll correct that.

About the opacity detection, i have done this way because I manage the "alpha source" too from the texture params.
To use the opacity map from max material this should mean an grey opacity map or a bitmap with an alpha channel, or export the opacity only when the Opacity map is the same bitmap as the diffuse one ... this add many cases to manage in shaders and standard material too.
an idea ?
OpenSpace 3D Project manager
http://www.openspace3d.com
rossTnick
Gnoblar
Posts: 8
Joined: Thu Jan 03, 2013 4:47 pm

Re: Easy Ogre Exporter for 3DSMAX

Post by rossTnick »

Hi Arkeon,

First off - great job on the exporter, very excellent work. I have run into an issue that I'm wondering if you could point me in some direction of resolving. I have a model with several objects in it, some of them using multi-materials. When I export, some of the objects export fine, while others throw errors in the export log looking like this:

Found node: I
Found mesh node: I
Info: Number of map channel (UV) found in this mesh : 1
Writing I mesh binary...
Info: Create Ogre submeshs
Info: create submesh : 0
Info: create submesh : 1
Info: create submesh : 2
Info: Ignore instanciated mesh
Error writing mesh binary file
Warning, mesh skipped

Found node: I
Found mesh node: I
Info: Number of map channel (UV) found in this mesh : 1
Writing I mesh binary...
Info: Create Ogre submeshs
Info: create submesh : 0
Info: create submesh : 1
Info: create submesh : 2
Info: Ignore instanciated mesh
Error writing mesh binary file
Warning, mesh skipped

Found node: I
Found mesh node: I
Info: Number of map channel (UV) found in this mesh : 1
Writing I mesh binary...
Info: Create Ogre submeshs
Info: create submesh : 0
Info: create submesh : 1
Info: create submesh : 2
Info: Ignore instanciated mesh
Error writing mesh binary file
Warning, mesh skipped


This ends up resulting in an export that is missing a good chunk of the scene. From this log, do you know if there's something within the file that would be causing this? Thanks and keep up the great work.
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

Hello !

are you on windows 8 ?
this seems be to a directory right problem.
remove the windows "parano" mode (disable the restricted user rights), or try to export in an user directory like "my documents".
OpenSpace 3D Project manager
http://www.openspace3d.com
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

Ouups I responded to quickly ^^

This is not an error (the message is badly named in this case)

The mesh is skipped because it's an instantiated mesh.
look at the dot scene file, the original mesh is linked to the object name in the scene.
OpenSpace 3D Project manager
http://www.openspace3d.com
rossTnick
Gnoblar
Posts: 8
Joined: Thu Jan 03, 2013 4:47 pm

Re: Easy Ogre Exporter for 3DSMAX

Post by rossTnick »

Ahh I see the problem now - actually what's going on is some of the nodes in my Max file have either a single quotation or a double quotation in their name (i.e. as in distance measurements - the model originally came from Revit)

What I'm then seeing is the node name=' ' in the dotscene file replaces the single quotation from the max node name with &apos and the double quotation with &quot. Maybe these could be fixed through some careful '\' placements in the exporter?

Obviously a renaming of these will fix the issue - wanted to let you know though what was happening - thanks for the quick response.
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

You're right, thank you.

issue added http://redmine.scolring.org/issues/443
I'll look at this when I'll have some time.
OpenSpace 3D Project manager
http://www.openspace3d.com
rossTnick
Gnoblar
Posts: 8
Joined: Thu Jan 03, 2013 4:47 pm

Re: Easy Ogre Exporter for 3DSMAX

Post by rossTnick »

So there actually is some sort of problem still occuring (after correcting names) related to instancing and / or referencing of meshes. For example, I have 4 objects that reference the same mesh in the dotscene file; however, the mesh they are referencing was never written out during the export. Below is from a search in the dotscene file.

Line 3140: <node name="SWITCHES-VARIOUS THREE WAY [888680]" id="598" isTarget="false">
Line 3144: <entity name="proposalSWITCHES-VARIOUS_THREE_WAY_[888680]" id="599" meshFile="proposalSWITCHES-VARIOUS_THREE_WAY_[922293].mesh" castShadows="true">
Line 3150: <node name="SWITCHES-VARIOUS THREE WAY [888705]" id="600" isTarget="false">
Line 3154: <entity name="proposalSWITCHES-VARIOUS_THREE_WAY_[888705]" id="601" meshFile="proposalSWITCHES-VARIOUS_THREE_WAY_[922293].mesh" castShadows="true">
Line 3965: <node name="SWITCHES-VARIOUS THREE WAY [922056]" id="736" isTarget="false">
Line 3969: <entity name="proposalSWITCHES-VARIOUS_THREE_WAY_[922056]" id="737" meshFile="proposalSWITCHES-VARIOUS_THREE_WAY_[922293].mesh" castShadows="true">
Line 3975: <node name="SWITCHES-VARIOUS THREE WAY [922293]" id="738" isTarget="false">
Line 3979: <entity name="proposalSWITCHES-VARIOUS_THREE_WAY_[922293]" id="739" meshFile="proposalSWITCHES-VARIOUS_THREE_WAY_[922293].mesh" castShadows="true">

The mesh that wrote out to the mesh directory is named: proposalSWITCHES-VARIOUS_THREE_WAY_[888680].mesh. It appears the mesh that was actually written is named the same as the first node in the sequence of these nodes (888680) but the name written to the dotscene file for "meshFile" is the last name of the node in the sequence (922293). Similar issues occur with other mesh's in my max model, it doesn't look like they necessarily follow this first/last naming pattern but I could look further into that if to confirm if that would help.

Thanks for any help!
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

Hi !

what version of 3DSMAX do you use ?
OpenSpace 3D Project manager
http://www.openspace3d.com
rossTnick
Gnoblar
Posts: 8
Joined: Thu Jan 03, 2013 4:47 pm

Re: Easy Ogre Exporter for 3DSMAX

Post by rossTnick »

3D Studio Max 2013, but I have access to other previous versions. This particular export was done on a 32 bit version, but I've seen similar results with 64 bit as well. Thanks!
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

Hi !

The corrected version is available : EOE 1.5

I added some corrections from @Pulas posts (thanks again)
and corrected the bad instantiate mesh name selection on MAX 2013

@rossTnick please let me know if it works for you.
OpenSpace 3D Project manager
http://www.openspace3d.com
rossTnick
Gnoblar
Posts: 8
Joined: Thu Jan 03, 2013 4:47 pm

Re: Easy Ogre Exporter for 3DSMAX

Post by rossTnick »

Awesome, thanks for the quick turn-around - it looks to be working great now!

Thanks again.
ftejada
Halfling
Posts: 65
Joined: Sun Feb 14, 2010 10:18 pm

Re: Easy Ogre Exporter for 3DSMAX

Post by ftejada »

Sorry but I try to enter the link to download the plugin but can not find the page.
How I can download it? I hope your answer, greetings.
ftejada
Halfling
Posts: 65
Joined: Sun Feb 14, 2010 10:18 pm

Re: Easy Ogre Exporter for 3DSMAX

Post by ftejada »

arkeon wrote:Hello !

new version : 1.5 on 24/01/2013

Added Optional textures conversion to DDS format.
Added automatic shaders generator for normal / specular map and simple pixel lighting with multi light

As usual for our users, we were looking for an easy and free Ogre exporter for 3ds Max, and cannot found any with a good standard material converter nor a simple interface.
Last time that I need to export a simple scene it took me several hours to convert and set materials (and several crash).
So I decided to make my own exporter ^^

The objective for the Easy Ogre Exporter is to be the most simple as possible but with a lots of direct conversions from max scenes, and sure to be free and LGPL
3ds Max users are not developers !!

I started from the code of the FxOgreFxExporter (to get some clues), but since this exporter only manage a single mesh, I rewrote almost every thing
Here the current working state :
- one click export from the Max export menu > Ogre scene
- mesh binary export for each objects in the scene
- standard material conversions with colors, multi textures / uvs, refmap channel, transparency and material options like "double sided" or "wire"
- Architecture material conversion, with colors, diffuse texture, multi uv and transparency
- Mentalray Arch / Design material conversion, with colors, diffuse texture, multi uv and transparency
- export the textures files
- skeleton with animations from the main track or from the biped mixer if available
- nodes animations from the main track for each node in the dot scene
- lights and cameras ^^
- automatic unit conversion to meter
- morph animations
- mesh poses
- vertex animations
- small dialog interface for a minimum of setting like the Ogre version for meshs, prefixs, directories ...
- manage animations from the motion mixer
- generated shaders for normal maps or pixel lighting options
- textures conversion / optimization to DDS format
What next :
- a setup for quick installation

Actual exporter is compiled for max 9 to max 2013 in 32 and 64bits, can export in all Ogre versions

you can get the plugins files here
https://arkeon.dyndns.org/svn-scol/trun ... er/output/
chose your max version and copy the dle file in your max plugins directory

Please give me some feed back if you found some mistakes on the materials or animations conversions

If some developers with an experience on the Max SDK want to participate please do :)
the lack of max SDK documentation give me some headache ^^

sources : https://arkeon.dyndns.org/svn-scol/trun ... xExporter/

Enjoy !
Sorry but I try to enter the link to download the plugin but can not find the page.
How I can download it? I hope your answer, greetings.
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

hello !

- Go there : https://arkeon.dyndns.org/svn-scol/trun ... er/output/
- Accept the certificate
- choose your windows (32 or 64 bits)
- choose your max version and download the dle file.
- then copy the dle file in your max/plugins directory

that's all :)
OpenSpace 3D Project manager
http://www.openspace3d.com
V1adimir
Gnoblar
Posts: 2
Joined: Tue Mar 05, 2013 10:51 am

Re: Easy Ogre Exporter for 3DSMAX

Post by V1adimir »

Hello!
Can you add the possibility to export scene, meshes (and other) via maxscript?
Thanks.
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

Hello !

what do you mean by "via maxscript" ?
OpenSpace 3D Project manager
http://www.openspace3d.com
V1adimir
Gnoblar
Posts: 2
Joined: Tue Mar 05, 2013 10:51 am

Re: Easy Ogre Exporter for 3DSMAX

Post by V1adimir »

without Export dialog:

Code: Select all

exportFile some_path #noPrompt selectedOnly:true using:#OgreExporter
because it's need "Ok" pressing

something like this: EasyOgreExportMeshes exportpath:@"" nodes:#() usesceleton:true..., EasyOgreExportScene exportpath:@"" nodes:#()
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

please add a ticket on http://redmine.scolring.org/projects/eoe/issues
I dont know how to handle this, but I'll look when I have time.
OpenSpace 3D Project manager
http://www.openspace3d.com
Orobu
Gnoblar
Posts: 12
Joined: Tue Mar 26, 2013 7:39 pm
x 4

Re: Easy Ogre Exporter for 3DSMAX

Post by Orobu »

Do the bones need to be biped in the motion mixer? im using dummy bones and only get one animation even though i use different clips on the track.
Post Reply