Pregunta

What is wrong with the following expressions that I am trying to set on a particular attribute in Maya. All are just different approaches.

Expression 1:

directionalLightShape1.intensity = sqrt(noise(time));

Error:

expression -s "directionalLightShape1.intensity = sqrt(noise(time));"  -o directionalLightShape1 -ae 1 -uc all ;
// Error: line 0: Invalid argument(s) for sqrt. // 
// Error: line 0: An execution error occured in the expression expression1. // 
// Result: expression1 // 
// Error: line 0: Invalid argument(s) for sqrt. // 
// Error: An execution error occured in the expression expression1. // 

Expression 2:

float $n = noise(time);
directionalLightShape1.intensity = sqrt($n);

Error:

expression -e -s "float $n = noise(time);\ndirectionalLightShape1.intensity = sqrt($n);"  -o directionalLightShape1 -ae 1 -uc all  expression1;
// Error: line 1: Invalid argument(s) for sqrt. // 
// Error: line 0: An execution error occured in the expression expression1. // 
// Result: expression1 // 
// Error: line 1: Invalid argument(s) for sqrt. // 
// Error: An execution error occured in the expression expression1. // 

Expression 3:

float $n = sqrt(`noise time`);
directionalLightShape1.intensity = $n;

Error:

expression -e -s "float $n = sqrt(`noise time`);\ndirectionalLightShape1.intensity = $n;"  -o directionalLightShape1 -ae 1 -uc all  expression1;
// Error: line 0: Invalid call to "noise".  Check number and types of arguments expected by the procedure. // 
// Error: line 0: An execution error occured in the expression expression1. // 
// Result: expression1 // 
// Error: line 0: Invalid call to "noise".  Check number and types of arguments expected by the procedure. // 
// Error: An execution error occured in the expression expression1. // 

Expression 4:

float $n = noise(time);
directionalLightShape1.intensity = `sqrt $n`;

Error:

expression -e -s "float $n = noise(time);\ndirectionalLightShape1.intensity = `sqrt $n`;"  -o directionalLightShape1 -ae 1 -uc all  expression1;
// Error: line 1: Invalid argument(s) for sqrt. // 
// Error: line 0: An execution error occured in the expression expression1. // 
// Result: expression1 // 
// Error: line 1: Invalid argument(s) for sqrt. // 
// Error: An execution error occured in the expression expression1. // 
¿Fue útil?

Solución

You might want to use (noise(time) + 1)/2 if you see artifacts from using abs.

Depending on the application the truncation of the range might be an issue.

Otros consejos

The problem with all the stated expressions is that noise was returning negative value. Which when fed to sqrt was naturally supposed to throw an error which wasn't quite evident at first.

Replacing noise(time) with abs(noise(time)) solved the problem.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top