General

Callback Functions

Core and simulation result access functions

Global Variables

Parameters Access

General

During the simulation process the user is allowed to access directly the simulator's content using some functions exported by the plugin. These functions can't be called at any point, they will work properly only when the simulator is in the appropriate internal state. The moments of time when the content can be manipulated properly are signaled by calling several callback functions, and the user is allowed to access the simulator's content only inside them. Every single Phoenix object has it's own script code that is kept in the scene file. When the simulation starts the script is compiled and its callback function overrides the callback functions of any previous simulation. During the simulation the user is allowed to change the script, by executing the "Evaluate all" command form the File menu of the script editor. If a shared script for all simulator instances is desired, the user has to delete the individual scripts for each simulator and to deliver the callback functions as an ordinary MAXScript file.

Callback functions

Function Description
OnSimulationBegin Called after all the initialization of the simulator is done and before first execution.
OnSimulationStep Called before each simulation step, after the interaction with the scene.
OnSimulationEnd Called after the end of the simulation just before to destroy the simulation core.
OnNewFrame Called after each frame export

 

Simulation core and result access functions

Each of the simulation channels(temperature, velocity,smoke etc.) exists in two instances - in the simulation core and in the simulation result. The functions in this section can access both the simulation core and result. If the first argument passed to the function specifies a Phoenix node then the function accesses the simulation result. If there is no explicit Phoenix node specified the function accesses the simulation core. In this case the target node is delivered internally. All the functions are exported as global functions beginning with "A_".

 

It should be noted that the simulation core exists only during the simulation and can be accessed only in the Callback functions.

 

NOTE: The prefix "A_" is skipped in the following table for a better readability.

 

Functions Description

SetSystem

Parameters:

[system:<integer>]

Available options are:

0 - Object space

1 - World space

2 - Grid space

Return value:

none

Specifies which coordinate system to be used...

Inject

Parameters:

[where:<point3>]

[amount:<float>]

Default parameters:

[temperature:<float>]

[smoke:<float>]

[velocity:<point3>]

[UVW:<point3>]

Return value :

none

 

 

 

Injects fluid in given point. Using this function the user can create its own procedural sources. The result of the function CAN NOT be achieved by calling one or more A_SetX functions, because they do not affect the quantity of the fluid, but only the parameters carried by the fluid. The injection of fluid in some point causes changes in the content only of the nearest 8 cells, but produces an outgoing flow in the entire grid. Nevertheless the function is not slower than the ordinary A_SetX function, because the outgoing flow appears later, when the simulation is executed. If A_GetV function is executed immediately after A_Inject in some near point, the velocity will be not changed.

SetV

Parameters:

[x:<integer>]

[y:<integer>]

[z:<integer>]

[velocity:<point3>]

Return value :

none

Sets the velocity of a cell

SetUVW

Parameters:

[x:<integer>]

[y:<integer>]

[z:<integer>]

[UVW:<point3>]

Return value :

none

Sets the UVW of a cell

SetT

Parameters:

[x:<integer>]

[y:<integer>]

[z:<integer>]

[temperature:<float>]

Return value :

none

Sets the Temperature of a cell

SetSm

Parameters:

[x:<integer>]

[y:<integer>]

[z:<integer>]

[smoke:<float>]

Return value :

none

Sets the Smoke of a cell

SetFl

Parameters:

[x:<integer>]

[y:<integer>]

[z:<integer>]

[fuel:<float>]

Return value :

none

Sets the Fuel of a cell

GetFl

Parameters

[where:<Point3>]

Return Value:

<float>

Gets the Fuel in a given point

GetV

Parameters

[where:<Point3>]

Return Value:

<point3>

Gets the Velocity in a given point

GetUVW

Parameters

[where:<Point3>]

Return Value:

<point3>

Gets the UVW in a given point

GetT

Parameters

[where:<Point3>]

Return Value:

<float>

Gets the Temperature in a given point

GetSm

Parameters

[where:<Point3>]

Return Value:

<float>

Gets the Smoke value

