Re: Optimizing Custom Operators

2013-03-26 Thread Jeremie Passerin
Hi Eugen,

I have done very few geometry generator op so not sure I can really help
with that.
Here is my code look like for my evaluation issue :

function myOp_Update( ctxt, out, surfaceMesh ){
 paramA= ctxt.Parameters(paramA).Value;
paramB= ctxt.Parameters(paramB).Value;
 id = surfaceMesh.Value.EvaluationID;
ev = id + paramA + paramB;
 // Process
if ( ctxt.UserData == null || ctxt.UserData[0] != ev ) {
// Do the heavy math
result = 1;
 ctxt.UserData = [ ev, result ];
}
 out.Value = ctxt.UserData[1];
}


Re: Optimizing Custom Operators

2013-03-25 Thread Jeremie Passerin
Finally got time to look at it closer...

Well it looks like it's working perfectly ! And it's so simple !
The animators are testing it right now but it looks super cool now ;-)

Thanks mate !


Re: Optimizing Custom Operators

2013-02-09 Thread Jeremie Passerin
That seems to available in JScript too.
I'll have a look at that. thanks !


On 9 February 2013 03:29, Kai Wolter kaiwolte...@gmail.com wrote:

 It was added to ProjectItem:


 http://softimage.wiki.softimage.com/sdkdocs/2011_5/si_cpp/classXSI_1_1ProjectItem.html

 Have a look at the last two methods.

 So yes, geometry should work as well.

 Happy coding!

 Kai


 On 09/02/2013, at 2:04 AM, Jeremie Passerin gerem@gmail.com wrote:

 Thanks Kai !

 I don't mind writting C++, but I like to prototype in JScript... I would
 have check that,
 Do you think that would work if one of the input is a
 geometry being deformed ?



 Jeremie







Re: Optimizing Custom Operators

2013-02-08 Thread Kai Wolter
Hey Jeremie,

What about only doing the recompute when your inputs change?
Can't remember what the function name was, but in one of the QFEs you could ask 
an object or parameter for its evaluation id which is increased by Softimage 
every time the parameter/object has changed - pretty sure that one made it into 
2012/2013, but might only be accessible from C++. So as long as those ids don't 
change, you can return the cached result..

Kai



On 08/02/2013, at 11:22 PM, Jeremie Passerin gerem@gmail.com wrote:

 Hi list !
 
 
 So here is a problem I'm facing every time I'm writing a Custom Operator with 
 multiple outputs. 
 As you know, operators are fully evaluated for each output. 
 In my case, there is a big chunk of the code that only needs to be evaluated 
 once per frame and I certainly don't want it to be evaluated for every output 
 as it affects drastically the performances.
 
 My first problem is that Softimage doesn't always evaluate the output in the 
 same order... so here is my work around. I store the result the first time in 
 a data blob and then I count the number of time the operator has been called. 
 If it has been called more than the number of outputs, that means I need to 
 re-compute the result
 
 function myOp_Update( ctxt, out ){
   
   // Number of output I have
   count = ctxt.Parameters(count).Value;
 
   if ( ctxt.UserData == null || ctxt.UserData[0] = count )
   {
   
   outValues = Array(count);
   // Do the big math
   
   ctxt.UserData = [1, outValues];
 
   }
 
   // Output
   ctxt.UserData[0] += 1;
 
   out.Value = outValues[out.Index];
 }
 
 
 It seems to work most of the time but I still have some doubt that it's 
 working perfectly. It's difficult to exactly now when it happens but I'm 
 under the impression that I'm not always reevaluating it when I should. 
 
 Does any one do it differently ? Do we have a way to know when an operator is 
 called for the first time for a bunch of outputs ? 
 
 Thanks, 
 Jeremie