Sign in to follow this  
Guest Vorlin

Direct X and makeMDL expertise?

Recommended Posts

Hey all,I'm into an area that's Black Box / Black Arts... specifically X file exporting from a program other than Gmax / 3ds.In a nutshell, makeMDL handles the exported file ok except when it comes to anims. This is extremely frustrating because careful examination of the animation keys reveals that Gmax's exporter is exporting a non-compliant syntax while my other program is exporting a compliant one.Yet makeMDL works with the non-standard syntax out of Gmax while failing to work with the compliant one.I have June's DX SDK and the Direct Viewer utility can show animations from both X files just fine. It's only that makeMDL can't seem to work with the anim keys that are in proper syntax.Examples of the keys exported and more on this can be found in my blog at http://vorlinized.blogspot.comI am hoping for a little guidance from anyone who is familiar with X file templates, particularly animation sets and animation keys, and their syntax. I need to understand exactly why makeMDL can't use a standard syntax and what it will work with before I can undertake modifications to the export scripts.I have also contacted the author of the DX export scripts and Sebby on this... sooner or later I will get it straightened out but any and all help is greatly appreciated.Thanks,Scott / Vorlin (HC070NC_Vorlin on HoverControl)http://vorlinized.blogspot.com

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Scott, are you certain that Blender (I assume that's what you are using) is creating linear or TCB animation tracks? Since you are focusing on aircraft, you may have missed this from the Scenery Animation SDK:-----------------------Animate your model just like you would animate anything else in 3ds max or gmax. You can use translation and rotation animations. Make sure that the controllers on your animated models are as follows:Position: Bezier PositionRotation: TCB Rotation or Linear RotationScale: Bezier Scale-----------------------Also, I'm not nearly as certain of the demise of GMax as you seem to be. First, the FSX SDK will include exporter module and x2mdl.exe to support both Max and GMax. Also, there apparently are plans to either update GMax or create a new replacement for it in the future.OTOH, it's a good thing to be looking at viable alternatives! If nothing else, you'll gain a better understanding of the entire modeling process... ;)Keep in mind that FSX will be introducing several new Material properties, including bump mapping, fresnel ramp, etc., in addition to full I-K (Inverse Kinematics) and vertex animation. ;)More stuff to learn!

Share this post


Link to post
Share on other sites

"... creating linear or TCB animation tracks?"Not sure, never checked. Blender is capable of so many differnt things that one can get lost in all the options. Need to investigate that here shortly..."...demise of GMax..."I can see how you may have misunderstood me, I wasn't too clear. I don't see anything negative happening with Gmax, the problem is that I saw nothing positive either and FSX is passing beyond the limited capabilities of this particular tool. Gmax is intended to be a basic tool, a teaser, that will encourage people to buy 3ds Max after they get good at making models and need more capabilities. Discreet's been clear in the past that they're phasing support out becuase it no longer resembles the current version of 3ds Max and they can't financially justify a major revamp to bring it up to speed.Gmax is great for it's intended purpose... the problem isn't Gmax, it's that our needs are evolving beyond it."First, the FSX SDK will include exporter module and x2mdl.exe to support both Max and GMax."I knew about the exporter and there's even going to be a bump map plugin... these may work for now but patching together piecemeal fixes is like keeping someone alive via machines. It will work for a time, maybe even through all of FSX's lifecycle... but eventually you can only keep plugging holes in the boat for so long. I hadn't heard about 3ds Max's support, but it wouldn't surprise me at all."Also, there apparently are plans to either update GMax or create a new replacement for it in the future."I'm going by the letter that was released from Discreet a few months back, which contradicts the above. However, that letter may be old news and there may be something new that I haven't heard about. It would suprise me though because it's an expensive proposition and, without outside sponsoring, I don't see how it could be financially viable. Then again, MS could easily afford to subsidise the effort and their investment in the project, which is nearly a cornerstone of FS, could easily be justified."bump mapping, fresnel ramp, etc., in addition to full I-K (Inverse Kinematics) and vertex animation."Bump mapping, IK and vertex anims have been in Blender for years... fresnel ramps have been in at least the last two releases. It will also create a normal map (bump map) from your mesh without a plugin.Toss in goodies like soft body animation and built in rendering, with or without Yfray, and it's a candystore for model makers.Additionally, blender has just passed 3 million users and development is at a record, and mind-boggling pace. There are so many tutes, even hours and hours of video tutes, that it's made the learning curve a lot easier to deal with.Check out the blender site (www.blender3d.org) and, on the right, click on project orange. It's an open source movie project, sort of a mini-Final Fantasy type movie that was done by volunteer the world over. The movie is called "Elephant's Dream" and it's a bit on the morbid side... sort of like something Poe would have written.So when are you going to come on over and say hi on TS??? hehehScott / Vorlin

Share this post


Link to post
Share on other sites

