Jump to content


Notice about Feature Requests & Bug Reports

The bug reporting and feature request forums (except for the Urgent Help section) are going away soon! Please use Mantis to report any bugs and feature requests. the link to Mantis is:
3d-coat.com/mantis/

Read more about it HERE.

Photo

COLLADA Exporter


  • Please log in to reply
43 replies to this topic

#1 JamesH

JamesH

    Neophyte

  • Member
  • Pip
  • 25 posts

Posted 25 September 2008 - 08:58 PM

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.

Posted Image

#2 wailingmonkey

wailingmonkey

    Apprentice

  • Member
  • PipPipPip
  • 701 posts

Posted 25 September 2008 - 09:57 PM

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. :)
-portfolio-


Vista Ultimate SP1 64bit | Q6600 2.40 GHZ | 8GB RAM | Nvidia GTX 560ti

#3 JamesH

JamesH

    Neophyte

  • Member
  • Pip
  • 25 posts

Posted 25 September 2008 - 10:21 PM

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.

#4 wailingmonkey

wailingmonkey

    Apprentice

  • Member
  • PipPipPip
  • 701 posts

Posted 26 September 2008 - 01:48 AM

Howdy JamesH,

Here's a multi-object item to test:

Posted Image

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. :D

Attached Files


-portfolio-


Vista Ultimate SP1 64bit | Q6600 2.40 GHZ | 8GB RAM | Nvidia GTX 560ti

#5 Andrew Shpagin

Andrew Shpagin

    3DC creator & admin

  • 3D-Coat Developer
  • PipPipPipPipPipPip
  • 6,609 posts

  • Gender:Male

Posted 26 September 2008 - 08:06 AM

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.

#6 JamesH

JamesH

    Neophyte

  • Member
  • Pip
  • 25 posts

Posted 26 September 2008 - 07:55 PM

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. :D


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.

#7 JamesH

JamesH

    Neophyte

  • Member
  • Pip
  • 25 posts

Posted 26 September 2008 - 07:57 PM

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.

#8 JamesH

JamesH

    Neophyte

  • Member
  • Pip
  • 25 posts

Posted 27 September 2008 - 12:55 AM

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 ?

#9 Andrew Shpagin

Andrew Shpagin

    3DC creator & admin

  • 3D-Coat Developer
  • PipPipPipPipPipPip
  • 6,609 posts

  • Gender:Male

Posted 27 September 2008 - 06:26 AM

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.

#10 wailingmonkey

wailingmonkey

    Apprentice

  • Member
  • PipPipPip
  • 701 posts

Posted 27 September 2008 - 08:22 AM

You're welcome, JamesH ... if you need anything else for testing let me know.
-portfolio-


Vista Ultimate SP1 64bit | Q6600 2.40 GHZ | 8GB RAM | Nvidia GTX 560ti

#11 JamesH

JamesH

    Neophyte

  • Member
  • Pip
  • 25 posts

Posted 27 September 2008 - 12:55 PM

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.

#12 JamesH

JamesH

    Neophyte

  • Member
  • Pip
  • 25 posts

Posted 27 September 2008 - 06:09 PM

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.

Posted Image

#13 wailingmonkey

wailingmonkey

    Apprentice

  • Member
  • PipPipPip
  • 701 posts

Posted 27 September 2008 - 06:23 PM

looking sharp, JamesH ! (now when do you hook up the .gmf exporter to work with the Leadwerks engine?) <grin>
-portfolio-


Vista Ultimate SP1 64bit | Q6600 2.40 GHZ | 8GB RAM | Nvidia GTX 560ti

#14 Huidafa

Huidafa

    Newbie

  • New User
  • 3 posts
  • Gender:Male
  • Location:Las Vegas, Nevada
  • Interests:C4 Engine, casino gaming (slots, video poker, and table games), Collada, tools for world editing.

Posted 27 September 2008 - 06:34 PM

Good job, JamesH.

Are you using the Collada DOM APIs for your implementation?

#15 JamesH

JamesH

    Neophyte

  • Member
  • Pip
  • 25 posts

Posted 27 September 2008 - 07:05 PM

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.

#16 JamesH

JamesH

    Neophyte

  • Member
  • Pip
  • 25 posts

Posted 27 September 2008 - 07:06 PM

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.

#17 Huidafa

Huidafa

    Newbie

  • New User
  • 3 posts
  • Gender:Male
  • Location:Las Vegas, Nevada
  • Interests:C4 Engine, casino gaming (slots, video poker, and table games), Collada, tools for world editing.

Posted 27 September 2008 - 07:16 PM

...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.

#18 JamesH

JamesH

    Neophyte

  • Member
  • Pip
  • 25 posts

Posted 29 September 2008 - 06:26 PM

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

#19 wailingmonkey

wailingmonkey

    Apprentice

  • Member
  • PipPipPip
  • 701 posts

Posted 01 October 2008 - 06:06 AM

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 ...
-portfolio-


Vista Ultimate SP1 64bit | Q6600 2.40 GHZ | 8GB RAM | Nvidia GTX 560ti

#20 JamesH

JamesH

    Neophyte

  • Member
  • Pip
  • 25 posts

Posted 01 October 2008 - 06:35 AM

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 ?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users