POV-Ray : Newsgroups : povray.general : Trce in superpatch Server Time
2 Nov 2024 11:24:12 EDT (-0400)
  Trce in superpatch (Message 1 to 8 of 8)  
From: Mick Hazelgrove
Subject: Trce in superpatch
Date: 6 Apr 1999 14:04:02
Message: <370a3e82.0@news.povray.org>
Hi All

when I run the following code not only do I get 100 spheres but as the code
loops it also draws the slab a hundred times or so.
Can anyone suggest a way of using trace in a way that the object is only
drawn once? Otherwise the memory hit with high samples is horrendous!

Mick

===================================================

#version 3.1;//Superpatch

#include "colors.inc"

// ----------------------------------------
camera
{
  location  <0.0, 10, -20.0>
  direction 1.5*z
  right     4/3*x
  look_at   <0.0, 0.0,  0.0>
}

sky_sphere
{
  pigment
  {
    gradient y
    color_map { [0.0 color blue 0.6] [1.0 color rgb 1] }
  }
}

light_source{<-30, 30, -30>,color rgb<1,1,1>}

// ----------------------------------------

#declare Step2 = box{<-2, 0, -2>< 2,  .4,  2> pigment{Yellow}}

#declare Norm = <0,0,0>;
#declare Xpos = -5;
#declare Zpos = 5;


#while (Xpos<6)

   #while (Zpos>-6)

        #declare SPos = <Xpos,1,Zpos>;

        #declare Inter = trace (Step2,SPos,<0,0,0>-SPos, Norm );

                object{Step2 texture {pigment{color rgb<1,1,0>}}}
                        #if (Norm.x != 0 | Norm.y != 0 | Norm.z != 0)
                                sphere{Inter,.1 texture{pigment{color red
1}}}
                        #end
    #declare Zpos = Zpos -1;
    #end
    #declare Zpos = 5;
  #declare Xpos = Xpos +1;

#end


Post a reply to this message

From: Ron Parker
Subject: Re: Trce in superpatch
Date: 6 Apr 1999 14:20:36
Message: <370a4264.0@news.povray.org>
On Tue, 6 Apr 1999 17:50:18 +0100, Mick Hazelgrove wrote:
>Hi All
>
>when I run the following code not only do I get 100 spheres but as the code
>loops it also draws the slab a hundred times or so.
>Can anyone suggest a way of using trace in a way that the object is only
>drawn once? Otherwise the memory hit with high samples is horrendous!

Could you just move the "object {step2..." line outside the while loop?


Post a reply to this message

From: Mick Hazelgrove
Subject: Re: Trce in superpatch
Date: 6 Apr 1999 14:36:02
Message: <370a4602.0@news.povray.org>
Thanks Ron

That does it

Now how can I use trace to test the height of a HF... Hmmmm


Mick


Ron Parker <par### [at] my-dejanewscom> wrote in message
news:370a4264.0@news.povray.org...
> On Tue, 6 Apr 1999 17:50:18 +0100, Mick Hazelgrove wrote:
> >Hi All
> >
> >when I run the following code not only do I get 100 spheres but as the
code
> >loops it also draws the slab a hundred times or so.
> >Can anyone suggest a way of using trace in a way that the object is only
> >drawn once? Otherwise the memory hit with high samples is horrendous!
>
> Could you just move the "object {step2..." line outside the while loop?


Post a reply to this message

From: Juha Leppälä
Subject: Re: Trce in superpatch
Date: 6 Apr 1999 17:10:09
Message: <370A6A36.F738CC88@kolumbus.fi>
Mick Hazelgrove wrote:
> 
> Thanks Ron
> 
> That does it
> 
> Now how can I use trace to test the height of a HF... Hmmmm
> 
> Mick

It's quite simple actually

#declare your heigtfield (eg. #declare HF=heightfield{...})
#declare the maximum height of the heightfield (#declare MaxHeight=(the
y-scale of the hf + 1)
then when you want to know the heigth at point (x,z)
just trace(HF,<x,MaxHeight,z>,<0,-1,0>)

I did this straight from my memory so there might be some errors but
hopefully you get the main idea



Post a reply to this message

