Help on viewport animation

10 messages
Open this post in threaded view
|

Help on viewport animation

 I need some help on viewport animation. I'm currently making the animation of a CNC machine and all is going well except concerning the viewport animation. Lets see... At first I wrongly thought that I could pass parameters from modules to \$vpr, \$vpt and \$vpd using \$globals. As this is impossible, I tried using functions at top level to do the same. for instance if I do: \$vpt=[100+300*MT(1),0,0]; \$vpr=[0,0,200*MT(1)]; \$vpd=1500; where MT(i) function is the relative time within animation sequence "i" and depends on \$t, the viewport animates. However if I do:     function Cam() = CS==1 ? [10,200,1, 20,20,1, 20,20,1, 20,92,2, 20,29,1, 20,92,2, 200,200,1] :                         CS==2 ? [10,200,1, 20,20,1, 20,20,1, 29,92,2, 29,29,1, 29,92,2, 200,200,1] : 0 ;                                                   Where CS is my current sequence and Cam() contains the parameters for the viewport animation. And then if I do:     function VPX(CS)=Cam()[0]+S(CS,Cam()[1],Cam()[2],0);   function VPRZ(CS)=Cam()[15]+S(CS,Cam()[16],Cam()[17],0);    Where my function S(a,b,c,d), that is systematically used in my animation without problems, also depends on \$t. And then do: \$vpt=[VPX(CS), 100, 100]; \$vpr=[0,0,VPRZ(CS)]; \$vpd=1500;   echo("Camera: ", Cam()[0],Cam()[1], Cam()[2],VPX(CS), VPRZ(CS));   I see that VPX(CS) and VPRZ(CS) change with time as expected, but \$vpt and \$vpr stay with the first calculated values until the end of the sequence. What am I doing wrong? Thanks. jpmendes
Open this post in threaded view
|

Re: Help on viewport animation

 Don't know what's wrong, but if you can rotate the objects (instead of changing viewport), this might be useful: Animating gif with 3D rotation \$ Runsun Pan, PhD \$ libs: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); \$ Tips; \$ Snippets
Open this post in threaded view
|

Re: Help on viewport animation

 In reply to this post by jpmendes Should CS be a parameter of Cam() perhaps?On 31 March 2016 at 19:29, jpmendes wrote:I need some help on viewport animation. I'm currently making the animation of a CNC machine and all is going well except concerning the viewport animation. Lets see... At first I wrongly thought that I could pass parameters from modules to \$vpr, \$vpt and \$vpd using \$globals. As this is impossible, I tried using functions at top level to do the same. for instance if I do: \$vpt=[100+300*MT(1),0,0]; \$vpr=[0,0,200*MT(1)]; \$vpd=1500; where MT(i) function is the relative time within animation sequence "i" and depends on \$t, the viewport animates. However if I do:   function Cam() = CS==1 ? [10,200,1, 20,20,1, 20,20,1, 20,92,2, 20,29,1, 20,92,2, 200,200,1] :                         CS==2 ? [10,200,1, 20,20,1, 20,20,1, 29,92,2, 29,29,1, 29,92,2, 200,200,1] : 0 ; Where CS is my current sequence and Cam() contains the parameters for the viewport animation. And then if I do:   function VPX(CS)=Cam()[0]+S(CS,Cam()[1],Cam()[2],0);   function VPRZ(CS)=Cam()[15]+S(CS,Cam()[16],Cam()[17],0);  Where my function S(a,b,c,d), that is systematically used in my animation without problems, also depends on \$t. And then do: \$vpt=[VPX(CS), 100, 100]; \$vpr=[0,0,VPRZ(CS)]; \$vpd=1500; echo("Camera: ", Cam()[0],Cam()[1], Cam()[2],VPX(CS), VPRZ(CS)); I see that VPX(CS) and VPRZ(CS) change with time as expected, but \$vpt and \$vpr stay with the first calculated values until the end of the sequence. What am I doing wrong? Thanks. jpmendes -- View this message in context: http://forum.openscad.org/Help-on-viewport-animation-tp16858.html Sent from the OpenSCAD mailing list archive at Nabble.com. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

Re: Help on viewport animation

Open this post in threaded view
|

Re: Help on viewport animation

 @ Doug Nope, there is only one place where \$vp's are referenced. @ nopehead I tried Cam(CS) without success. Thanks anyway BTW this is a test sample of the two first sequences without the CNC, just to speed up things. Although there are some adjustments to be done, that's the idea. anima_tst.mp4Another problem I'm facing is: for this simple animation, generating the png's directly by checking "Dump Pictures"  my file rate generation is about 1 second per picture. However if I use a script for generating the images with about 4x the standard resolution, it takes about a minute per picture. That means more than 2 days for my estimated 7500 steps animation. Considering the inclusion of all the components in the animation maybe a week will not be enough. The CNC is belt driven and I have to calculate the belt deformation for each step, and it takes about 20 secs in my machine.
Open this post in threaded view
|

Re: Help on viewport animation

 @jpmendes I'm happy to help out with rendering a sequence. I have 16 cores, possibly more than one instance can be rendered at the same time ? Assuming you hve a time constraint....
Open this post in threaded view
|

Re: Help on viewport animation

Open this post in threaded view
|

Re: Help on viewport animation

 @neon22 Thanks, I may consider the offer for the final render. Maybe I can use my son's 6 core pc if he takes some days off, summer is comming ... :-).  For now I have my 11 year old, 2 cores Athlon 4200 only. @nopehead My S function is a bit straight forward. I intend to perfect it later. Now what I'm trying to do is  a simple animator that I can use whenever I need. // S -Relative speed within the sequence time with movement inversion point (perliminary). // d - distance, s - relative speed, InvT - inversion point between 1 and 0. function S(i,d,s,InvT) = (InvT==undef)? (d*pow(MT(i),s)):                        (MT(i)-InvT<0)? (d*pow(-MT(i)+InvT,s)):                        (d*pow(MT(i)-InvT,s)); // MT - relative time within the sequence time slot (1 --> 0) function MT(i) = (T(i)-\$t>=0)? (TTime/SeqTPlan[i-1])*(T(i)-\$t): 0; As you can see S() depends on \$t through MT(i)