PDA

View Full Version : expression upper and lower limit

Soth
05-19-2006, 01:32 AM
Hi,

I wonder if anyone can help me.

I need to set the opacity of a texture based on the output value of an
expression.

I need the textures opacity to be 0% when a channel is between -40 and
50 and 100% if is outside these values.

[HDDriverNullAngle.Rotation.H] > -40 ? 1 : 0

....|-------->...........
---.-----.-----.----->
..-40.....0......50......

This expression only works as desired.

The expression below does not work - the nested if statment is not
creating the desired transparency.

[HDDriverNullAngle.Rotation.H] > -40 ? ([HDDriverNullAngle.Rotation.H]
< 50 ? 1 : 0) : 0

..............<---|........
...|----->.......|........
---.-----.-----.----->
..-40.....0......50......

In short - We have a null targeted to a camera. The camera is rotating
around a clipped image plane. Between certain values we want certain
textures to have their opacity turned on and off. The problem with
targeting the plane to the camera is that the rotation takes the
easiest path. So the motion of the rotation creates a saw tooth in the
graph editor that goes between 180 and -180.

We think that if we can create anexpression that works between say -40
and 50 that creates an output inside of 0 and outside of 1 we think it
will solve the problem.

Any ideas greatfully recieved.
Tomasz

kruemel_1
05-19-2006, 02:15 AM
You have to create 2 Expressions. The first express constrols for Example values above -40 (as you did: [HDDriverNullAngle.Rotation.H] > -40 ? 1 : 0),
The second controls values below 50 and use as one parameter the first expression ([HDDriverNullAngle.Rotation.H] < 50 ? [first_expression] : 0

Soth
05-19-2006, 03:13 AM
Yes,
I've tried this one:
[HDDriverNullAngle.Rotation.H] > -40 ? ([HDDriverNullAngle.Rotation.H]
< 50 ? 1 : 0) : 0

but it didn't work
:(
best regards
Tomasz

kruemel_1
05-19-2006, 03:19 AM
No, i meant it as i wrote it. Don't write the second expression on the then branch, write the NAME of the second expression (in brackets as in the example) on the then branch.