POV-Ray : Newsgroups : povray.general : Trace(): help required Server Time
25 Dec 2024 13:46:12 EST (-0500)
  Trace(): help required (Message 1 to 10 of 20)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Sven Littkowski
Subject: Trace(): help required
Date: 18 May 2006 15:52:36
Message: <446cd084@news.povray.org>
Greetings.

I was reading about the Trace() feature inside the POV-Ray documentation, 
but to be honest, I just cannot work it out. Who can help me understanding 
it entirely? There are so many YXZ coordinates.

Maybe a small very simple sample scene could help me, with some truly 
explaining words.

Thanks,

Sven


Post a reply to this message

From: Warp
Subject: Re: Trace(): help required
Date: 18 May 2006 16:17:42
Message: <446cd665@news.povray.org>
Sven Littkowski <sve### [at] jamaica-focuscom> wrote:
> Maybe a small very simple sample scene could help me, with some truly 
> explaining words.

// Declare an object you want to trace:
#declare AnObject =
  torus { 1, .5 pigment { rgb x } finish { specular .5 } };

// Let's "drop" cylinders on this object from above.
// First let's define the area inside which to "drop" cylinders
// (this covers the entire torus above viewed from above):
#declare MinX = -1.5;
#declare MaxX = 1.5;
#declare MinZ = -1.5;
#declare MaxZ = 1.5;
#declare DropHeight = 2;
#declare CylinderRadius = .015;
#declare NormalScale = .1;

// Now let's loop through all that area using regular steps:
#declare Normal = <0,0,0>;
#declare Step = .1;
#declare IndX = MinX;
#while(IndX <= MaxX)
  #declare IndZ = MinZ;
  #while(IndZ <= MaxZ)

    // Now let's "drop" a cylinder onto the torus:
    #declare Intersection =
      trace(AnObject, <IndX, DropHeight, IndZ>, -y, Normal);
    // The first parameter is the object to trace (ie. our torus).
    // The second parameter is the starting point for the trace
    // (like the point from which we "drop" our cylinder).
    // The third parameter is the direction towards which we trace
    // (ie. the direction towards which we "drop" the cyliner)
    // The last parameter is the normal vector at the intersection point
    // (this has two uses, as seen below).

    // Now, a normal vector <0,0,0> is invalid and thus trace() uses that
    // value to indicate that it did not intersect the object at all.
    // Thus we have to check that it is not <0,0,0> before we crate the
    // cylinder:
    #if(vlength(Normal) > 0)
      // Now we can create the cylinder at the intersection point.
      // To keep things interesting, let's orientate the cylinder in
      // the direction of the normal vector:
      cylinder
      { Intersection, Intersection+Normal*NormalScale, CylinderRadius
        pigment { rgb y }
        finish { specular .5 }
      }
    #end

    #declare IndZ = IndZ + Step;
  #end
  #declare IndX = IndX + Step;
#end


camera { location <0, 5, -5> look_at 0 angle 35 }
light_source { <100, 200, 0>, 1 }
object { AnObject }


Post a reply to this message

From: Mr Seb
Subject: Re: Trace(): help required
Date: 18 May 2006 16:20:47
Message: <446cd71f@news.povray.org>
An easy example :

you have an object, called Object...and you want to put another object at
the top of it, at the vertical of a <X,?,Z> point.
You can call it :

#declare coord=trace (Object,<X,100000,Z>,<0,-1,0>)

<X,1000,Z> is a point at the vertical of your object (take 100000 as high as
you wish, it must be higher than the heigh of your object)
<0,-1,0> is the down direction.
So Trace will shoot a ray from <X,10000,Y> downside and look if it hits your
object. If it does, it returns the intersection point. This point is the
coord where you want to put your new object.

For the 4 vectors version :
use as follows :
#declare coord=trace(Object,<X,100000,Z>,<0,-1,0>,norm)
it returns in coord the same vector than in the first example. It also
return the normal vector at this point in "norm"


Post a reply to this message

From: Sven Littkowski
Subject: Re: Trace(): help required
Date: 18 May 2006 20:39:59
Message: <446d13df$1@news.povray.org>
Hi Seb,

many thanks and my appreciation for your answer. I understand now the 3 
vectors version.

But what is a 4 vectors version? What is the NORM doing and about?

Sven



"Mr Seb" <ban### [at] wanadoofr> schrieb im Newsbeitrag 
news:446cd71f@news.povray.org...
> For the 4 vectors version :
> use as follows :
> #declare coord=trace(Object,<X,100000,Z>,<0,-1,0>,norm)
> it returns in coord the same vector than in the first example. It also
> return the normal vector at this point in "norm"
>
>


Post a reply to this message

From: Sven Littkowski
Subject: Re: Trace(): help required
Date: 18 May 2006 20:41:43
Message: <446d1447$1@news.povray.org>
Thanks for your answer, Wrap.

I rendered your example but just get the torus. But nevertheless, with your 
help and the help of Seb I do now understand a bit more of that trace 
feature. Still not very sure about it. I have to make some tests now.

Thanks a lot!

Sven


Post a reply to this message

From: Warp
Subject: Re: Trace(): help required
Date: 18 May 2006 21:15:09
Message: <446d1c1c@news.povray.org>
Sven Littkowski <sve### [at] jamaica-focuscom> wrote:
> I rendered your example but just get the torus.

  I can't even begin to fathom how that is possible.

