POV-Ray : Newsgroups : povray.text.scene-files : Atom [WIP 0.30] - 1 attachment Server Time
30 Jun 2024 04:16:08 EDT (-0400)
  Atom [WIP 0.30] - 1 attachment (Message 1 to 3 of 3)  
From: Rafal 'Raf256' Maj
Subject: Atom [WIP 0.30] - 1 attachment
Date: 9 Oct 2002 12:28:46
Message: <Xns92A2BBBAAA0BBraf256com@204.213.191.226>
Hello,
this is a small animation of atom (breaking using simple "liquid" model).

Mirror: http://raf256.com/pov/atom0302.zip

I post .zip instead of .pov beacuse scene consist of >20 files (very small 
files, i.e. configuration, options etc).

The scene it self is very simple (animation posted to .b.a) but there are 2 
thinks that I like in it and I would be heapy for feedback :

1. organisation - many small files, qq/*.inc are quality settings, 
scene/*.inc are global scene like lights, bacgrounds, 
obj/*.inc are objects atc.

2. animation script - that works at any FPS rate.
I.e. if we render scene for clock 0.50 and previous clock was 0.40, then 
program reads data saved from 0.40 and recalculates it by runing iterations 
of main script loop (0.40 -> 0.50).
In animation_1.ini  turn ON debug stream to see how this works.
Animation rebuildable data are stored in /_var/*

-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message


Attachments:
Download 'atom0302.zip' (18 KB)

From: ABX
Subject: Re: Atom [WIP 0.30] - 1 attachment
Date: 10 Oct 2002 04:41:02
Message: <c3faquca7blvpetf39p65pkpt2stg3at37@4ax.com>
On 9 Oct 2002 12:28:46 -0400, "Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote:
> I post .zip

why in wrong group ?

ABX


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: Atom [WIP 0.30.2] atom_move.inc
Date: 10 Oct 2002 18:12:16
Message: <Xns92A41D5534A1raf256com@204.213.191.226>
ABX <abx### [at] abxartpl> wrote in
news:c3faquca7blvpetf39p65pkpt2stg3at37@4ax.com 

This file calculates size of atom (accualy represented by two "atoms" / spheres
that most time are identical, only in last part of aniation thery are different
when atom brake into two parts)


// defaults :
#declare dataAtomAntiDef = 0.0;
#declare aiAtomPartW1 = <0,0,0>;
#declare aiAtomPartW2 = <0,0,0>;

#if (clock_on)

#ifndef (Clock) #declare Clock=clock; #end

#declare AI_DBG_NEW_FRAME_BANNER = 0;
#declare AI_STEPS_PER_SECOND = 1000; // AI iterations per 1.0 clock (1 sec)

#declare aiThisScriptVersion = "atom-move-AI-cache-0.30-a0";
#declare FileName = "_var/anim/atom_move.ai-cache";

#if (frame_number=initial_frame)
  #fopen AiDbgFile "_var/anim/dbg.dbg" write
  #write (AiDbgFile,"(New AI debug file)\n")
#else  
  #fopen AiDbgFile "_var/anim/dbg.dbg" append
  #if (AI_DBG_NEW_FRAME_BANNER)
    #write (AiDbgFile, concat("*********** Frame #",str(frame_number,5,0),"
clock=",str(clock,10,6)),"\n")
  #end  
#end  

#debug "---[ai/avi]-------------------------------------------------------------\n"
#debug concat("[$] AI script - '",aiThisScriptVersion,"' with cache file
'",FileName,"'\n")

#declare aiAtomSX = 1.00;
#declare aiAtomSY = 1.00;
#declare aiAtomSZ = 1.00;
#declare aiAtomRotY = 0;
#declare aiAtomSpeed = 0.01;


#declare aiClockStep = 1/AI_STEPS_PER_SECOND;
#declare aiClockLoaded = 0.0;
#declare aiClock       = 0.0;
#declare aiClockTarget = Clock;

#declare ReadFromFile = 0;
#if (file_exists(FileName))
  #declare ReadFromFile = 1;
#else
  #debug "[$] script file doesnt exist"  
#end                       

#if (ReadFromFile)
  #fopen AiFile FileName read

  #declare aiLoadedVersion="(none)";
  #read (AiFile,aiLoadedVersion)
  #if (strcmp(aiThisScriptVersion,aiLoadedVersion)) #debug "[$] cached AI is from old
script version" #declare ReadFromFile = 0; #end
  #debug concat("[$] Loaded AI cache is from version= ",aiLoadedVersion,", ")
  #read (AiFile,aiClockLoaded)
  #debug concat("clock= ",str(aiClockLoaded,0,0),"\n")
  #if (aiClockLoaded>aiClockTarget) #debug "[$] cached AI is for never clock" #declare
ReadFromFile = 0; #end  
#end

#macro LoadVar(var)
  #read (AiFile,var)
#end

#macro LoadData()
  LoadVar(aiAtomSX)
  LoadVar(aiAtomSY)
  LoadVar(aiAtomSZ)
  LoadVar(aiAtomRotY)
  LoadVar(aiAtomSpeed)
  LoadVar(aiAtomPartW1)
  LoadVar(aiAtomPartW2)
#end

#if (ReadFromFile)
  #debug "[$] Loading data from cache\n"   
  LoadData()
  #if (defined(MyFile))   
    #debug "[!$] error while reading cached AI\n"
  #end
#else
  #declare aiClockLoaded=0;
#end           

#fclose AiFile 
// ===============================================

#debug concat("[$] Recalculating clock ",str(aiClockLoaded,6,10)," -->
",str(aiClockTarget,6,10),"\n")
#declare lit=0; // Local ITerations
#declare aiClock=aiClockLoaded;
  #declare aiAtomOldRotY = aiAtomRotY; // for freezing in linear explosion 
#while (aiClock <= aiClockTarget) 
  #declare vPreserv = 0; // 0=~x[Y]~z or [XYZ]   1=[X][Y]~~z  
  
  #declare aiAtomSpeed = clip(aiAtomSpeed+0.00008, 0,1); // accelerate
  #declare aiAtomRotY = aiAtomRotY + aiAtomSpeed/5000; // rotate
  
  #declare vDef = aiAtomSpeed; // power that defor atom
                     
  // crushing - reducing Y (x=z will adjust)
  #declare vAtomCrush  = clip(pow(max(0,vDef-0.25)*1.2,  1.0), 0,1);
  
  // longen - increasing X (z will adjust)
  #declare vAtomLong   = 2.0 * clip(pow(max(0,vDef-0.65)*1.5,  1.0), 0,1);
  #if (vAtomLong) #declare vPreserv=1; #end
      
  #declare aiAtomSY = 1.00 * 1/(1+(2.5-1)*vAtomCrush);  // deform Y
  // re-deform to preserve volume after Y deform
  #declare aiAtomSX = pow(1/aiAtomSY,1/2);
  #declare aiAtomSZ = pow(1/aiAtomSY,1/2);
  
  #declare aiAtomSX = aiAtomSX + vAtomLong; // deform X
  #declare aiAtomSZ = 1 / (aiAtomSX * aiAtomSY); // re-deform 
  
   // explosion
  #declare timAfterExplode=max(0,Clock-12);
  #declare timLinearPart = (timAfterExplode > 0.5);
  #local vClk=3.0 * timAfterExplode;
  #local dist=vClk*3.0*Fade(vClk, 0.5, 0.9, "e3", 00.3,1.00);
  #local vAnti = Fade(vClk, 0.0, 2.0, "e3", 0,1);
  #declare aiAtomPartW1 = <+dist,0,0> ;
  #declare aiAtomPartW2 = <-dist,0,0> ;
      
  #declare lit=lit+1;
#declare aiClock=aiClock+aiClockStep; #end

  #if (timLinearPart) 
    #declare aiAtomRotY = (aiAtomRotY+aiAtomOldRotY)/2;
    #debug concat("Freeze ROTY at ",str(aiAtomRotY,10,5),"\n")
  #end

#declare dataAtomAntiDef = vAnti;
#write
(AiDbgFile,concat("aiAtomSize=<",str(aiAtomSX,8,5),",",str(aiAtomSY,8,5),",",str(aiAtomSZ,8,5),">
\n"))

#declare vAtomVolume = aiAtomSX*aiAtomSY*aiAtomSZ; 
#if (abs(vAtomVolume-1)>0.000001) 
  #error "[!] Invalid atom volume (",str(vAtomVolume,8,5),")\n"
#end

#debug concat("[$] ...done, in ",str(lit,6,0)," iterations, aiClock/Target=
",str(aiClock,6,10)," / ",str(aiClockTarget,6,10),"\n")

// =============================================== 
#debug concat("[$] Writting AI cache (for AiClock=",str(aiClock,0,0),")\n")

#fopen AiFile FileName write
#write (AiFile,concat("\"",aiThisScriptVersion,"\",\n"))
#write (AiFile,aiClock)  #write (AiFile,",\n")


#macro SaveVar(var)
  #write (AiFile,var) #write (AiFile,",\n")
#end

#macro SaveData()
  SaveVar(aiAtomSX)
  SaveVar(aiAtomSY)
  SaveVar(aiAtomSZ)
  SaveVar(aiAtomRotY)
  SaveVar(aiAtomSpeed)
  SaveVar(aiAtomPartW1)
  SaveVar(aiAtomPartW2)
#end

SaveData()

#write (AiFile,"End of AI cache file")

#declare dataAtomSize = <aiAtomSX,aiAtomSY,aiAtomSZ>;
#declare dataAtomRotY = aiAtomRotY;


#debug "---[ai/avi]-------------------------------------------------------------\n"
#end

-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.