Notifications
Clear all

[Closed] Custom exporter for morphing information

Hi,

I have created my own exporter in maxscript. It exports geometry, camera and key based controllers for animations. I export transformation for each object in parent coordinates and I export the actual geometry data in local coordinates. In total I can reproduce the scene and animate it in a my custom 3d viewer.

I want to add morphing to my viewer. My first thought… that must be easy, find all times where morph key exist, export a snapshot for each of these times and ready… Hmm, not that simple:

  1. Most modifiers use a special morphing algorithm (e.g. bend), not just a linear transformation. I guess those cannot be exported as a linear transformation, I must know the morphing algorithm, correct?
  2. How can I tell if a key represents a morphing (bend, melt, morpher etc etc etc) in a generic way?
  3. During export i transform geometry using convertToMesh so it becomes an editable_mesh. That assures that I can access mesh functions for extracting vertices, faces etc. However this transformation flattenes the modifier stack, and keys places on the modifiers are lost, thus I loose my morphing keys. I see it as a chicken and the egg problem. I cannot extract vertices etc if not an editable mesh, and at the same time I cannot convert to editable_mesh since I will loose modifier keys. Is there any other way to extract this?

Thanks in advance,

7 Replies

first of all you don’t need to collapse the stack. you can get all mesh data using node’s mesh property which is a current state of mesh.

second is about deformations… because you don’t know or can’t reproduce most of deform algorithms you have to save deformation as mesh targets using some time sampling. yes. it will generate tons of mesh data but unfortunately there is no another way. that’s how most of game exporters handle this thing. that’s why most of new game engines prefer skin and bones.

Thanks for the fast reply, it works wonderfully with the mesh property…

Regarding deformation, I guess I have to output in-between keys…

Seems you are quite a shark on the topic, would you know if it is possible to attach userdata to a key. I want to put some user data on a key and mark it as “Key Type X”. Even if the key is moved etc, i want to be able to retrieve this data later on.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

what key are you talking about? any maxkey?

I would like to put custom data on the keys found under a property controller, e.g.:

object.position.controller.keys[1].customData = “QWERTY”

My idea was to have an array on the side, like:

positionKeys[object][time] = “QWERTY”;

However, when key is moved or when file is reloaded, I loose track

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

well… you are talking about MaxKeys. MaxKey is not a MaxObject. It’s a Value. You can’t add any extra data (appdata, ca, et.) to the Value.

>>first of all you don’t need to collapse the stack. you can get all mesh data using node’s mesh property which is a current state of mesh.

Should I take special care when using UVW modifiers? I have a square named ‘s’ in my scene, it has 12 texture vertices which is proven by calling:

$s.mesh.numtverts // returns 12

After applying unwrap UVW modifier + loading uv coordinates (24 in total), i still get 12 in previous call. Am I missing something here?