StartSim

Parameters

[node:<Simulator>]

Starts the simulation

StopSim

Parameters

[node:<Simulator>]

Stops the simulation

 

Global Variables

The following global variables are initialized before entry in the callback functions:

 

Variable Description
this:<simulator> Points to the simulator that calls the callback function
t:<float> The simulator's internal time
dt:<float> The simulator's internal step

 

Parameters Access

Simulator Parameters

 

adaptive
adv_step

advtype

al_placing

attr_fl
attr_sm
attr_t
attr_uvw
attr_v

attract_fl
attract_sm
attract_t
attract_uvw
attract_v
backup

burning
cellsz
cooling
cutinside
darg
dcolorx_s
dcolorx_t
dcolorx_v
dcolory_s
dcolory_t
dcolory_v
difmul
displ0
displ1
displ2

displ2d
displacement

displmul

drying
dtxt
earg
ecolorx_s
ecolorx_t
ecolorx_v
ecolory_s
ecolory_t
ecolory_v
epower_s
epower_t
epower_v
etxt

exclhidden
ext_wind

fl_energy
fl_ignition

fl_map
fl_propg

flatliquids

fmm

frmblend

fuel_bcy
geommode

gmul
grav

grid_treshold

gridcells
heathaze
hhfactor
ielist
iemode

ignore_play_speed

init_fl
init_sm
init_t
init_uvw
init_v
inplength
inpoffset
jitter

keep_fl
keep_sm
keep_t
keep_uvw
keep_v
keep_vxyz
lightcache
lights
lightsmult

liquid

lqad

lqsteps

lqsurft

lqvisc

maxthreads

mod_d

mod_e

mod_t

mtrefl

nbigrid

no_alpha_e
noscatter
play_speed
playat

pmbounces
pressdec

prv_and

prv_asrgb

prv_avonly

prv_fuel

prv_fuel_color

prv_fuel_threshold

prv_gpu_color

prv_plank_t

prv_reduct
prv_smoke
prv_smoke_color
prv_smoke_treshold

prv_smoke_treshold2
prv_t_treshold

prv_t_treshold2
prv_temperature
prv_uvw
prv_uvw_color
prv_uvw_treshold

prv_uvw_treshold2
prv_v_color
prv_v_treshold

prv_v_treshold2
prv_velocity

rand

rndfrq
reflprec

refltype
rendinput
rendsolid
rendstep
sampler
sarg
script
selfshadow
show_only_sel
simoutput
simple_color
skiptransp
sm_map

smoke_bcy
smoketransp
softb
solidbelow
spflimit0
spflimit1
startframe
stex
stopframe
stoptransp
storage_quality
surflevel
surflevel_m
surflevel_s
surflevel_t
surflevel_v
t_map

t2f
targ
timescale
transp_s
transp_t
transp_v
transpmode
ttxt

uniform_mass
use_script

uset2f
uvw_map
v_map
vorticity

wetting

x_bound

xc

y_bound
yc

z_bound
zc

 

 

Source Parameters

 

discharge
dmap

flmap

fuel
iconsize

ifnotsolid
pick_ph

poly_id

smap
smoke
sources
temperature
timebase
tmap
usedmap

usefl

useflmap

usesm
usesmap

uset
usetmap

useuvw

useuvwmap

uvw
uvwmap

 

Phoenix Texture

 

channel
node
skip_fine_displ
tiling

 

Phoenix Force

 

influence
node
rotate
single_frame_index
single_frame_mode
timesrc

 

Phoenix Test

 

invert
level
node
srcchannel
var

 

Phoenix Particle Texture

 

amplitude
amplitude_time
blend_alpha
blending
map
map_time

radius
radius_time
radscale
shift
shift_mode
shift_time
sources

 

Phoenix Birth

 

combine

fd

node
rate

seed
sd

start
stop
td

use_f
use_s

use_t
use_v
vd

 

Phoenix Turbulence

 

decay

depth

injmode

lsa

lss

mult

partpreview

seed

size

speed