• Advertisement
Sign in to follow this  

Unity General questions about Collada

This topic is 3442 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Dear GDNet community Only recently have I started to get interested in Collada which is, if I understand correctly, a standardized, XML-based description format for assets such as models, textures, lights, and so on. I had started to write an exporter kind of in the same fashion, that is XML based files describing the exported asset, regardless of the authoring tool and the target platform. However (obviously) Collada stands a billion light year forward from my custom format, which is why I'm very tempted to switch to Collada instead of failing at reinventing it ;) however, I'm still a bit afraid by the number of features Collada supports (sometimes too much is not better than not enough...) For example, I saw that a Collada file describing a single model can take as much as 6 MB. What will it be then when I will export complete scenes or worlds? Too big files can be a pain to manipulate or to manage under version control. Does anyone here has some real world experience to share on that point? For example, I was wondering if popular collada exporters (3dmax, maya...) have some options allowing not to export useless stuff and reduce the file size. Most stuff I read about Collada presents the format as totally cool and flawless, so I'd be interesting in other people sharing their actual experience with it. Regards

Share this post


Link to post
Share on other sites
Advertisement
Collada is a vast format, it supports a lot of stuff like physics, inverse kinematics, breps, etc. Would you need a lot of this stuff?

It all depends on what you want to use it for. Is it going to be the file format that all your engine assets use? A format you use to export files from DCC tools like Max, Maya, etc and process into a format suitable for your game engine? Can you preprocess the file to strip out un-necessary information from the file (like physics information if you aren't going to use it for physics)?

The size of a Collada file varies depending on the model, there are some models for which the file size is actually smaller than a binary format like a .fbx and vice versa. I've seen a skinned animated model with 9000 triangles and a 3 second animation clip where the file size is about 1 MB less than the same model exported with the .fbx format from Max, probably because a value like 0.0 just takes 1 byte in Collada because it is output as "0" and the same 0.0 would take 4 bytes in a binary file.

Like any file format it possesses advantages and disadvantages. The advantages are that it is very flexible and can handle a lot of things, it is human readable while makes it easy to inspect, it is a fairly stable format, it is supported by all major DCC tools, etc. The disadvantages are that the file size can be larger than a custom binary format, it may be overkill for just getting a bit of mesh data into your home brew app, etc.

My advice would be for you to take a look at the Collada specification, try to understand how it works, decide if it is good for what you plan to do with it, then decide to use it or not based on your investigation.

Share this post


Link to post
Share on other sites
Quote:
Original post by hughel
Collada is a vast format, it supports a lot of stuff like physics, inverse kinematics, breps, etc. Would you need a lot of this stuff?

Eventually I will, though my focus is somewhere else presently (models geometry and skeleton)

Quote:
Original post by hughel
It all depends on what you want to use it for. Is it going to be the file format that all your engine assets use? A format you use to export files from DCC tools like Max, Maya, etc and process into a format suitable for your game engine? Can you preprocess the file to strip out un-necessary information from the file (like physics information if you aren't going to use it for physics)?

No of course I don't plan to use collada format for runtime assets, only as an intermediate format. I thought of the possibility of striping out the unused stuff but I'd like better not to add another layer in the export pipeline, if possible. I'd rather have this handled directly by the collada exporter.

Quote:
Original post by hughelit is supported by all major DCC tools

That is indeed the biggest advantage for me as I'm not too tempted to spend a ton of time writing exporters...

Quote:
Original post by hughel
My advice would be for you to take a look at the Collada specification, try to understand how it works, decide if it is good for what you plan to do with it, then decide to use it or not based on your investigation.

I'v started to do that already, the specs are about 600 pages worth of reading but only a small subset of it is relevant for me now (stuff about geometry, meshes and so on)

thanks for your reply.

Share this post


Link to post
Share on other sites
To handle it all in the export and not have to introduce an extra processing stage, you would need to modify the exporter code for a free exporter or write an exporter yourself. This isn't a trivial task as I'm sure you are aware (especially since the Collada specification is so vast) and you would end up having to modify existing exporters or write exporters for each DCC tool your plan to support which would negate the usefulness of having it supported by all the major DCC tools.

I've only used the bits of the Collada file format that deal with mesh/material/shader constants, skeletal animation and morph target animation. You can pick and choose what you use from a Collada file. The free 3DS Max exporter (source code is available) from Feeling Software lets you export pretty much everything I have dealt with but the export options aren't very detailed. I know they do a free Maya exporter as well, and the export options seem to be far more detailed. I think they have stopped supporting the free version of the exporter though.

Share this post


Link to post
Share on other sites
Quote:
Original post by janta
Most stuff I read about Collada presents the format as totally cool and flawless, so I'd be interesting in other people sharing their actual experience with it.

Regards

That's quite funny. Once you get into the details you will see that Collada is far from flawless.
The format is much more complicated than it needs to be, the documentation is lacking and the sample application source code (which serves as adhoc documentation) is simply atrocious.

Share this post


Link to post
Share on other sites
Well I doubt not there are flaws (otherwise I wouldn't have created this discussion) but what I really wonder is whether I'll do better with my own format (obviously I won't) Do you have any real world experience to share with me?
I guess I'll try it and see for myself anyway

Share this post


Link to post
Share on other sites
Quote:
Original post by janta
Well I doubt not there are flaws (otherwise I wouldn't have created this discussion) but what I really wonder is whether I'll do better with my own format (obviously I won't) Do you have any real world experience to share with me?
I guess I'll try it and see for myself anyway


My experience, is that using the standard format that comes with engine/toolkit/platform is better than using collada.
If that doesn't exist then collada is no worse than any other solution. But collada is only ment as an intermediate. You have to convert it into your own format before use.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
  • Advertisement
  • Popular Tags

  • Advertisement
  • Popular Now

  • Similar Content

    • By Manuel Berger
      Hello fellow devs!
      Once again I started working on an 2D adventure game and right now I'm doing the character-movement/animation. I'm not a big math guy and I was happy about my solution, but soon I realized that it's flawed.
      My player has 5 walking-animations, mirrored for the left side: up, upright, right, downright, down. With the atan2 function I get the angle between player and destination. To get an index from 0 to 4, I divide PI by 5 and see how many times it goes into the player-destination angle.

      In Pseudo-Code:
      angle = atan2(destination.x - player.x, destination.y - player.y) //swapped y and x to get mirrored angle around the y axis
      index = (int) (angle / (PI / 5));
      PlayAnimation(index); //0 = up, 1 = up_right, 2 = right, 3 = down_right, 4 = down

      Besides the fact that when angle is equal to PI it produces an index of 5, this works like a charm. Or at least I thought so at first. When I tested it, I realized that the up and down animation is playing more often than the others, which is pretty logical, since they have double the angle.

      What I'm trying to achieve is something like this, but with equal angles, so that up and down has the same range as all other directions.

      I can't get my head around it. Any suggestions? Is the whole approach doomed?

      Thank you in advance for any input!
       
    • By khawk
      Watch the latest from Unity.
       
    • By GytisDev
      Hello,
      without going into any details I am looking for any articles or blogs or advice about city building and RTS games in general. I tried to search for these on my own, but would like to see your input also. I want to make a very simple version of a game like Banished or Kingdoms and Castles,  where I would be able to place like two types of buildings, make farms and cut trees for resources while controlling a single worker. I have some problem understanding how these games works in the back-end: how various data can be stored about the map and objects, how grids works, implementing work system (like a little cube (human) walks to a tree and cuts it) and so on. I am also pretty confident in my programming capabilities for such a game. Sorry if I make any mistakes, English is not my native language.
      Thank you in advance.
    • By Ovicior
      Hey,
      So I'm currently working on a rogue-like top-down game that features melee combat. Getting basic weapon stats like power, weight, and range is not a problem. I am, however, having a problem with coming up with a flexible and dynamic system to allow me to quickly create unique effects for the weapons. I want to essentially create a sort of API that is called when appropriate and gives whatever information is necessary (For example, I could opt to use methods called OnPlayerHit() or IfPlayerBleeding() to implement behavior for each weapon). The issue is, I've never actually made a system as flexible as this.
      My current idea is to make a base abstract weapon class, and then have calls to all the methods when appropriate in there (OnPlayerHit() would be called whenever the player's health is subtracted from, for example). This would involve creating a sub-class for every weapon type and overriding each method to make sure the behavior works appropriately. This does not feel very efficient or clean at all. I was thinking of using interfaces to allow for the implementation of whatever "event" is needed (such as having an interface for OnPlayerAttack(), which would force the creation of a method that is called whenever the player attacks something).
       
      Here's a couple unique weapon ideas I have:
      Explosion sword: Create explosion in attack direction.
      Cold sword: Chance to freeze enemies when they are hit.
      Electric sword: On attack, electricity chains damage to nearby enemies.
       
      I'm basically trying to create a sort of API that'll allow me to easily inherit from a base weapon class and add additional behaviors somehow. One thing to know is that I'm on Unity, and swapping the weapon object's weapon component whenever the weapon changes is not at all a good idea. I need some way to contain all this varying data in one Unity component that can contain a Weapon field to hold all this data. Any ideas?
       
      I'm currently considering having a WeaponController class that can contain a Weapon class, which calls all the methods I use to create unique effects in the weapon (Such as OnPlayerAttack()) when appropriate.
  • Advertisement