Forcing updates in the modifier.

 
 
 
Posted by:hotknife
Data created:15 December 2013

Just started to play with Lab - and really enjoying it so far but this has frustrated me - and taken me a day of mucking around to figure out but here's the question.

How and when does the LabPolyModifier update and can it be forced to update, eg. whenever the base node is moved.

I have created a simplified flow/modifier to check what's happening. It converts a Poly's Vert pos' into world coord's and checks their distance from another object. If within range of that object it scales them.

The modifier works as expected until I move base object to a new world position - this does not update the LabMod' unless I put another modifier under the LabMod and turn it on and off.

Firstly is the attached Max file created correctly or am I missing something about updating the mesh.

While I'm here the video help files are great but a more standard Help file would be useful with some definitions/etc. For example I can't find anything on what the "LabPointDeformer" does and how it should be used ?

 


Attached Files:

>Test.max (282624 bytes),

A quick reply.

In general, an object modifier in Max is "not allowed" to use the world transformation of the object it is applied to, because it might be instanced, and there is more than one world transformation. So an object modifier is supposed to only modify the geometry in object space, i.e. without any relation with the world. The fact that Lab modifiers allow reading the world transform of the modifier object is a bit of a hack. One negative effect of the hack as you've found out is that Max doesn't send change notifications to the modifiers when the object is moved in the scene.

The proper solution should be a world-space modifier, but I have no time now to check your scene and get into details. It might not work either.

As for the LabPointDeformer - it's a "deforming modifier", i.e. similar to Bend, Taper, etc. It operates only on the points (vertices) of the incoming object, no matter its topology - it might be a mesh, a polyline or a particle system, as long as it implements the point enumeration interface of the Max SDK. That's why its input is a vector3, not a mesh or polyline.

 

Ivan Kolev (Software Developer, EPHERE Inc.)

E-mail: ivan.kolev at ephere dot com

Discord: ikolev

Your scene is using a saved template or script called hotknife.math.distance, we'll need that to open the scene.

 

Ivan Kolev (Software Developer, EPHERE Inc.)

E-mail: ivan.kolev at ephere dot com

Discord: ikolev

In general, an object modifier in Max is "not allowed" to use the world transformation of the object it is applied to, because it might be instanced

 

This makes perfect sense now it's pointed out - so if I want one object to affect another I need to test it by transforming it's position into the objects space - rather than testing the Verts in world space...The modifier I'm working towards as a learning project is something akin to a "Muscle system" where one Geometry exerts an influence over another, something that Max is lacking. I'll go through Ice Dent project that has been put up..

"hotknife.math.distance" - Doh - thought it might get included as it's a sub graph. It's just a distance between Vec3 test - it's on my home laptop so can't send at the moment.

Thanks for the reply - finding the Lab very addictive. 

 

 

Yes, to have another object affect the modified object, it has to be transformed to the local coordinates of the modified object. There's an example of that in the "Ray-casting and Mesh Project Modifier" tutorial video. The actual transformation is at 7:25.

However, this won't solve your requirement to have the modified object react when being moved around the scene. It will react only to moving the other object (the same happens with the objects from the tutorial video). In general, to have objects interact correctly in the scene, they should be all transformed into world coordinates, and a world-space modifier should be used. Then Max will send change notifications whenever either of the objects is moved, and the effect will be re-calculated. However, Lab doesn't have that kind of world-space modifier yet.

As for distance between two Vector3's - indeed, currently this has to be done with a Subtract node and then taking the Length (or LengthSquared) of the result, which is one extra node. This is a too basic function and we should add a static method Distance in Vector3 (similar to GetAngleBetweenVectors).

Ivan Kolev (Software Developer, EPHERE Inc.)

E-mail: ivan.kolev at ephere dot com

Discord: ikolev