[Fixed] Max 2009 -> Irrlicht, multiple UVs, batch export
[Fixed] Max 2009 -> Irrlicht, multiple UVs, batch export
Hello,
I've searched the forum about how to export meshes from max to irrlicht with 2 uv coords, but did not found any solution working with max 2009.
- second uv in panda .x files is not readable by irrlicht (FVFData error)
- b3d does not work for max 8 to 2009
- ogre .mesh did not worked too
...
[FIXED]
Has been fixed on irrlicht SVN. It is now working with panda exporter, and it is the only way (at least with latest 3d max 2009 32 & 64bit)
[EDIT]
If you want to batch export multiples objects to differents .x meshs at once, you can use panda exporter maxscript tool
I've searched the forum about how to export meshes from max to irrlicht with 2 uv coords, but did not found any solution working with max 2009.
- second uv in panda .x files is not readable by irrlicht (FVFData error)
- b3d does not work for max 8 to 2009
- ogre .mesh did not worked too
...
[FIXED]
Has been fixed on irrlicht SVN. It is now working with panda exporter, and it is the only way (at least with latest 3d max 2009 32 & 64bit)
[EDIT]
If you want to batch export multiples objects to differents .x meshs at once, you can use panda exporter maxscript tool
Last edited by poulpi33 on Mon Jan 19, 2009 7:49 pm, edited 4 times in total.
I would open the X file in MilkShape3D and save to B3D or MS3D format, or fix loading the second set of texture coords in the X loader.
No promises here but if you can post an X file with two sets of texture coordinates it would make a good bit of test data for anyone looking to improve the X loader.
No promises here but if you can post an X file with two sets of texture coordinates it would make a good bit of test data for anyone looking to improve the X loader.
hi,
I use lightmapping(2uv) using 3ds max and b3d exporter by onigirl. I have tested it on max7 and 2008 and worked fine. I have seen that the plugin has some problem in max2009. You may get help from the author of that plugin (www.onigirl.com).
Presently im using 3ds max 7 and works fine....
I use lightmapping(2uv) using 3ds max and b3d exporter by onigirl. I have tested it on max7 and 2008 and worked fine. I have seen that the plugin has some problem in max2009. You may get help from the author of that plugin (www.onigirl.com).
Presently im using 3ds max 7 and works fine....
skumar
Thanks for help.
Here a simple mesh.x with 2 uv coords:
http://www.ecranbl.eu/archi/mesh.x
Unknown data object in mesh in x file: FVFData
And the mesh does not show at all
http://www.ecranbl.eu/archi/mesh.x
MilkShape can't import .x but i will try with fbx.bitplane wrote:I would open the X file in MilkShape3D and save to B3D or MS3D format, or fix loading the second set of texture coords in the X loader.
No promises here but if you can post an X file with two sets of texture coordinates it would make a good bit of test data for anyone looking to improve the X loader.
Here a simple mesh.x with 2 uv coords:
http://www.ecranbl.eu/archi/mesh.x
I use panda exporter, and set up textures in iirlicht manually, with custom material and shader. When running the app i got the following error in the console:hybrid wrote:The FVF data parser is already implemented, this should be in 1.5 already. Question is if the meshbuffers are properly created. The remaining problem is that you cannot specify to use lightmaps in the file format. So you have to do some things manually when going the .x way.
Unknown data object in mesh in x file: FVFData
And the mesh does not show at all
http://www.ecranbl.eu/archi/mesh.x
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
poulpi33
Import it in 3DS, create a multiple surface type, put your first UV in ID1 and the second UV in ID2 (surface ID)
Then put all the UVs in the same channel (normally channel 1).
That method worked for me.
The result is that you will have all the UV in the SAME channel, but each UV is set on a specific surface ID. For example, this is great for having a UV texture specificaly on a BODY and one for the HEAD (Two textures). All the UV are in the same channel, but each surface (HEAD is specifically using the material "HEAD" and using specific UV inside the channel. The same for the body.
If done this in Hammer and it worked flawlessly. It should work also in IRRlicht.
Import it in 3DS, create a multiple surface type, put your first UV in ID1 and the second UV in ID2 (surface ID)
Then put all the UVs in the same channel (normally channel 1).
That method worked for me.
The result is that you will have all the UV in the SAME channel, but each UV is set on a specific surface ID. For example, this is great for having a UV texture specificaly on a BODY and one for the HEAD (Two textures). All the UV are in the same channel, but each surface (HEAD is specifically using the material "HEAD" and using specific UV inside the channel. The same for the body.
If done this in Hammer and it worked flawlessly. It should work also in IRRlicht.
hi christianclavet (c'est français ca non ? )
This can't work for lightmaps because this is the exact same faces wich need two uv coords.
I've tried importing to milkshape with .fbx and export in .b3d an .ms3d, did not worked. Could not verifiy if the problem here comes from the import of .fbx in milkshape or from the export, because i did not found a way in the milkshape uv editor to show uv2
I downloaded the last svn version revision 2053 and like hybrid, no fvfdata error anymore but the mesh still not show. I will try different .x exports ...
Definitely need a way to easily import meshs with multiples coords from max, couldn't live without that !
This can't work for lightmaps because this is the exact same faces wich need two uv coords.
I've tried importing to milkshape with .fbx and export in .b3d an .ms3d, did not worked. Could not verifiy if the problem here comes from the import of .fbx in milkshape or from the export, because i did not found a way in the milkshape uv editor to show uv2
I downloaded the last svn version revision 2053 and like hybrid, no fvfdata error anymore but the mesh still not show. I will try different .x exports ...
Definitely need a way to easily import meshs with multiples coords from max, couldn't live without that !
@poulpi33
As far as I know b3d is really your optimal choice, especially if you have max... As it looks though the exporter doesnt support max 2009.
Anyone correct me if I'm wrong but from my experience neither .fbx nor .obj support 2 UV sets... So what I did is export my mesh twice, one time with the first UV set and the diffuse map, second time with 2nd UV set and the lightmap set as diffuse map. Then merge the UV sets inside irrlicht... I've written a function to accomplish that...
maybe it helps...
As far as I know b3d is really your optimal choice, especially if you have max... As it looks though the exporter doesnt support max 2009.
Anyone correct me if I'm wrong but from my experience neither .fbx nor .obj support 2 UV sets... So what I did is export my mesh twice, one time with the first UV set and the diffuse map, second time with 2nd UV set and the lightmap set as diffuse map. Then merge the UV sets inside irrlicht... I've written a function to accomplish that...
Code: Select all
scene::SMesh* LoadLightmapMeshes(scene::IAnimatedMesh* texturemesh, scene::IAnimatedMesh* lightmapmesh )
{
scene::IMesh* workTextureMesh = texturemesh->getMesh(0);
scene::IMesh* workLightmapMesh = lightmapmesh->getMesh(0);
scene::SMesh* SFinalMesh = new irr::scene::SMesh();
u32 TmbCount = workTextureMesh->getMeshBufferCount();
u32 LMmbCount = workLightmapMesh->getMeshBufferCount();
printf("Amount of Buffers in texturemesh: %d \n",TmbCount);
printf("Amount of Buffers in lightmapmesh: %d \n\n",LMmbCount);
if(TmbCount == LMmbCount){
u32 i;
for(i=0; i < workTextureMesh->getMeshBufferCount(); i++){
//printf("Mesh Buffer#: %d \n ",i);
scene::SMeshBufferLightMap * new2Tbuffer = new scene::SMeshBufferLightMap();
scene::IMeshBuffer* bufferTM = workTextureMesh->getMeshBuffer(i);
scene::IMeshBuffer* bufferLM = workLightmapMesh->getMeshBuffer(i);
u32 numVerticesTM = bufferTM->getVertexCount(); // get the amount of vertices in Texturemesh meshbuffer
u32 numIndicesTM = bufferTM->getIndexCount(); // get the amount of indices in Texturemesh meshbuffer
u32 numVerticesLM = bufferLM->getVertexCount(); // get the amount of vertices in Lightmapmesh meshbuffer
u32 numIndicesLM = bufferLM->getIndexCount(); // get the amount of indices in Lightmapmesh meshbuffer
printf("Amount of Vertices in texturemesh: %d \n ",numVerticesTM);
printf("Amount of Vertices in lightmapmesh: %d \n \n ",numVerticesLM);
//get pointer to Vertices and cast to irr::video::S3DVertex - Texturemesh
video::S3DVertex *bufferVerticesTM = (irr::video::S3DVertex*)bufferTM->getVertices();
//get pointer to Indices - Texturemesh
irr::u16 *bufferIndicesTM = bufferTM->getIndices();
//get pointer to Vertices and cast to irr::video::S3DVertex - LightmapMesh
video::S3DVertex *bufferVerticesLM = (irr::video::S3DVertex*)bufferLM->getVertices();
//get pointer to Indices - LightmapMesh
irr::u16 *bufferIndicesLM = bufferLM->getIndices();
//Create storage for new combined S3DVertex2TCoords,indices and material
core::array<video::S3DVertex2TCoords> vertices;
core::array<u16> indices;
video::SMaterial CurrMaterial = bufferTM->getMaterial();
// push vertices into Storage and push
// TCoords of Lightmapmesh to TCoords2 of Texturemesh
u32 j;
u32 Cmax;
if(numVerticesTM > numVerticesLM){
Cmax = numVerticesLM;
}else if(numVerticesLM > numVerticesTM){
Cmax = numVerticesTM;
}else if(numVerticesLM == numVerticesTM){
Cmax = numVerticesLM;
}
for (j = 0; j < Cmax; ++j){
bufferVerticesTM[j].Color = 16777215; //Maya X-Exporter bug
vertices.push_back(video::S3DVertex2TCoords(bufferVerticesTM[j].Pos, bufferVerticesTM[j].Normal,
bufferVerticesTM[j].Color, bufferVerticesTM[j].TCoords, bufferVerticesLM[j].TCoords));
}
// push indices into Storage
u32 k;
for (k = 0; k < numIndicesTM; ++k)
indices.push_back(bufferIndicesTM[k]);
//get Texture from slot1 of Lightmapmesh
video::SMaterial CurrMaterialLM = bufferLM->getMaterial();
video::ITexture* CurrentTextureLM = CurrMaterialLM.getTexture(0);
//change Material Type and apply Lightmapmeshs Texture to slot2 of Texturemesh
CurrMaterial.MaterialType = irr::video::EMT_LIGHTMAP_LIGHTING_M2;
CurrMaterial.setTexture(1,CurrentTextureLM);
CurrMaterial.Lighting = false;
//Add stored data to new buffer
new2Tbuffer->Material = CurrMaterial;
new2Tbuffer->Vertices = vertices;
new2Tbuffer->Indices = indices;
new2Tbuffer->recalculateBoundingBox();
SFinalMesh->addMeshBuffer(new2Tbuffer);
}
}else{
printf("Unsane operation... trying to combine meshes with different amounts of Materials");
return 0;
}
SFinalMesh->recalculateBoundingBox();
return SFinalMesh;
}
CuteAlien did a similar thing, the code is here. The tool merges two LWO files together into a new mesh format, and the loader allows Irrlicht to load this new format.zillion42 wrote: Anyone correct me if I'm wrong but from my experience neither .fbx nor .obj support 2 UV sets... So what I did is export my mesh twice, one time with the first UV set and the diffuse map, second time with 2nd UV set and the lightmap set as diffuse map. Then merge the UV sets inside irrlicht... I've written a function to accomplish that...
These workarounds are too much work for bigger projects.
You have to duplicate each object in max wich have 2 coords and copy uv2 on uv1 each time you wan't to export. For 4 or 5 object it's ok, but for a complete scene ...
Maybe de .x multiple uv is working know in latest svn version, but actually .x mesh is not drawn on the screen.
here a simple box in .x format with multiple coords, and a texture wich if applied on uv1 show "UV1" on the mesh, and if applied on uv2 show "UV2"
http://www.ecranbl.eu/irr/
.3ds show in the viewport, .x doesn't
You have to duplicate each object in max wich have 2 coords and copy uv2 on uv1 each time you wan't to export. For 4 or 5 object it's ok, but for a complete scene ...
Maybe de .x multiple uv is working know in latest svn version, but actually .x mesh is not drawn on the screen.
here a simple box in .x format with multiple coords, and a texture wich if applied on uv1 show "UV1" on the mesh, and if applied on uv2 show "UV2"
http://www.ecranbl.eu/irr/
.3ds show in the viewport, .x doesn't