Hello Vorlin,I've looked at your examples in your blog.It looks like blender is exporting rotation matrices (hence 16 values) while gmax is exporting something like an axis (3 element vector) and an angle in radians.The first seems to be the identity matrix and also you don't rotate around the x axis in th gmax code.The second and third appear to have the form( cos x -sin x 0 0 )( sin x cos x 0 0 )( 0 0 1 0 )( 0 0 0 1 )which describes a rotation around the z axis with angle x. I don't know why they should both rotate around the z axis.However this is all assumptions. I cannot confirm all this because I don't have gmax or Blender installed just now. But it might be an indication that Bill is on the right track. Or you have to change the way in which blender exports rotational animations.Hope it helps,

Share this post


Link to post
Share on other sites

Michael,Thank you *very much*!!!! Any insight at all is good at this point. I understand that they keys are in that format:1;4; 000,000,000,000;, (syntax may be wrong but you get the idea)The problem is that this is all I understand about reading a key:Frame or time index# ; numInThisArray ; entry1, entry2, etc. etc.I have no idea what each entry number represents or how they're organized when there are 4 or 16....Normally, an anim type is declared as 0,1,2 or 3. This one keeps saying 4. At first, I thought it was an error in the exporter but I'm beginning to think that it may be correct... but that 4 represents a different kind of rotation animation than 0 does.I have the DX SDK but it hasn't yet shown me anything that gives insight on this detailed level. If there is anywhere else I can look to learn, like an import or export class in C++ or C#, that may be helpful.Thanks,Scott / Vorlin

Share this post


Link to post
Share on other sites

Progress...Thanks to Michael's observation, I went hunting for information on rotation matricies. He may not have hit the nail on the head but he hit close enough that I was able to find the issue from there.1) Gmax is exporting Quaternation Rotation information to define a rotation.2) The gentleman who wrote blender's exporter didn't allow for that, nor for scaling or translation vecors either. He hard coded the exporter to export only type 4 which, despite what the new DX SDK says, is actually a valid type definition for a transformation matrix. (EDIT: Which, I now realize, is probably what Michael was referring to when he wrote rotation matrix above.)Check out the raw Python code for the anim export function here: #*********************************************** #WRITE ANIMATION KEYS #*********************************************** def writeAnimationObj(self, obj): point_list = [] ip = obj.getIpo() poi = ip.getCurves() for po in poi[0].getPoints(): a = po.getPoints() point_list.append(int(a[0])) name = obj.name name_f = name.replace(".", "") self.file.write(" Animation {n") self.file.write(" { ") self.file.write("%s }n" % (name_f)) self.file.write(" AnimationKey { n")#********# Notice the number 4 in the line below, # which hard codes a transformation matrix type.#******** self.file.write(" 4;n") self.file.write(" %d; n" % (len(point_list))) for fr in point_list: self.file.write(" %d;" % (fr))#********# Notice the number 16 in the line below, # which hard codes 16 keys per line.#******** self.file.write("16;") Blender.Set('curframe',fr) #mat_new = self.getLocMat(obj) mat_new = obj.matrixLocal self.writeFrames(mat_new) if fr == point_list[len(point_list)-1]: self.file.write(";n") else: self.file.write(",n") self.file.write(" }n") self.file.write(" }n")**************************************************Is it any wonder that I couldn't get animations to work?????Now I need to dig into Blender's SDK, find the functions to export data for Quaternation Rotations rather than transformation matricies and then alter the exporter to be able to handle them.I can see where I'll be re-writing a lot of other parts of the exporter as well... maybe it's time for me to learn a little about the Python scripting language while I'm at it.Ya think? LOLScott / Vorlin

Share this post


Link to post
Share on other sites

Last added note for now... I found this regarding the subject while researching:"Note: We never interpolate matrices because matrix rotations do not interpolate correctly

Share this post


Link to post
Share on other sites

>"...demise of GMax...">>I can see how you may have misunderstood me, I wasn't too>clear. I don't see anything negative happening with Gmax, the>problem is that I saw nothing positive either and FSX is>passing beyond the limited capabilities of this particular>tool. Gmax is intended to be a basic tool, a teaser, that will>encourage people to buy 3ds Max after they get good at making>models and need more capabilities. Discreet's been clear in>the past that they're phasing support out becuase it no longer>resembles the current version of 3ds Max and they can't>financially justify a major revamp to bring it up to speed.Well, let's get caught up on the news then, shall we? ;)Posted 27-Oct-2005 2:27 PM --------------------------------------------------------------------------------Recently we communicated a plan to cease new development on Gmax and ramp down support on the current offering; this decision was based on multiple factors and data points, including diminished interest from games publishers. Since the announcement, more partners provided feedback that we are investigating

Share this post


Link to post
Share on other sites