-- 
                                                          - Warp


Post a reply to this message

From: Sven Littkowski
Subject: Re: Trace(): help required
Date: 18 May 2006 22:39:03
Message: <446d2fc7$1@news.povray.org>
Hi Warp,

hmm, not sure how to work your "comment" out...   :-)

Let me just give you the scene as I got it from you. Remember, I am an 
absolute beginner if it comes to the trace function.

Best greetings,

Sven


"Warp" <war### [at] tagpovrayorg> schrieb im Newsbeitrag 
news:446d1c1c@news.povray.org...
> Sven Littkowski <sve### [at] jamaica-focuscom> wrote:
>> I rendered your example but just get the torus.
>
>  I can't even begin to fathom how that is possible.
>
> -- 
>                                                          - Warp


#version 3.5;

// Declare an object you want to trace:
#declare AnObject = torus
{
 1.0, 0.5
 pigment { rgb x }
 finish { specular 0.5 }
}

// Let's "drop" cylinders on this object from above.
// First let's define the area inside which to "drop" cylinders
// (this covers the entire torus above viewed from above):
#declare MinX = -1.5;
#declare MaxX = 1.5;
#declare MinZ = -1.5;
#declare MaxZ = 1.5;
#declare DropHeight = 2;
#declare CylinderRadius = .015;
#declare NormalScale = .1;

// Now let's loop through all that area using regular steps:
#declare Normal = < 0.0, 0.0, 0.0 >;
#declare Step = 0.1;
#declare IndX = MinX;

#while(IndX <= MaxX)
 #declare IndZ = MinZ;
 #while(IndZ <= MaxZ)

  // Now let's "drop" a cylinder onto the torus:
  #declare Intersection = trace(AnObject < IndX, DropHeight, IndZ > -y, 
Normal);
  // The first parameter is the object to trace (ie. our torus).
  // The second parameter is the starting point for the trace
  // (like the point from which we "drop" our cylinder).
  // The third parameter is the direction towards which we trace
  // (ie. the direction towards which we "drop" the cyliner)
  // The last parameter is the normal vector at the intersection point
  // (this has two uses, as seen below).

  // Now, a normal vector <0,0,0> is invalid and thus trace() uses that
  // value to indicate that it did not intersect the object at all.
  // Thus we have to check that it is not <0,0,0> before we crate the
  // cylinder:
  #if(vlength(Normal) > 0)
   // Now we can create the cylinder at the intersection point.
   // To keep things interesting, let's orientate the cylinder in
   // the direction of the normal vector:
   cylinder
   {
    Intersection, Intersection+Normal*NormalScale, CylinderRadius
    pigment { rgb y }
    finish { specular .5 }
   }
  #end

  #declare IndZ = IndZ + Step;
 #end
 #declare IndX = IndX + Step;
#end


camera { location < 0.0, 5.0, -5.0 > look_at 0.0 angle 35 }

light_source { <100.0, 200.0, 0>, 1.0 }

object { AnObject }


Post a reply to this message

From: POVMAN
Subject: Re: Trace(): help required
Date: 19 May 2006 05:00:14
Message: <446d891e$1@news.povray.org>
> But what is a 4 vectors version? What is the NORM doing and about?
>
> Sven

The NORM is a Vector that represents the angle at which the ray being used 
in the trace function hits the object.

-- 
#####-----#####-----#####
POV Tips and Hints at ...
http://povman.blogspot.com/


Post a reply to this message

From: Warp
Subject: Re: Trace(): help required
Date: 19 May 2006 05:18:39
Message: <446d8d6d@news.povray.org>
Sven Littkowski <sve### [at] jamaica-focuscom> wrote:
> hmm, not sure how to work your "comment" out...   :-)

  It means: I don't understand how it is possible that you are getting
just a torus. The scene creates a big bunch of cylinders besides the
torus so I cannot understand how it is possible.
  Which version of POV-Ray are you using?

> Let me just give you the scene as I got it from you. Remember, I am an 
> absolute beginner if it comes to the trace function.

> #version 3.5;

  This wasn't in my scene.

>   #declare Intersection = trace(AnObject < IndX, DropHeight, IndZ > -y, 

  There are missing commas there. Why did you remove them?

-- 
                                                          - Warp


Post a reply to this message

From: Sven Littkowski
Subject: Re: Trace(): help required
Date: 19 May 2006 06:36:44
Message: <446d9fbc$1@news.povray.org>
Warp,

I am in shame! My life lost any sense, and my soul is now condemned for 
10,000 eons! You was right, actually!

I have a habit: whe ever I see the source code of scenes written by others, 
I at first transform it into my own way of writing (setting spaces aka 
blanks, just a kind of re-formatting). Now, what happened: I changed the 
formatting, and - you are so right - I removed commas. I usually don't use 
commas often, but made the experience that this was not giving any trouble. 
But here, it was leading to a somewhat different interpretion of the scene! 
Not an error message, just a scene without cylinders (which is, as a result, 
quite interesting).

I use for extensive testing the beta 12a version of POV-Ray.

I just replaced my formatting with your original, and it works! Sorry again, 
Warp. And also: deep thanks for having taken so much time and good intention 
to help! Please go on with that!   :-)

Greetings,

Sven


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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