POV-Ray : Newsgroups : povray.advanced-users : Problem with multiple macro calls : Problem with multiple macro calls Server Time
1 Jul 2022 19:38:33 EDT (-0400)
  Problem with multiple macro calls  
From: Juergen
Date: 6 Apr 2022 12:15:00
Message: <web.624dbb7e4118e24aa6f2d031df9b2273@news.povray.org>
Hi

I'm currently working on a scene using the Nuke from Tekno Frannansa.
Since I want to have multiple explosions in the scene at the same time, I have
encapsulated this in a macro to call this with a timestamp to generate multiple
explosions one after the other in time.
But somehow this doesn't work as soon as I have more than one explosion in the
scene. For test purposes, I want to see two explosions, with about a 2 sec
offset. As long as only the first explosion is visible, I don't see anything.
Only when the second explosion is visible, the first one is also visible.
Render with "-k350" for an incorrect image (one explosion), with "-k400" for a
correct image (two explosions).

What is wrong there to display the first explosion correctly?

At the moment not even clear to me where exactly the problem is (bug in
Pov-ray)?




----------Scene-------------------------

//NUKE!!!  By Tekno Frannansa
///#include "misctools.inc"
///ScalOut("************ START *******************",0)

//declare some things
// #local C=clock-.2; //blast occurs at C=0
#local arG = array[100];
#local F=function{pattern{granite}}

//scenery
sphere {
 0,9
 pigment { rgb<1,2,3>/3 }
 hollow
}

height_field {
 function 999,999 {
  pow( F(y,1,x), 9 )
 }
 translate .14*y-.5
 scale 10-y*7
 pigment { rgb<3,2,1>/3 }
}


camera {
  location y-2
  look_at 0
}

//THE NUKE!
// #if ( C>0 )
#macro NUKE(Start)
union {
  // Explosion ab Timestamp Start (clock), dauer 2 sek
  #local C = (clock/240)-Start;
  #local fadeoff = 1;
  #if (C>1.0)
    #local fadeoff = 2*(1.5-C);
  #end
  #if (C>1.5)
    #local fadeoff = 0;
  #end
  ///ScalOut("C=",C)
  ///ScalOut("fadeoff=",fadeoff)


  #if (C > 0 & C < 1.5)
    ///ScalOut("*** sphere *** ",C)
    //sphere  { 0,1 pigment { Red } }
    sphere { 0, 1.5
  pigment { rgbt 0.9 } // finally set to 1.0
  interior {
   media {
    scattering { 1,60 }
    absorption 60 //scattering gives white smoke, add absorption to get grey.
    density {
     //#declare arG[Idx] =
     #ifdef(G)
       #undef G;
     #end
     #local G =
      function {
       F(x,y+C/6,z-C/3)
       +(1-sqrt(x*x+y*y+z*z))*2
      }

     function {
      max(0,
       G(x,y-cos(y*2)*(1+C)*.6,z)// * fadeoff // * 0.005
       /3
      )
     }
    }
   }
  }
  hollow
 }

 //light from the blast
 light_source {
  -y*.7
  color <3,2,1>/99/4/C/C
 }
  #else
    sphere { 1E-10, 1E10 } // dummy
  #end // if "sichtbar"
  }
#end

object { NUKE(0.5) }
object { NUKE(1.5) translate 2*x }


light_source {
 y*9-5
 color 1
}


Post a reply to this message


Attachments:
Download 'nuke_prob.jpg' (17 KB)

Preview of image 'nuke_prob.jpg'
nuke_prob.jpg


 

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