Home Technical Talk

Max Creation Graph modifier - accessing graph values

tomsawyer
polycounter lvl 2
Offline / Send Message
tomsawyer polycounter lvl 2
Hi all,
Does anybody know how to access / expose MCG values? I need this for a modifier maxtool. Looking through output types I can see there is a "MAXscript function" - this probably allows you to output any value from within the graph.
But what I need is to access a value from a modifier MCG (output: modifier). I can access parameters (exposed in the UI). I am using a custom UI - very handy - I can define vars and functions nested in the custom UI.
But how do you get an UI defined function or an  external maxscipts to "see" a value from the graph itself, that only exists in the graph, not in the UI. All UI parameters I could find are "inputs" and the values flowing inside the graph have no identifiers, they only exists inside the graph.....

Being able to have one single output is kind of limiting (it probably makes MCG more robust / error-proof)

Anybody else stumbled upon this or knows how to do it?

TS
"It's not that you don't know that kills you... It's what you know for sure but ain't true" - Mark Twain

Replies

  • Swordslayer
    Options
    Offline / Send Message
    Swordslayer interpolator
    Unless you abuse the Evaluate MAXScript node and build a monster of a concatenation graph, no easy way.

    MAXScript function does only what it says on the tin, if you create a <MAXScript function> graph, it will output maxscript function based that accepts the same parameters as the parameter nodes you created. It's one-purpose and the argument types are limited. You cannot use it for anything else than a global MAXScript function not connected to anything.

    Rather than asking how to do this specific thing, tell me what is it that you want to achieve.
  • tomsawyer
    Options
    Offline / Send Message
    tomsawyer polycounter lvl 2
    Hi,
    Thank you for taking the time to reply.

    What I have: I'm using the AVoxelizer.maxtool from the Max Creation Graph (MCG) Sample Pack 1 (I have attached the mcg package). I've written a MAXscript that does all sorts of things with this: exporting obj and parsing different files - all through it's own UI.
    As I am processing the resulted voxelized mesh further down, I can break it into elements and count the elements (in fact, I am already counting the elements when I am outputing files from the MAXscript. But, as work with meshes for outputs, things get slow for high count of voxels.
    I am applying  AVoxelizer modifier to diferent objects, through the MAXscirpt, so I am driving everything from withing my script's UI without touching the modifier itself (I remove the modifier once my script exports needed files).

    What I want: It would be nice to have a "total count" feedback while tweak the initial setting of the voxelization, as this piece of information is already existent (but ...
     not accessible ) in the MCG: as an MCG array node holding all the 'voxels' I've applied a count node to this array but found no way to access this piece of info from outside.
    This Int32 value is the only thing I would need from the maxtool (appart from the modifier itself)

    If this is not easily doable, I am left with 2 options:

    1. clone the AVoxelizer into a MAXscript MCG that will return this value. I could then query the count value at certain times (when parameters change). But this is redundant, max will compute the same thing twice (once for the modifier, once for outputing the count)

    2. rewrite the AVoxelizer modifier in MAXscript. this appears to be a more robust approach to me as I will be adding functionality to this little script and I might wont to do other stuff with the voxels in the future.

    If I am missing anything, please open my eyes :)
    Thanks again, I would really need to solve this somehow.



    TS
    "It's not that you don't know that kills you... It's what you know for sure but ain't true" - Mark Twain
  • Swordslayer
    Options
    Offline / Send Message
    Swordslayer interpolator
    For quite a lot of stuff, option 2 would be the most flexible way. Note that MCG has a good raytracer (I've used it before from maxscript, much better than what you have maxscript side) so to reap full benefits, you'd expose that as a maxscript function and call that from the scripted simpleMeshMod.

    In a simple case like this where it's just one parameter, you can work around it in MCG itself with the Evaluate MAXScript node. It won't be pretty and foolproofing it is hard, and if you change something in the graph, it will break since the custom UI replacement will no longer work as expected. But for a one-off thing, it's bearable (also attached the mcg file):


  • tomsawyer
    Options
    Offline / Send Message
    tomsawyer polycounter lvl 2
    Brilliant !!!
    Thank you so much! - I owe you one.

    I've also peeked at your scripts page - amazing stuff there!

  • Swordslayer
    Options
    Offline / Send Message
    Swordslayer interpolator
    Glad that you like it - if you ever have a suggestions for a custom primitive or modifier, be sure to let me know.
  • cptSwing
    Options
    Offline / Send Message
    cptSwing polycounter lvl 11
    ^ Something akin to the Vol.Select modifier with a 'randomize' function (randomly pick X percentage of verts, edges, faces) I felt missing just a few days ago ;D

    (though it's on my list of projects I'd like to attempt in MCG)
  • Swordslayer
    Options
    Offline / Send Message
    Swordslayer interpolator
    cptSwing said:
    ^ Something akin to the Vol.Select modifier with a 'randomize' function (randomly pick X percentage of verts, edges, faces) I felt missing just a few days ago ;D

    (though it's on my list of projects I'd like to attempt in MCG)
    Verts and egdes are nice and easy in MCG (and scripted modifiers), faces - or rather polygons - not so much, as both MCG and scripted modifiers operate on triangle based trimesh and so this naive approach which works perfectly well for edges and verts:



    will result in this:



    So depending on whether or not you want to use current selection or create a new one, data channel modifier might be a better choice, since it uses PolyMesh instead of TriMesh:


  • cptSwing
    Options
    Offline / Send Message
    cptSwing polycounter lvl 11
    I'll play around with Datachannels, thank you for the tips!
Sign In or Register to comment.