Description
Evaluate an expression in LUA for each weightmap value, with up to 30 weightmaps connected.
How to apply
To create a new Weightmap and apply the
lmExpressionMapOp on it, either select a X3DObject, a Primitive or a
Cluster. To apply the operator on an existing weightmap, select the
weightmap.
Then choose "lm Expression Map" from the lmWeightMapTools
menu.
Exemple of use
In this exemple, the expression map is connected to a
proximity map, and the result is the sum of the proximity map (w0)
multiplied by 3 (v0), a random value (r) multiplied by 2 (a) and the
position x (x) multiplied by 0.149 (b).
The result range is changed to map the target [-1:1]. The negative
values appears red (see the Tips
section to learn how to get that
color).

lmExpressionMap Operator Parameters
- Enable
Main enable parameter. If not checked the operator is desactivated. - General
Expression: expression in LUA language, see the quick reference to see what's avalaible.
Variable a, b: variables availaible in the expression.
Random Seed: simple random seed.
- Post-Process
Post-Process:
None: nothing...
Clamp: Clamp weight values between the Min and Max values.
Change Range: change the range value to the specified range.
Min, Max: Min and Max values of the Clamp and Change Range modes. - Presets
Negate: -w
Invert: 1 - w
Constrast: a - (a-w)*b
Square: w^2
Random: a*r
Funky x: cond(y>0, r, a*r+b*x^2/2)
Linear x, y, z: x, y, z
Absolute X, Y, Z: math.abs(x), math.abs(y), math.abs(z)
Radial XY, YZ, XYZ: x^2 + y^2, y^2 + z^2, x^2 + y^2 + z^2 - Transformation offsets
These values define an offset transformation space for the values x, y, and z available in the expression. - LUA Helpers
You can define user LUA functions here. The exemple is the cond function, that behaves the same as the XSI expression cond.
- Add Connexion:
This button launches a Custom Command that adds a connexion to the lmExpressionMapOp. You can either select one or more weightmaps and click on the button to add connexions to all the specified weightmaps, or you can select nothing and you will be asked to pick a weightmap. - Remove All Connexions:
This button launches a Custom Command that removes all the connexions from the operator. - Weightmap group:
w[i]: enable or disable the use of the connected weightmap number i, define the name of the value available in the expression.
Remove: this button lauches a Custom Command that removes the specified connexion.
v[i]: a custom variable available in the expression.
Quick Expression Reference
You can find a full documentation of the LUA language
on www.lua.org.
Classic operations are + - * /
Raise to power is ^
Available maths functions are:
math.abs
math.acos math.asin
math.atan math.atan2
math.ceil
math.cos math.deg
math.exp math.floor
math.log
math.log10 math.max
math.min math.mod
math.pow
math.rad math.sin
math.sqrt math.tan
math.frexp
math.ldexp math.random math.randomseed
Available variables are:
w: original weightmap value
a, b: parameters animatable in XSI
r: random value
x, y, z: local position of the
underlying geometry
for each connected weightmap of index i:
wi:
connected weightmap value
vi:
parameter animatable in XSI
