Announcement

Collapse
No announcement yet.

Exporting grid velocity with maxscript/c++?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exporting grid velocity with maxscript/c++?

    Is there way to get the velocity at a specified grid index? I'm writing a script to export a velocity field to Unreal Engine 4.

    edit: Changed to c++. Maxscript is slow as hell on a decent grid size. Does PHD have an API?
    Last edited by duke2; 16-11-2017, 10:57 PM.

  • #2
    Got it. Sort of. A_getv always returns (0,0,0):

    MacroScript PhoenixFDToVectorField
    (
    on execute do
    (
    local phd = $
    if classof phd != FireSmokeSim then
    (
    print "Expected selection to be PhoenixFD Grid"
    )
    else
    (
    local cellSize = phd.cellsz
    local xCount = phd.xc
    local yCount = phd.yc
    local zCount = phd.zc

    local filePath = getSaveFileName caption:"Export Vector Field" types:"(VectorField(*.fga)|*.fga"

    if filePath != undefined then
    (
    -- Size
    local exportString = ((xCount as string) + "," + (yCount as string) + "," + (zCount as string) + "," )

    -- Bounds
    exportString += ((phd.min.x as string) + "," + (phd.min.y as string) + "," + (phd.min.z as string) + "," + (phd.max.x as string) + "," + (phd.max.y as string) + "," + (phd.max.z as string) + "," )

    -- Velocity
    for x = 1 to xCount do
    (
    for y = 1 to yCount do
    (
    for z = 1 to zCount do
    (
    local cellVelocity = A_getV phd (point3 x y z)
    exportString += ( (cellVelocity.x as string) + "," + (cellVelocity.y as string) + "," + (cellVelocity.z as string) + "," )
    )
    )
    )

    (dotnetclass "System.IO.File").WriteAllText filePath exportString
    )
    )
    )
    )

    Comment


    • #3
      Hey, sure - there is the aurloader which provides access to aur, f3d and vdb caches, and also there is an API for accessing the Max or Maya Phoenix nodes at runtime.

      Here are the docs on the loader: https://docs.chaosgroup.com/display/PHX3MAX/Phoenix+SDK

      And you can find the SDK here: C:\Program Files\Chaos Group\Phoenix FD\3ds Max XXXX for x64\SDK

      When using this MaxScript, do you have the velocity channel exported from the Output rollout to the cache? Also, make sure to upgrade to Phoenix 3.05

      Hope this helps!
      Svetlin Nikolov, Ex Phoenix team lead

      Comment


      • #4
        Absolutely fantastic, you've thought of everything!

        Comment

        Working...
        X