Member JamesH Posted September 25, 2008 Member Report Share Posted September 25, 2008 I've spent the last two or three days writing a COLLADA exporter for 2.10 and have got as far as exporting the geometry, normals and texcoords, and being able to import them into an application that supports COLLADA (For me this is the C4 Engine). I'm at the stage now of working on the materials and images that are exported and would like some help if anyone fancies offering it in the following areas: UPDATE : The first release is available from here. Extract the ColladaPlugin.dll to the \Plugins\MeshCodecs folder of your 3DC installation. UPDATE : 01 Oct - Added normal map reference to the node's bound material. - Initially a couple of models in 3DC so that I can have more examples to test on. - And then finally to test the exporter plug-in in a package that supports it. Many thanks James. PS, just a quick image of two of the models in C4. Quote Link to comment Share on other sites More sharing options...
Advanced Member wailingmonkey Posted September 25, 2008 Advanced Member Report Share Posted September 25, 2008 Hi JamesH, What kind of models do you need...what will help you in your testing? I'd be glad to assist if you can clarify a little bit more of what you're looking for. Quote Link to comment Share on other sites More sharing options...
Member JamesH Posted September 25, 2008 Author Member Report Share Posted September 25, 2008 Hi JamesH,What kind of models do you need...what will help you in your testing? I'd be glad to assist if you can clarify a little bit more of what you're looking for. Many thanks for the offer, have you got anything with multiple geometries ? I've not had any models that contain more than one object to test, in theory my code should work with it. A question for Andrew, is there any size data held for the Mesh ? At the moment I'm having to manually edit the .dae file to change the scale I'll also be able to refine my requirements a little more this weekend as I work through some more models, sorry it's a bit vague. Quote Link to comment Share on other sites More sharing options...
Advanced Member wailingmonkey Posted September 25, 2008 Advanced Member Report Share Posted September 25, 2008 Howdy JamesH, Here's a multi-object item to test: It's a little under 20000 triangles since I figured you'd want to make sure medium-sized geometry was tested (and not just 6-sided cubes), but the zip has an 'info.txt' file for further, umm...well, info. for_collada_testing.zip Quote Link to comment Share on other sites More sharing options...
Andrew Shpagin Posted September 26, 2008 Report Share Posted September 26, 2008 A question for Andrew, is there any size data held for the Mesh ? At the moment I'm having to manually edit the .dae file to change the scale There is no scale info - all points has coordinates as is - no additional scaling. Also on note about exported textures. class cSurface has array of textures Tex[]. Tex has field FileName - path to texture. There is usage of that set Tex[0] - Color Tex[1] - Specular Tex[2] - Bump Tex[3] - Normalmap Of course if FileName is empty it means that corresponding channel is not used. Quote Link to comment Share on other sites More sharing options...
Member JamesH Posted September 26, 2008 Author Member Report Share Posted September 26, 2008 Howdy JamesH,Here's a multi-object item to test: It's a little under 20000 triangles since I figured you'd want to make sure medium-sized geometry was tested (and not just 6-sided cubes), but the zip has an 'info.txt' file for further, umm...well, info. Thanks for the obj file, it's certainly sorting my code out ! I should have a finished plugi-in to try sometime tomorrow if you fancy taking it for a spin ? Cheers. Quote Link to comment Share on other sites More sharing options...
Member JamesH Posted September 26, 2008 Author Member Report Share Posted September 26, 2008 There is no scale info - all points has coordinates as is - no additional scaling. Also on note about exported textures.class cSurface has array of textures Tex[]. Tex has field FileName - path to texture. There is usage of that set Tex[0] - Color Tex[1] - Specular Tex[2] - Bump Tex[3] - Normalmap Of course if FileName is empty it means that corresponding channel is not used. Thanks for the info. I think for the scaling and unit size I'll add the line <unit meter="0.01" name="centimeter"/> and users can alter it themselves in the generated file. Quote Link to comment Share on other sites More sharing options...
Member JamesH Posted September 26, 2008 Author Member Report Share Posted September 26, 2008 Hi Andrew, is there a way of referencing the Mesh data, i.e. Raw data and position data per individual object rather than for a whole scene ? COLLADA requires each geometry has its own vertices, normals and texcoords self contained and then referenced within the same geometry node as a polylist. I was thinking maybe of re-indexing the Raw data for each geometry, but this could be time consuming, and another way I suppose would be to include all of the scene vertex, texcoord and normal data for each geometry so at least the Raw data references would work, but the file size would be quite large and wasteful. The only other way would maybe to include some extra data in the Mesh that is exported in the Encode function. Have you any ideas ? Quote Link to comment Share on other sites More sharing options...
Andrew Shpagin Posted September 27, 2008 Report Share Posted September 27, 2008 Hi Andrew, is there a way of referencing the Mesh data, i.e. Raw data and position data per individual object rather than for a whole scene ? COLLADA requires each geometry has its own vertices, normals and texcoords self contained and then referenced within the same geometry node as a polylist. I was thinking maybe of re-indexing the Raw data for each geometry, but this could be time consuming, and another way I suppose would be to include all of the scene vertex, texcoord and normal data for each geometry so at least the Raw data references would work, but the file size would be quite large and wasteful.The only other way would maybe to include some extra data in the Mesh that is exported in the Encode function. Have you any ideas ? Now every point has global position, no additional shift for every object. You can set offset (0,0,0) for the root of sub object of calculate center of sub object and subtract this value from positions. I thingk it is not very time consuming. Also one note about scale - usually all is measured in meters. Quote Link to comment Share on other sites More sharing options...
Advanced Member wailingmonkey Posted September 27, 2008 Advanced Member Report Share Posted September 27, 2008 You're welcome, JamesH ... if you need anything else for testing let me know. Quote Link to comment Share on other sites More sharing options...
Member JamesH Posted September 27, 2008 Author Member Report Share Posted September 27, 2008 Now every point has global position, no additional shift for every object. You can set offset (0,0,0) for the root of sub object of calculate center of sub object and subtract this value from positions. I thingk it is not very time consuming. Also one note about scale - usually all is measured in meters. Sorry Andrew, ignore my ramblings, it's amazing what a night's sleep can do ! I'd forgotten to initialize a variable and it was giving unpredictable results. Anyway, the geometry is being output correctly now and I'm just re-going through file with COLLADA refinery to make sure it adheres to the spec. Quote Link to comment Share on other sites More sharing options...
Member JamesH Posted September 27, 2008 Author Member Report Share Posted September 27, 2008 I'm just finishing off understanding COLLADA texture file locations and UV scale, once that's done, I'll post a plug-in to try. There's still a lot of optimizing to do, but I'll get it working correctly first. Anyway, here's the test model exported from 3DC and imported into a game engine. Quote Link to comment Share on other sites More sharing options...
Advanced Member wailingmonkey Posted September 27, 2008 Advanced Member Report Share Posted September 27, 2008 looking sharp, JamesH ! (now when do you hook up the .gmf exporter to work with the Leadwerks engine?) <grin> Quote Link to comment Share on other sites More sharing options...
New Member Huidafa Posted September 27, 2008 New Member Report Share Posted September 27, 2008 Good job, JamesH. Are you using the Collada DOM APIs for your implementation? Quote Link to comment Share on other sites More sharing options...
Member JamesH Posted September 27, 2008 Author Member Report Share Posted September 27, 2008 looking sharp, JamesH ! (now when do you hook up the .gmf exporter to work with the Leadwerks engine?) <grin> Sorry, I just wanted to get COLLADA up and running, and I've still got to maybe think about an importer as well. Quote Link to comment Share on other sites More sharing options...
Member JamesH Posted September 27, 2008 Author Member Report Share Posted September 27, 2008 Good job, JamesH.Are you using the Collada DOM APIs for your implementation? No, I didn't think of that, I just used TinyXML and the COLLADA spec. Quote Link to comment Share on other sites More sharing options...
New Member Huidafa Posted September 27, 2008 New Member Report Share Posted September 27, 2008 ...I just used TinyXML and the COLLADA spec. I used TinyXML for the last Collada exporter I wrote as well, but I was thinking of moving onto the Collada DOM to support more advanced features, and to make it easier to write out conforming Collada files. However, in the case of 3DC, it doesn't appear that it supports animation or hierarchical transforms, so TinyXML will probably do just fine for basic Collada files that are only handling static, multi-textured geometry. Please let me know if I can help out with the implementation of writing out the texture file locations - it's a bit subtle how the cross references are supposed to work. Quote Link to comment Share on other sites More sharing options...
Member JamesH Posted September 29, 2008 Author Member Report Share Posted September 29, 2008 Here is a plug-in to try. It still has a bit of work needed, namely in the materials department, and it needs created & modified dates adding, but it works for me. Extract ColladaPlugin.zip to your \Plugins\MeshCodecs folder so that the .dll is directly in that folder (MeshCodecs). Then run 3DC, load up a model and select Export, using the dae filetype. I'll be adding more later in the week. Let me know how you get on Cheers. EDIT: You may want to change the <unit> size as well if it is too small. EDIT2: I've changed the default unit size and updated the zip file - I'll also post a link on the first post Quote Link to comment Share on other sites More sharing options...
Advanced Member wailingmonkey Posted October 1, 2008 Advanced Member Report Share Posted October 1, 2008 Howdy JamesH, I've placed the .dll into the 'Plugins->MeshCodecs' folder but I am unable to see/choose '.dae' as an option for export (I've tried with both export options from the 'File' menu on both my laptop and desktop, also tried with DX and OGL versions on each machine). What's the secret ... Quote Link to comment Share on other sites More sharing options...
Member JamesH Posted October 1, 2008 Author Member Report Share Posted October 1, 2008 Howdy JamesH,I've placed the .dll into the 'Plugins->MeshCodecs' folder but I am unable to see/choose '.dae' as an option for export (I've tried with both export options from the 'File' menu on both my laptop and desktop, also tried with DX and OGL versions on each machine). What's the secret ... Are you running 2.10.10 ? Quote Link to comment Share on other sites More sharing options...
Advanced Member wailingmonkey Posted October 1, 2008 Advanced Member Report Share Posted October 1, 2008 Are you running 2.10.10 ? indeed... if it's of any importance or bearing, I've got .NET 2.0 installed on my desktop (not sure which on the laptop) perhaps someone else can test it too? (can't imagine I've managed to screw up your install instructions that badly) Quote Link to comment Share on other sites More sharing options...
Member JamesH Posted October 1, 2008 Author Member Report Share Posted October 1, 2008 indeed... if it's of any importance or bearing, I've got .NET 2.0 installed on my desktop (notsure which on the laptop) perhaps someone else can test it too? (can't imagine I've managed to screw up your install instructions that badly) In the root folder there should be a file named Log.txt, can you have a look for the three entries cMeshIO::AddCodec(): Added "Obj" mesh codec. cMeshIO::AddCodec(): Added "Lwo" mesh codec. cMeshIO::AddCodec(): Added "Fbx" mesh codec. And there should be one just before that reads if the plug-in is being loaded cMeshIO::AddCodec(): Added "dae" mesh codec. Quote Link to comment Share on other sites More sharing options...
Advanced Member wailingmonkey Posted October 1, 2008 Advanced Member Report Share Posted October 1, 2008 doesn't seem to be loading properly for me...the entry before those three is: Loaded image file "textures\vista3.dds" (I can't find 'cMeshIO::AddCodec(): Added "dae" mesh codec.' in the text file) anything hard-coded in the .dll in terms of paths? (cause I've installed 3dC into a c:\graphics\3d-Coat-2-10 path) gonna sleep now, but I'll test more tomorrow. Quote Link to comment Share on other sites More sharing options...
Member JamesH Posted October 1, 2008 Author Member Report Share Posted October 1, 2008 doesn't seem to be loading properly for me...the entry before those three is: Loaded image file "textures\vista3.dds"(I can't find 'cMeshIO::AddCodec(): Added "dae" mesh codec.' in the text file) anything hard-coded in the .dll in terms of paths? (cause I've installed 3dC into a c:\graphics\3d-Coat-2-10 path) gonna sleep now, but I'll test more tomorrow. There's nothing hardcoded, and I've just uninstalled and re-installed into a similar location and it works fine. Incidentally, what OS are you using ? I'm running XP SP2 and XP SP3 on my dev machines, I have another with Vista that I can try tonight to see if I can reproduce your problem. Has anyone else tried the plug-in ? Cheers. Quote Link to comment Share on other sites More sharing options...
Andrew Shpagin Posted October 1, 2008 Report Share Posted October 1, 2008 It works well on last ALPHA. It creates DAE file with reference to texture. Is there some viewer to look it rendered? Is it possible to export with normalmap? I see it is referred in DAE file, but will it be accepted by external render? Quote Link to comment Share on other sites More sharing options...
Member JamesH Posted October 1, 2008 Author Member Report Share Posted October 1, 2008 It works well on last ALPHA. It creates DAE file with reference to texture.Is there some viewer to look it rendered? Is it possible to export with normalmap? I see it is referred in DAE file, but will it be accepted by external render? I've got the Normal map included for the next build which I'll release tonight. Try COLLADA Loader to view the file. Cheers James. Quote Link to comment Share on other sites More sharing options...
Andrew Shpagin Posted October 1, 2008 Report Share Posted October 1, 2008 I've got the Normal map included for the next build which I'll release tonight.Try COLLADA Loader to view the file. Cheers James. Exported files look fine with that viewer. Quote Link to comment Share on other sites More sharing options...
Member JamesH Posted October 1, 2008 Author Member Report Share Posted October 1, 2008 Exported files look fine with that viewer. Thanks, and I've just updated the download to reference the normal map. Quote Link to comment Share on other sites More sharing options...
Andrew Shpagin Posted October 1, 2008 Report Share Posted October 1, 2008 Thanks, and I've just updated the download to reference the normal map. That viewer does not show normals... But I see changes in file structure. Quote Link to comment Share on other sites More sharing options...
Advanced Member wailingmonkey Posted October 1, 2008 Advanced Member Report Share Posted October 1, 2008 bizarre...still won't show up with Alpha18 (doesn't initiate in log.txt either). I'm running XP SP2 (32-bit) and here's where I've got the .dll: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.