PDA

View Full Version : recompute on topology change


MatthiasBuehlmann
07-13-2008, 03:30 PM
hey there!

I'm writing a node that takes a shape as input attribute.
Now i want this node to re-compute in case the topology of that shape changes - however, it shall not recompute if the shape only changes it's appearance (because of vertextweaking or deformation or whatever) but the topology stays the same.

i.e. the dirty-bit shall be set for my node if the topology changes, but not if the shape is just deformed.

How can I do that?

thanks!

MatthiasBuehlmann
07-14-2008, 03:23 PM
no idea? anybody?

my current idea is to create an additional node that does check for topology change as soon as the dirty bit of the surface is set, and in case of topology change propagates that bit to my other node.

but how can i check for topology change efficiently?

thx!

Keilun
07-14-2008, 05:03 PM
Hm. I would have thought that tweaks (pnts attribute) would affect the outMesh on a shape. That's odd. The dataflow through a poly mesh with history is:

inMesh --> pnts --> outMesh

or if no history but has tweaks on the mesh:

cachedInMesh --> pnts --> outMesh

What do you have connected into your node?

A hack you could do is implement a callback for MNodeMessage::addNodeDirtyCallback. Have the callback just toggle an attribute that affects your output such that it will recompute. It's not the nicest solution, but it should work.

GennadiyKorol
07-14-2008, 08:44 PM
You could also store the current number of vertices, edges and polygons of the mesh in your node for the input shape. As soon as the shape becomes dirty and your compute method is called, you can quickly throw MFnMesh on your shape, and check whether number of vertices/edges/polygons has changed.

If not, you can assume the topology has not changed (in most cases, except some really pathological cases).


I am not sure that connecting pnts attribute is the best idea since the mesh could be made dirty as a result of being deformed. Pnts attribute would not be changed and you would wrongly assume that the topology was modified.

Buexe
07-14-2008, 08:47 PM
what GennadiyKorol (http://forums.cgsociety.org/member.php?u=48274) says sounds reasonable, if I may add: do the test if it has changed if not just copy it to the outMesh, since some other node behind it in the history might still need the new version of the mesh

Keilun
07-15-2008, 07:15 PM
You could also store the current number of vertices, edges and polygons of the mesh in your node for the input shape. As soon as the shape becomes dirty and your compute method is called, you can quickly throw MFnMesh on your shape, and check whether number of vertices/edges/polygons has changed.

If not, you can assume the topology has not changed (in most cases, except some really pathological cases).


I am not sure that connecting pnts attribute is the best idea since the mesh could be made dirty as a result of being deformed. Pnts attribute would not be changed and you would wrongly assume that the topology was modified.


Just to clarify here, I'm not suggesting connecting the pnts attribute. I'm illustrating the data flow and questioning why it's not causing the outMesh to update as tweaks are applied. Typically it would. Perhaps in the case of no history it's not causing it to dirty properly. With history, a tweak node would be present in which case there is a clear data path between the nodes. Data dependencies within a node such as the meshShape node is something whose DG dependability I'd question.

Buexe
07-15-2008, 09:22 PM
what GennadiyKorol (http://forums.cgsociety.org/member.php?u=48274) says sounds reasonable, if I may add: do the test if it has changed if not just copy it to the outMesh, since some other node behind it in the history might still need the new version of the mesh

On a second thought this suggestion might be BS since you would need to "add" whatever your node does to the mesh, only in not-recomputed form, to save computation time. While this is technically possible, in my experience this type of stuff may lead to unexpected for the user confusing behaviour.

stao
07-16-2008, 03:56 AM
HI,

In my understanding, topology refers to the connections among all components of entities as well as the properties of entities, such as curve degrees. Do we have operations in Maya that could decimate points/edges/faces in one place and recreate them at another place at the same time? If such operation does exist, then simple check of points/edges/faces numbers will still satisfy the requirement?

Also, what if we change the degrees of curve, say from degree 3 to 2? The number of points in Maya will be same ?






You could also store the current number of vertices, edges and polygons of the mesh in your node for the input shape. As soon as the shape becomes dirty and your compute method is called, you can quickly throw MFnMesh on your shape, and check whether number of vertices/edges/polygons has changed.

If not, you can assume the topology has not changed (in most cases, except some really pathological cases).


I am not sure that connecting pnts attribute is the best idea since the mesh could be made dirty as a result of being deformed. Pnts attribute would not be changed and you would wrongly assume that the topology was modified.

CGTalk Moderation
07-16-2008, 03:56 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.