Log In | Register | Contact | Search


Forum Home  >  Electric Image Animation System  >  EIAS Technical Support  >  Thread
Search      Advanced Search
   
2 of 2
2
Xpressionist: do Xp-scripted channel value changes persist beyond the frame they are calculated in?
Posted: 05 August 2007 09:18 AM   [ Ignore ]   [ # 16 ]  
Member
RankRankRank
Total Posts:  79
Joined  2007-04-18

BJMonkey’s solution is very elegant, I think, plus his creation of a “blend” parameter, even if it wasn’t needed here, is very interesting to learn.

I was trying now to get back to basics and see what’s going on with these “nan” outputs in the console. I am getting some very strange results.

if I do something like this:

double roundedTime = round(time);
console ("time=",time);
console ("rounded time=”,roundedTime);

What I get as results are things like:

DoGenerate_: new frame
XP: time=8.8666666667
XP: time=8.8666666667
XP: rounded time=0
XP: rounded time=0

No “nan” results, but no correct ones either: roundedTime ought to be 9 instead of 0, oughtn’t it? (and what’s this doubled output per Console entry in the Console window, anyway?)

Now, it seems I sistematically get a “nan” result if I do something like this, say:

double roundedTime = round(time*2);

That is, putting a whole calculation as a function parameter, even if it is something as simple as “time*2” (it will give me a 0 instead when time equals an integer value, though)

But then BJMonkey’s “var = clamp (0,1,Blend*sin(frame*(20/3)));” works without problems, so what gives? Is it a data type thing, “frames” providing integer values and “time” float ones?

(And, by the way, would it be smarter (even if “dirtier") to implicitly do roundings to normalized values variables by declaring them as booleans? Somebody must be having a stroke while reading this smile )

Profile
 
 
Posted: 05 August 2007 09:31 AM   [ Ignore ]   [ # 17 ]  
Sr. Member
RankRankRankRank
Total Posts:  309
Joined  2007-03-11
BJMonkey - 05 August 2007 07:27 AM

Why?
If it’s set to update all frames, surely it should work fine?

Isn’t that what simulations do?

And this is such a simple simulation, I doubt that he’ll encounter too many problems.

Cause nobody guaranteed that “Xpressionist.to27” is filled with correct/expected data before you use it. The script generates different results depending on this channel value at “start frame”. Also nobody promised the script will be applied for all frames sequentially. So, for what do you need all this headache without any reason?

In general, a simpler program is always better. Recurrent/recursive calculations should be used only if they are absolute necessary.  Example:

if (((frame / 27) % 2) == 0) // “if (Even(frame / 27))” would be better yet, but we don’t know if XP has “Even” function
NavLight_Mstr.Intensity=1;
else
NavLight_Mstr.Intensity=0;

Looks definitely a bit primitive wink But in other hand…

- works always, independent on “start frame”
- doesn’t requre aux channel “Xpressionist.to27”
- intuitive for reading/understanding

Summary: most hard thing is to write a simple program wink

Profile
 
 
Posted: 05 August 2007 11:11 AM   [ Ignore ]   [ # 18 ]  
Member
Avatar
RankRankRank
Total Posts:  77
Joined  2007-03-08

I know this probably sounds like a totally noob question when I’ve been trying to help make a working expression, but what does the %2 do?
I don’t know what the % operator would do here?

Thanks smile

I still don’t ACTUALLY know how this works, or what %2 does…
But does this code do what you want…

Light.Intensity = (frame/27)%2;

Profile
 
 
Posted: 05 August 2007 11:40 AM   [ Ignore ]   [ # 19 ]  
Sr. Member
RankRankRankRank
Total Posts:  309
Joined  2007-03-11
BJMonkey - 05 August 2007 11:11 AM

I know this probably sounds like a totally noob question when I’ve been trying to help make a working expression, but what does the %2 do?
I don’t know what the % operator would do here?

Thanks smile

It returns an integer remainder of A / B. For example 28 % 5 returns 3. In practice it’s a way to detect if “A” is even to “B”. Can be substituted with “A - (A / B) * B” but only if A and B are integers (not floats)

Profile
 
 
Posted: 05 August 2007 11:41 AM   [ Ignore ]   [ # 20 ]  
Member
RankRankRank
Total Posts:  79
Joined  2007-04-18

It gives you the remainder of a division, so it looks like it means the same as the “fmod” function. The manual says % works with integers only, but I am not so sure that is so.

Profile
 
 
Posted: 05 August 2007 11:46 AM   [ Ignore ]   [ # 21 ]  
Member
Avatar
RankRankRank
Total Posts:  77
Joined  2007-03-08

Ok…
Now I’m confused smile

Because when I did…

Light.Intensity = (frame/27)%2;

I got the light changing from 0 to 1 every 27 frames, and I tested it for about 2 minuites.
Always either 1 or 0… And it stayed at that number for 27 frames each time…

I’m guessing something’s gone weird?

Profile
 
 
Posted: 05 August 2007 12:43 PM   [ Ignore ]   [ # 22 ]  
Sr. Member
RankRankRankRank
Total Posts:  309
Joined  2007-03-11
BJMonkey - 05 August 2007 11:46 AM

Ok…
Now I’m confused smile

Because when I did…

Light.Intensity = (frame/27)%2;

I got the light changing from 0 to 1 every 27 frames, and I tested it for about 2 minuites.
Always either 1 or 0… And it stayed at that number for 27 frames each time…

I’m guessing something’s gone weird?

But, as we understood, it’s what Juanxer wanted: a flickering light is ON/OFF each 27 frames

Juanxer - 05 August 2007 11:41 AM

It gives you the remainder of a division, so it looks like it means the same as the “fmod” function. The manual says % works with integers only, but I am not so sure that is so.

As far as we know Jens and Patrick, you can be fully sure smile The fmod and % are not same for integers and floats. For example

1) if (fmod(A, B) == 0)
2) if ((A % B) == 0)

will have same effect if A = 25.0 and B = 5.0. But a different effect with A = 25.1 and B = 5

Advice: don’t overestimate a role of “concrete knowledges”. A goal of any programming (count scripting too) is a writting of usable programs/results, not a following by some rules/encyclopedia wink

Profile
 
 
Posted: 05 August 2007 01:34 PM   [ Ignore ]   [ # 23 ]  
Member
Avatar
RankRankRank
Total Posts:  77
Joined  2007-03-08

He wanted this…
http://www.x1.ltd.uk/brooks_website/SharedStuff/flickersml.mov
Right?

That’s what I got using…

Light.Intensity = (frame/27)%2;

::EDIT::
nm, it’s more eratic than I first saw…

I still don’t understand why the only remainder is ever 1 or 0 though?
And why it’s 0 so often…

Profile
 
 
Posted: 05 August 2007 01:44 PM   [ Ignore ]   [ # 24 ]  
Member
RankRankRank
Total Posts:  79
Joined  2007-04-18

You know what? I am going to revise everything and rethink things a bit, practicing all your code ideas. I am inmensely grateful for all your help, so a big thank you smile.

I really do hope EIAS 7.0 comes with a printable PDF-based Xpressionist manual (this HTML help is graying my hair! :D), plus a few new features and utility functions here and there (any news about that?).

Profile
 
 
Posted: 06 August 2007 05:09 AM   [ Ignore ]   [ # 25 ]  
Member
Avatar
RankRankRank
Total Posts:  57
Joined  2007-04-14

Hello all,

I confirm for Animator 6.2.2:

- function “round” does not work (always returns 0)

other functions that do not work correctly under Animator 6.2.2:

double _abs(double x);
double _ceil(double x );
double _round(double x);
double _exp(double x);
double _floor(double x);
double _fmod(double x,double y);
double _log(double x);
double _log10(double x);
double _pow(double x,double y);
double _trunc(double x);

--

Please download the fixed XP plugin for Animator 6.2.2 here (replacement Xpressionist.plm):

http://xpressionist.patrickrosendahl.de/share/XP3.2.1_for_Animator6.2_update.zip

--

I will inform Matt now.

Patrick

Profile
 
 
Posted: 06 August 2007 07:41 AM   [ Ignore ]   [ # 26 ]  
Member
RankRankRank
Total Posts:  79
Joined  2007-04-18

Uh oh! (well, that explains a lot of things)

I was thinking about how EITG is dealing with some serious bugs that seem already solved, these solutions still not publicly released in their downloads page (the 6.6.2 update’s Lens Flare and Light Flare sockets have some tinting issues. EI kindly sent me new versions that solved them, but I believe their EIAS 6.2.2 download still installs the old faulty versions). I guess they are too fully inmersed in EIAS 7’s development, but…

Profile
 
 
Posted: 06 August 2007 08:08 AM   [ Ignore ]   [ # 27 ]  
Member
Avatar
RankRankRank
Total Posts:  57
Joined  2007-04-14

Ok, I will send Matt a reminder to put latest versions of LensFlare and LightFlare online. (And yes, he is really busy with Animator 7 smile )

Profile
 
 
Posted: 06 August 2007 08:47 AM   [ Ignore ]   [ # 28 ]  
Member
RankRankRank
Total Posts:  79
Joined  2007-04-18

That’s great! smile If anything, please tell him that was about some email correspondence he had with Juan Gómez Martín around 17 June 2007, regarding my posts at these threads:

http://www.eitechnologygroup.com/forums/viewthread/70/

http://forums.cgsociety.org/showthread.php?f=186&t=504381

(and again I’d want to thank him for his assistance back then)

Profile
 
 
   
2 of 2
2