X file and a tricky situation

Started by
5 comments, last by Specchum 19 years, 3 months ago
Ok, I hope I can explain this well: I'm trying to export an entire scene from Maya and import it into my engine, complete with cameras, lights, animations and skinned meshes. I'd like to then use my engine to play back the scene exactly as done in Maya. In other words, my engine is trying to create a cinematic using the data exported from Maya, but with some added effects to the scene. Since I already know how to load in effects, objects and skinned meshes from X files, I was planning to stick with it. However, the problem is that the .X file format doesn't support cameras and lights, so that info isn't exported. My question is, how can I get around this problem short of changing the file format (I'll have to re-write my engine X file import routines - yikes!)? I was thinking of creating dummy objects for the cameras(with animation if required). Then after importing them in my engine, I don't render them but playback their animation anyway so that the object transformations do take place anyway. I then use the transformations for the dummies and apply them to my camera so that the camera is transformed to the dummies position in every frame. So, if I create a dummy object and move it from point A to point B, in my engine I will use the dummy transformation and move my camera from point A to point B. At least, that's the theory. So, is this plausible or just plain rubbish? Is there a better way of going about this? Any help would be much appreciated!
"There is no dark side of the moon." - Pink Floyd
Advertisement
The .X file format was designed to be updated when required.
You just need to place a new template.
Also, i don't know if anybody knows, it supports instancing!

I can take one Cylinder for example *CYLINDER01 and place it 4 times in space.
Just use {CLINDER01} instead of MESH and it will get instanced instead of being 4 times written to file.

Check on some .X file ENUMERATIONS. But anyway, this still does not solve how your exporter will export cameras and lights, maybe you will have to update the exporter if you have the source and knowledge.
Thanks for the info Samurai. I didn't know about instancing in X files. So that's something I'll have to look up. :)

I'm not really upto writing an exporter. I've enough trouble writing a game engine, if you see wot I mean. ;)
"There is no dark side of the moon." - Pink Floyd
You could create a camera path (curve) in Maya and when your parser hits the curve in the file have your engine create a camera track. When your engine loads that scene to run, it detects if there is a camera track and just places the engine camera on the track instead of implicitly using a "Maya camera".

Do .X files support curves? If so...problem solved. I know this is possible in some form or fashion. Doom3 uses Maya binaries for its cinematics.
daktaris, indeed that is one of the possibilty I considered initially, but the curve will give only positions but not orientations is it not? So if the camera is moving as well as rotating, I won't get the info about the rotation from the curve, right?
"There is no dark side of the moon." - Pink Floyd
Quote:Original post by Specchum
daktaris, indeed that is one of the possibilty I considered initially, but the curve will give only positions but not orientations is it not? So if the camera is moving as well as rotating, I won't get the info about the rotation from the curve, right?


That is true. You may have better luck loading in .mb files instead of .X files. You would have to write your own parser but at least you know you can get access to anything Maya does internally.

If you are set on using .X files, I would create a NULL (dummy) object that you always know is going to represent your camera. Parent the actual camera to that object on Maya. Then when you use the technique I described above you can get your rotations from the NULL (since it's an object an will be stored on the .X file). Kind of hacky but it should work. Good luck.

Daktaris, thanks. I checked with someone who is familiar with Maya here and he too believes the Dummy way you suggested is workable. I'll try that out then. Cheers!
"There is no dark side of the moon." - Pink Floyd

This topic is closed to new replies.

Advertisement