Appendix A · Field Names and Codes

A.8Direction Map Colours

A TenPix Wind in Map mode reads its directionMap as a colour at each point, in the map's own frame:

ColourDirection (each 0 .. 1 means −1 .. +1)
Redacross the map, left to right: the Wind icon's X
Greenup the map, bottom to top: the icon's Y
Bluealong the Wind's arrow

(0.5, 0.5, 1) blows straight along the arrow. The map is read with its 0, 0 on the arrow, one map being the Wind's mapSize. In an OSL map, read the position from a UVW input that defaults to vector(u, v, 0) (the Wind gives it) and the scene time from a float input with int timeValue = 1 metadata (3ds Max drives it in seconds); any OSL map of your own works in the slot. The eight samples in samples\Wind direction maps are complete shaders to copy from. A minimal one, the whole wind swaying from side to side by itself:

shader MyWindSway
(
    float Sway = 30.0 [[ string label = "Sway (deg)" ]],
    float Period = 2.0 [[ string label = "Period (s)" ]],
    float Time = 0.0 [[ int timeValue = 1 ]],
    output color Out = color(0.5, 0.5, 1.0)
)
{
    float a = radians(Sway * sin(2.0 * M_PI * Time / max(Period, 0.05)));
    Out = color(0.5 + 0.5 * sin(a), 0.5, 0.5 + 0.5 * cos(a));
}