|
|
HERE IT IS!! The base any way.
This is the Fade.inc file:
//Fade one animation into another
// Vers: 3.6
// Auth: Leroy Whetstone Email lrw### [at] joplincom
// imagmaps at <0,0,0>
// Fade_Style:
// 0= animation1 Fade to animation2 uses average
// 1= animation2 Fade to animation1 uses average
// 2= pattern animation1 Cut to animation2
// 3= reverse pattern animation1 Cut to animation2
// 4= pattern animation2 Cut to animation1
// 5= reverse pattern animation2 Cut to animation1
#local ER=0;
#ifndef(Fade_Debug) #declare Fade_Debug=0;#end//show debugs
#ifndef(Fade_Style) #declare Fade_Style=0;#end//fade type
#ifndef(Fade_Pat_Deta) #declare Fade_Pat_Deta=0;#end//Blend area : space
between images
#ifndef(Fade_Pat_Loc) #declare Fade_Pat_Loc=0;#end//Lock pattern at
value 0<VALUE<=1
#ifndef(Fade_Pat) #declare Fade_Pat=pigment{gradient y translate
y*.5};#end//pattern fade;
// #declare Fade_Color=pigment{Black}//comment out to use sceneB
#ifndef(Subset_Start) #declare Subset_Start=0;#end//Subset_Start_Frame
adjustment
#ifndef(Subset_End) #declare Subset_End=0;#end //use Subset_End_Frame
for calc >0 yes 0=no;
#ifndef(Scene_Ambient) #declare Scene_Ambient=1; #end
#ifndef(SceneA1) #local ER=1; #end //Start First Scene file
#ifndef(SceneA2) #local ER=ER+2; #end//End First Scene file
#ifndef(Fade_Color)
#ifndef(SceneB1)#local ER=ER+4;#end//Start second Scene file
#ifndef(SceneB2)#local ER=ER+8;#end//End second Scene file
#end
#ifndef(Scene_Size) #local ER=ER+16; #debug "\nNeed Sv:Scenes
size\n"#end// Scenes size
#local Sv=<0,0,1>+Scene_Size;
#if(ER)
#debug "\n.............ERROR!!! in FadeS3.pov............\n\n"
#if(mod(ER,2)) #debug "Need SceneA1: Start First Scene file\n" #end
#local ER=int(ER/2);
#if(mod(ER,2)) #debug "Need SceneA2: End First Scene file\n" #end
#local ER=int(ER/2);
#if(mod(ER,2)) #debug "Need Fade_Color or SceneB1: Start second Scene
file\n"#end
#local ER=int(ER/2);
#if(mod(ER,2)) #debug "Need Fade_Color or SceneB2: End second Scene
file\n" #end
#local ER=int(ER/2);
#if(mod(ER,2)) #debug "Need Sv: Scenes Size\n" #end
#debug "\n ...........ERROR!!! in FadeS3.pov.............\n\n"
#error "Stopped"
#end
camera{ location <0,0,-10>
look_at <0,0,0>
right x*image_width/image_height
}
//================================================================
#macro FixVal(Scene) // fix name,id,type
#local A=1;
#local B=0;
#local C=strlen(Scene);
#local D=0;
#while(B=0)
#local N=substr(Scene,A,1);
#if(strcmp(N,"0")=0) #local B=A; #end
#if(val(N)>0) #local B=A; #end
#local A=A+1;
//#debug concat(D," A=",str(A,3,3)," ",str(B,3,3),"\n")
#if (A>C) #debug concat("\n**** Error: __",Scene,"__ number not right
***\n\n")
#error "Scene number not right"
#end
#end
#while(D=0)
#local N=substr(Scene,A,1);
#if(strcmp(N,".")=0) #local D=A; #end
#local A=A+1;
//#debug concat(D," A=",str(A,3,3)," ",str(B,3,3),"\n")
#if (A>C) #debug concat("\n**** Error: __",Scene,"__ Type not right
***\n\n")
#error "Scene Type not right"
#end
#end
#declare Sname=substr(Scene,1,B-1);
#declare Stype=substr(Scene,D+1,3)
#declare Sid=D-B;
#declare Fdata=val(substr(Scene,B,Sid));
//#debug concat(N," C=",str(D,3,3)," ",str(B,3,3)," ",str(Sid,3,3),"
",str(Fdata,3,3),"\n")
#end
//=====================================================================
#ifdef(Fade_Color)//replace SceneB with Fade_Color
#declare Fade_Use_Color=1;//replace SceneB with Fade_Color
#else
#declare Fade_Use_Color=0;//replace SceneB with Fade_Color
#end
FixVal(SceneA1)
#declare Name1=Sname;
#declare Type1=Stype;
#declare IdS1=Sid;
#declare Id1=Fdata;
FixVal(SceneA2)
#declare Name2=Sname;
#declare Type2=Stype;
#declare IdS2=Sid;
#declare Id2=Fdata;
#if(Fade_Use_Color=0)
FixVal(SceneB1)
#declare BName1=Sname;
#declare BType1=Stype;
#declare BIdS1=Sid;
#declare BId1=Fdata;
FixVal(SceneB2)
#declare BName2=Sname;
#declare BType2=Stype;
#declare BIdS2=Sid;
#declare BId2=Fdata;
#end
#if(IdS1!=IdS2) #error "\n Not the right count\n" #end
#if(strcmp(Name1,Name2))#error "\n Not the right Names\n" #end
#if(strcmp(Type1,Type2))#error "\n Not the right Types\n" #end
#if(Fade_Use_Color=0)
#if(BIdS1!=BIdS2) #error "\n Not the right count in second\n" #end
#if(strcmp(BName1,BName2))#error "\n Not the right Names in second\n" #end
#if(strcmp(BType1,BType2))#error "\n Not the right Types in second\n" #end
#if((BId2-BId1)!=(Id2-Id1)) #error "\n Not the right count between
Frist & second\n" #end
#end
#if(Subset_End=0)#local frame_End=final_frame;
#else #local frame_End=Subset_End;
#end
#if(Subset_Start=0)#local frame_Start=initial_frame;
#else #local frame_Start=Subset_Start;
#end
#local Rfd=frame_End-frame_Start;// initial_frame-Subset_Start;
#local Fd=(Id2-Id1);
#if(Fd!=Rfd)
#debug concat("\n Rfd=",str(Rfd,3,3)," Fd=",str(Fd,3,3),"\n")
#debug "*** ERROR: Frame count and render Count don't match ***\n"
#debug concat("*** FIRST
*** \n")
#debug concat("*** SET INI initial frame to 0
***\n")
#debug concat("*** SET INI final frame to ",str(Fd,2,0),"
***\n\n")
#error "Stoped"
#end
#if(Fade_Use_Color=0)
#local Fd=(BId2-BId1);
#if(Fd!=Rfd)
#debug concat("\n Rfd=",str(Rfd,3,3)," Fd=",str(Fd,3,3),"\n")
#debug "*** ERROR: Frame count and render Count don't match ***\n"
#debug concat("*** SECOND
*** \n")
#debug concat("*** SET INI initial frame to 0
***\n")
#debug concat("*** SET INI final frame to ",str(Fd,2,0),"
***\n\n")
#error "Stoped"
#end
#end
#local Fc = Id1+frame_number-frame_Start;
//#while (Cnt <= Id2)
#declare Pname=concat(Name1,str(Fc,-IdS1,0),".",Type1);
#if(Fade_Debug) #debug concat(Pname,"\n")#end
//#local Cnt = Cnt+1;
//#end
#if(Fade_Use_Color=0)
#local Fc = BId1+frame_number-frame_Start;
#declare Qname=concat(BName1,str(Fc,-BIdS1,0),".",BType1);
#if(Fade_Debug) #debug concat(Qname,"\n")#end
#end
#if(Fade_Use_Color=0)
#declare Pig2=pigment{image_map{
#if(strcmp(Type2,"Gif")=0) gif #end
#if(strcmp(Type2,"tga")=0) tga #end
#if(strcmp(Type2,"iff")=0) iff #end
#if(strcmp(Type2,"ppm")=0) pgm #end
#if(strcmp(Type2,"png")=0) png #end
#if(strcmp(Type2,"jpg")=0) jpeg #end
#if(strcmp(Type2,"tif")=0) tiff #end
#if(strcmp(Type2,"bmp")=0) sys #end
Qname
}
translate <-.5,-.5,0>
}
#else #declare Pig2=pigment{Fade_Color} // #error"Stop"
#end
#declare Pig1=pigment{image_map{
#if(strcmp(Type1,"Gif")=0) gif #end
#if(strcmp(Type1,"tga")=0) tga #end
#if(strcmp(Type1,"iff")=0) iff #end
#if(strcmp(Type1,"ppm")=0) pgm #end
#if(strcmp(Type1,"png")=0) png #end
#if(strcmp(Type1,"jpg")=0) jpeg #end
#if(strcmp(Type1,"tif")=0) tiff #end
#if(strcmp(Type1,"bmp")=0) sys #end
Pname
}
translate <-.5,-.5,0>
}
#local Cv1=(frame_End-frame_number);//-frame_Start;
#local Cv2=frame_number-frame_Start;
#if(Fade_Pat_Loc)
#local Cv1=(frame_End-frame_Start)*Fade_Pat_Loc;
#local Cv2=(frame_End-frame_Start)-Cv1;
#end
#if(Fade_Debug)
#debug concat("\n frame_Start=",str(frame_Start,3,3),"
frame_End=",str(frame_End,3,3),"\n")
//#debug concat("\n Cv1=",str(Cv1,3,3)," Cv2=",str(Cv2,3,3),"\n")
#end
#local FPD=Fade_Pat_Deta;
#switch(Fade_Style)
#case(0) #declare Pig3=pigment{average pigment_map{[Cv1 Pig1][Cv2
Pig2]}} #break
#case(1) #declare Pig3=pigment{average pigment_map{[Cv1 Pig2][Cv2
Pig1]}}#break
#case(2)
#local Tv=Cv2/(Cv2+Cv1);#if(Tv=0)#local FPD=0;#end
#if(Fade_Pat_Loc) #local Tv=Fade_Pat_Loc;#end
#declare Fna=function{pigment{Fade_Pat}}
#declare Pig3=pigment{function{Fna(x,y,z).gray}
pigment_map{[Tv Pig1][Tv+FPD Pig2]}}
//#debug concat("\n Tv=",str(Tv,3,3),"\n")
#break
#case(3)
#local Tv=Cv1/(Cv2+Cv1);#if(Tv=0)#local FPD=0;#end
#if(Fade_Pat_Loc) #local Tv=Fade_Pat_Loc;#end
#declare Fna=function{pigment{Fade_Pat}}
#declare Pig3=pigment{function{Fna(x,y,z).gray}
pigment_map{[Tv Pig2][Tv+FPD Pig1]}}
//#debug concat("\n Tv=",str(Tv,3,3),"\n")
#break
#case(4)
#local Tv=Cv2/(Cv2+Cv1);#if(Tv=0)#local FPD=0;#end
#if(Fade_Pat_Loc) #local Tv=Fade_Pat_Loc;#end
#declare Fna=function{pigment{Fade_Pat}}
#declare Pig3=pigment{function{Fna(x,y,z).gray}
pigment_map{[Tv Pig2][Tv+FPD Pig1]}}
//#debug concat("\n Tv=",str(Tv,3,3),"\n")
#break
#case(5)
#local Tv=Cv1/(Cv2+Cv1);#if(Tv=0)#local FPD=0;#end
#if(Fade_Pat_Loc) #local Tv=Fade_Pat_Loc;#end
#declare Fna=function{pigment{Fade_Pat}}
#declare Pig3=pigment{function{Fna(x,y,z).gray}
pigment_map{[Tv Pig1][Tv+FPD Pig2]}}
//#debug concat("\n Tv=",str(Tv,3,3),"\n")
#break
#case(6) #include"CustomFade.inc"
#break
#else #debug"\n *** Fade_Style not in range ***\n\n"
#error"Stopped"
#end
box{<-.5,-.5,0>,<.5,.5,.1>pigment{Pig3}
finish{ambient Scene_Ambient}
scale Sv/20}
--------to use you need to call Fade.inc from this ---------------
#declare Fade_Style=0 fade_out //default
//#declare Fade_Style=1 fade_in
#declare SceneA1= first animation frames start
#declare SceneA2= first animation frames end
#declare SceneB1= first animation frame start
#declare SceneB2= first animation frame end
#declare Scene_Size= <width,height>
Post a reply to this message
|
|