POV-Ray : Newsgroups : povray.advanced-users : Problem with multiple macro calls Server Time
28 May 2022 11:53:35 EDT (-0400)
  Problem with multiple macro calls (Message 1 to 5 of 5)  
From: Juergen
Subject: Problem with multiple macro calls
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


 

From: William F Pokorny
Subject: Re: Problem with multiple macro calls
Date: 6 Apr 2022 12:42:17
Message: <624dc2e9$1@news.povray.org>
On 4/6/22 12:11, Juergen wrote:
> What is wrong there to display the first explosion correctly?

My guess is that the first explosion is inside the non-hollow dummy sphere:

   #else
     sphere { 1E-10, 1E10 } // dummy
   #end // if "sichtbar"

of the second - until the second explosion goes off.

Aside: I don't think there is any reason that dummy sphere to be what it 
is. As another guess something like:


   #else
     sphere { -1E10, 1E-6 } // dummy
   #end // if "sichtbar"

would server better. It's likely there just to prevent parse errors from 
an empty union.

Bill P.


Post a reply to this message

From: Alain Martel
Subject: Re: Problem with multiple macro calls
Date: 7 Apr 2022 10:47:04
Message: <624ef968$1@news.povray.org>
Le 2022-04-06 à 12:42, William F Pokorny a écrit :
> On 4/6/22 12:11, Juergen wrote:
>> What is wrong there to display the first explosion correctly?
> 
> My guess is that the first explosion is inside the non-hollow dummy sphere:
> 
>    #else
>      sphere { 1E-10, 1E10 } // dummy
>    #end // if "sichtbar"
> 
> of the second - until the second explosion goes off.
> 
> Aside: I don't think there is any reason that dummy sphere to be what it 
> is. As another guess something like:
> 
> 
>    #else
>      sphere { -1E10, 1E-6 } // dummy
>    #end // if "sichtbar"
> 
> would server better. It's likely there just to prevent parse errors from 
> an empty union.
> 
> Bill P.

Normally, a dummy object is made unobtrusive, so, located far away and tiny.
Even sphere{0, 0} or box{0, 0} can work.
Here, the original dummy object is extremely large.
Normally used to prevent warnings about unions with single objects and 
errors from empty unions.


Post a reply to this message

From: Kenneth
Subject: Re: Problem with multiple macro calls
Date: 8 Apr 2022 20:45:00
Message: <web.6250d60cf8955d554cef624e6e066e29@news.povray.org>
"Juergen" <nomail@nomail> wrote:

> For test purposes, I want to see two explosions... 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).
>

I am still trying to understand how your macro works with the two different -k
clock values-- but if I add an additional 'hollow' keyword at the end of the
union, inside the macro, like this...

....
#else
    sphere { 1E-10, 1E10 }
hollow
#end
} // [end of union]
#end // [end of macro]

.... the first explosion(?) does appear at -k350, and both explosions appear at
-k400

Is this the visual result that you are trying to produce?


Post a reply to this message

From: Kenneth
Subject: Re: Problem with multiple macro calls
Date: 9 Apr 2022 06:00:00
Message: <web.6251583cf8955d554cef624e6e066e29@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
>
> ..if I add an additional 'hollow' keyword at the end of the
> union, inside the macro...the first explosion(?) does appear at -k350, and
> both explosions appear at -k400
>

By the way, I think that this extra hollow requirement is related to the problem
mentioned in a recent thread by Cousin Ricky:

"union disables hollowness"

https://news.povray.org/povray.bugreports/thread/%3C624485e2%241%40news.povray.org%3E/


Post a reply to this message

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