From: Margus Ramst
Subject: Re: Trce in superpatch
Date: 6 Apr 1999 20:14:18
Message: <370a954a.0@news.povray.org>
Why not simply trace from below, e.g. trace(HF,<Px,-1,Pz>,y)

Margus


>
>It's quite simple actually
>
>#declare your heigtfield (eg. #declare HF=heightfield{...})
>#declare the maximum height of the heightfield (#declare MaxHeight=(the
>y-scale of the hf + 1)
>then when you want to know the heigth at point (x,z)
>just trace(HF,<x,MaxHeight,z>,<0,-1,0>)
>
>I did this straight from my memory so there might be some errors but
>hopefully you get the main idea
>


Post a reply to this message

From: Matthias
Subject: Re: Trce in superpatch; trace????
Date: 14 Apr 1999 16:56:33
Message: <3714f2f1.0@news.povray.org>
Mick Hazelgrove <mha### [at] mindaswinternetcouk> schrieb in im Newsbeitrag:
370a3e82.0@news.povray.org...
> Hi All
>
> when I run the following code not only do I get 100 spheres but as the
code
> loops it also draws the slab a hundred times or so.
> Can anyone suggest a way of using trace in a way that the object is only
> drawn once? Otherwise the memory hit with high samples is horrendous!
>
> Mick
>
> ===================================================
>
> #version 3.1;//Superpatch
>
> #include "colors.inc"
>
> // ----------------------------------------
> camera
> {
>   location  <0.0, 10, -20.0>
>   direction 1.5*z
>   right     4/3*x
>   look_at   <0.0, 0.0,  0.0>
> }
>
> sky_sphere
> {
>   pigment
>   {
>     gradient y
>     color_map { [0.0 color blue 0.6] [1.0 color rgb 1] }
>   }
> }
>
> light_source{<-30, 30, -30>,color rgb<1,1,1>}
>
> // ----------------------------------------
>
> #declare Step2 = box{<-2, 0, -2>< 2,  .4,  2> pigment{Yellow}}
>
> #declare Norm = <0,0,0>;
> #declare Xpos = -5;
> #declare Zpos = 5;
>
>
> #while (Xpos<6)
>
>    #while (Zpos>-6)
>
>         #declare SPos = <Xpos,1,Zpos>;
>
>         #declare Inter = trace (Step2,SPos,<0,0,0>-SPos, Norm );
>
>                 object{Step2 texture {pigment{color rgb<1,1,0>}}}
>                         #if (Norm.x != 0 | Norm.y != 0 | Norm.z != 0)
>                                 sphere{Inter,.1 texture{pigment{color red
> 1}}}
>                         #end
>     #declare Zpos = Zpos -1;
>     #end
>     #declare Zpos = 5;
>   #declare Xpos = Xpos +1;
>
> #end
>
>

looks like a macro defined somewhere else!

Hm would be nice if you could make me wiser!
Smarf


Post a reply to this message

From: Ron Parker
Subject: Re: Trce in superpatch; trace????
Date: 14 Apr 1999 18:13:14
Message: <371504ea.0@news.povray.org>
On Wed, 14 Apr 1999 21:55:15 +0200, Matthias <sma### [at] t-onlinede> wrote:

>looks like a macro defined somewhere else!

>Hm would be nice if you could make me wiser!

Trace isn't a macro, it's a function that exists only in the Superpatch,
available at http://twysted.net/patchstation .  It is used to find the
intersection of an arbitrary ray with an arbitrary object and is useful
for such things as placing objects on height fields or growing creeping
ivy in POV scripts.


Post a reply to this message

From: Mick Hazelgrove
Subject: Re: Trce in superpatch; trace????
Date: 15 Apr 1999 04:28:31
Message: <3715951f.0@news.povray.org>
Hi

There you go - I couldn't of put it better if I'd written the superpatch:)

Mick

Matthias <sma### [at] t-onlinede> wrote:

> >looks like a macro defined somewhere else!

> >Hm would be nice if you could make me wiser!
>
> Trace isn't a macro, it's a function that exists only in the Superpatch,
> available at http://twysted.net/patchstation .  It is used to find the
> intersection of an arbitrary ray with an arbitrary object and is useful
> for such things as placing objects on height fields or growing creeping
> ivy in POV scripts.


Post a reply to this message

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