Hi Vorlin,good find on the quaternions for AnimationKey type 0.Transforming a transformation matrix into a quaternion is somewhat involved. I could scan the pages from my math book and send you per mail if you are interested.But browsing in the Blender Python API I found, that a Python Matrix object has indeed a method toQuat(), which returns a Quaternion for the rotation matrix. Also you can extract the scale part of a matrix (as a vector) with scalePart() and the translate part with the method translationPart().Maybe you can upgrade the blender DirectX exporter script using these methods.Good luck

Share this post


Link to post
Share on other sites

Bill and Michael,Bill, good deal on Gmax. It sounds as if the partners may be willing to open the checkbooks, which is what's really needed. If that happens, and it now looks as if it may, then I'm sure there will be a 1.3 or 2.0 in the future.I understand that Gmax has a lot of capabilities that FS doesn't utilize, my problem is that it:A) Doesn't have a few key (for me) capabilites that FSX will use and it will need patching up to get it there and..:( More importantly, doesn't handle nurbs surfaces and a few other things that really speed the process of modeling. I can't see that it ever will either because to do so would defeat the real purpose of Gmax which is to get people to buy 3ds Max, which does have all that and more. Let's face it, there is a dual purpose behind Gmax and I think it's a great arrangement. They give away the basic tools for free so anyone can model but they are also trying to hook your interest enough to fork over big money and move on up to their main product. It's a great idea and I hope it's working for them.But just as you have years invested in mastering Gmax, I have 6 years in Blender. I don't want to see Gmax go away, I want a choice.Michael,I tried to get the API download yesterday and it kept 404'ing on me. I've opened an open source project with the intent of creating an entire suite of tools, with exporter, for FS9 and FSX at:https://projects.blender.org/projects/fs-blend-devpak/I'd love to have you on board, and even your cantankerous backside Bill! Scott / Vorlin

Share this post


Link to post
Share on other sites

>A) Doesn't have a few key (for me) capabilites that FSX will>use and it will need patching up to get it there and.....such as? >:( More importantly, doesn't handle nurbs surfaces and a few>other things that really speed the process of modeling.FS doesn't handle NURBS either, so you'll be reduced to collapsing to E-Mesh or E-Poly in the end anyway.>But just as you have years invested in mastering Gmax, I have>6 years in Blender. I don't want to see Gmax go away, I want a>choice.Actually, those years with GMax have carried over quite nicely to using Max8 now, but I still have the same problem magnified many times over now... there's even more of Max8 that's useless for FS modeling... ;)>I'd love to have you on board, and even your cantankerous>backside Bill! Please, I'm curmudgeonly, not cantankerous! :)Completely OT, but these two words from this year's National Spelling Bee are begging to be used... ;)I find much of the "discussion" in the various FSX forums full of psittacisms and quite recrementitious.

Share this post


Link to post
Share on other sites

Patches will be needed, starting with bump mapping...You misunderstand about nurbs surfaces and such. I don't know about Max, but in Blender you can use Nurbs, MetaBalls and a few other things to get your shape right, then convert to a mesh with a keystroke. This allows you to have the benefits of modeling quickly with these tools and then, when you have your shape just right, locking it in by converting to a mesh.Finally, if I could pronounce curmudgeonly, which looks a lot like crumudgeon, then maybe I'd be able to say something other than cantankerous! ;c)Insert TS nagging banter here...Scott / Vorlin

Share this post


Link to post
Share on other sites

Scott, your the man!I don't like, and never liked, GMAX either mainly because whatever you do with it, you can't reuse with another modeler (proprietary GMAX file format). This severely impairs reusable value of a 3D modeling work, especially once (if) GMAX stops beeing supported either by the vendor, or Microsoft.I'm not sure I could be of any help for now in your Open Source project, but I definitely like it!

Share this post


Link to post
Share on other sites

Nor do I share in such skepticism. If it came to it, MS would just buy and absorb Autodesk, haha.As I told you on TS, the .x format that MS uses also contains many other extensions that you would have to figure out to get lighting to work properly.Trust me, I spent time trying to do this, and even hand coding the .x file to customize animations.

Share this post


Link to post
Share on other sites

>Patches will be needed, starting with bump mapping...Already being done, as same is needed for both Max and GMax in the form of a plugin... ;)>This allows you to have the benefits of>modeling quickly with these tools and then, when you have your>shape just right, locking it in by converting to a mesh.Which is why I said you'll wind up converting to E-Mesh or E-Poly at the end anyway. I use Patch modeling quite a bit even in GMax... While having NURBS functionality would be a plus, I don't see it as a crippling loss either.>Finally, if I could pronounce curmudgeonly, which looks a lot>like crumudgeon, then maybe I'd be able to say something other>than cantankerous! ;c)CUR - MUDGE - UN - LEE *:-* >Insert TS nagging banter here...Time is the critical factor here. One of these days I'll make some time to register/login/setup at HC so we can yak...Please do not gain the impression that I'm pooping on your efforts! To the contrary, I only wish I had the skill (and time) to help you... ;)I think the idea of creating/maintaining an alternative to Max/GMax is wonderful!!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this