Native point-level animation?

Native point-level animation?

Anonymous
Not applicable
966 Views
5 Replies
Message 1 of 6

Native point-level animation?

Anonymous
Not applicable

Hello,

I am trying to write an importer plugin for 3ds max. The objects I'd like to import can be point-level animated and I would like to compute some animation frames at import time and to bake them into the generated native 3ds object.

My goal is to write a pure importer plugin that can be switched off after importing the object. That's why embedding point-level animation into the native 3ds object is important to me. I saw the SDK allowed to override SimpleWSMObject::BuildMesh(TimeValue t) like in the dispmod.cpp example. But that's not what I am looking for since writing my plugin this way would require it to be loaded as long as the animation is played.

 

I suppose my problem is like what 3ds Max does when it loads an animated FBX file. My question is : can something similar be achieved through the SDK?

 

Thanks!

0 Likes
967 Views
5 Replies
Replies (5)
Message 2 of 6

kevinvandecar
Community Manager
Community Manager

By "point-level animation" do you mean animate a vertex within a mesh? This is possible in 3ds Max through several different ways.

 

First, using a specific modifier is the most efficient within 3ds Max because of the stack based system. This allows the configuration settings to be stored and there is less data on a per vertex basis depending on the behavior you want. For example, the point-cache and skin modifiers are both common ways to handle this in an efficient way. Using the modifiers, you could automate the setup I think. Depending on whether you want to do it via MAXscript or C++ it will be different. I do not quickly find any samples for this, but in the C++ SDK, the source code for both these modifiers is provided so you could see how they are structured. Both are providing published functions, so it can be driven by MAXScript or C++.

 

You can also directly animate the vertex within a mesh. This is done through the UI by using an editable mesh. You would select each vertex and provide specific animation characteristics for it. From the programming side, this is using a MasterPointControl, with contollers added for TRS animation applied to the selected vertex (or vertices). You can see this strcuyture uising the Track View curve editor. Examples of settingthis up are provided in the SDK samples .\maxsdk\samples\mesh\editablemesh and a few others.

 

I am not sure the technique you are refering to via FBX because it can support different ways. If above is unclear and not helpful, maybe you could provide a sample FBX file that shows the results in 3ds Max that you would like to achieve. I suspect it is using the editable mesh idea.

 

Hope it helps,

kevin

 


Kevin Vandecar
Developer Technical Services
Autodesk Developer Network



0 Likes
Message 3 of 6

Anonymous
Not applicable

Hi Kevin,

Thanks for your kind reply. As you suggested I attached a FBX example of what I would like to do. There are 10 animated frames. (it is a .rar file, I had to rename it in order to be authorized to attach it)

 

About the editable mesh idea : for meshes that typically have 1M polygons, I fear that creating 1 keypoint for every vertex and time sample would be much too costly. Maybe this approach is more suitable for bone animation.

 

About point-cache modifiers : I gave the SDK point-cache example a look. As I understand it, it just reads a cache point file everytime the time changes. This wouldn't be suitable for my plugin since having a time callback in the plugin obviously requires the plugin to stay on.

 

I don't precisely know how FBX import is done within 3ds, but I imagine a point-cache .mc file is read everytime time changes in order to regenerate geometry? So there should be some sort of native callback in 3ds that reads point-cache files everytime necessary. So my idea : if I generated a whole bunch of point-cache files upon object import, then maybe there would be a way to let 3ds know that these files are associated with my imported object, as if I had loaded an FBX object? I don't know if this kind of thing is possible in 3ds / its SDK.

 

Regards,

Yves-Olivier

 

 

0 Likes
Message 4 of 6

kevinvandecar
Community Manager
Community Manager

Hello Yves-Olivier,

 

Yes, I agree the vertex animation directly on editable mesh would be costly for large data sets.

 

The FBX file you gave (thanks for that) imports using the Point-Cache modifier tool, and if that style is acceptable, I would go ahead and pursue it. I think you are saying that you have a concern about using the modifier because it would have a dependency on the point-cache modifier plugin. However, I would not worry about it because it is a core plugin. If you notice in 3ds Max, most of the tools provided as plugins and are always present in a default installation. Point-cache is one that has been available for a long time, and as you can see with the sample FBX you provided, even we are using it.

 

And as you described in the last paragraph, that is exactly how the FBX import is handled, to use a point-cache modifier, and a cache file for each frame. The file set you provided shows this in the folder basic_fpc. The nice thing about the point-cache plugin is that we also provide the source code for it, so you can see how it works internally. You can also drive this plugin from your import routine without having any dependency on your importer plugin (or you could even use a utility-style plugin or even MAXScript).

 

Hope it helps,

Kevin


Kevin Vandecar
Developer Technical Services
Autodesk Developer Network



0 Likes
Message 5 of 6

Anonymous
Not applicable

Hi Kevin,

 

Using your point-cache core plugin to animate the mesh would be a perfectly acceptable solution.

However, I don't see how I could drive it from my import plugin... should I set some flags in the 3dsMax native object I create, to tell 3ds that this object is animated and requires calling the point-cache core plugin? Maybe there are some examples of that? Where should I write the cache files?

 

Thanks again for you help,

Y-O

0 Likes
Message 6 of 6

Anonymous
Not applicable

I really wonder how core plugins should be driven from outside.

 

In another part of my code I would like to create Normal Bump nodes inside a material graph. This node comes with the NormalRender.dlt core plugin whose source code has been made public in the SDK examples (samples/materials/NormalBump). However as I understand it, the aim of this piece of code is to add a new NormalBump node type to the dropdown menu under the Map category in the Material Editor. There doesn't seem to be a way to create programmatically such a node (that's what I would like to do). To my understanding the SDK only allows creation of particular node types (see last lines of stdmat.h : NewDefaultBitmapTex()... ) and doesn't allow to create any given node from its class ID (would be GNORMAL_CLASS_ID here)

 

How are we supposed to call other plugins like Normal Bump or Point Cache from a third-party plugin? is it even possible?

 

Best regards

Yves-Olivier

0 Likes