POV-Ray : Newsgroups : povray.advanced-users : trace functiuon help ! Server Time
16 May 2024 06:27:33 EDT (-0400)
  trace functiuon help ! (Message 1 to 5 of 5)  
From: Lightbeam
Subject: trace functiuon help !
Date: 16 Jun 2013 12:28:57
Message: <51bde7c9@news.povray.org>
Hello, I need help using the trace function because it gives me some 
small artifacts in the use I made​​.
I declare an object by a sphere then a loop three dimensions x, y and z 
that will use a trace function to place a cube whenever she meets 
predefined object (thus the sphere), which gives this :

   # declare blocksize = size; // "blocksize" is the cubes dimension
   # declare xx =-width / 2;
   # while (xx <= width / 2)
    # declare zz = (-depth / 2);
    # while (zz <= depth / 2)
     # declare yy = 0;
     # while (yy <= height)
      / / I put a "pixel" (cube here) if detected object
      # declare coord = <xx, yy, zz>;
      # declare departure = <xx+0.01, yy+0.01, zz+0.01>;
      # declare normal = <0.0, 0.0, 0.0>;
      # declare key = trace (ball, coord, depart.gray, normal); // It 
seems like .gray gives better results here...
      # if (touche.gray)
       box {- (blocksize / 2), (blocksize / 2) scale 0.8 translate <xx, 
yy, zz> pigment {rgb 0.8 + (rand (random * zz * 0.2))} finish {ambient 0.0}}
      # end
      # declare yy yy + = blocksize;
      # end
     # declare zz zz + = blocksize;
    # end
    # declare xx = xx + blocksize;
   # end

and produces the image with the sphere which seems to be "pixelated" but 
if I have the misfortune to want to apply this function to a single 
union (two spheres and a cylinder type alters old) that drool a little 
in the way of a blob ... spheres seem to spill over into the cylinder as 
if they melted!

What do you think? How can I fix this?
Thank you for your help.


Post a reply to this message


Attachments:
Download 'image00.jpg' (71 KB) Download 'image01.jpg' (49 KB)

Preview of image 'image00.jpg'
image00.jpg

Preview of image 'image01.jpg'
image01.jpg


 

From: Lightbeam
Subject: Re: trace functiuon help !
Date: 16 Jun 2013 12:31:31
Message: <51bde863$1@news.povray.org>
Opps, I put the images here, sorry :(


Post a reply to this message

From: Christian Froeschlin
Subject: Re: trace functiuon help !
Date: 16 Jun 2013 20:39:59
Message: <51be5adf$1@news.povray.org>
I'm not quite sure what you are testing, because touche.gray
is not one of the variables you are actually using in trace.
I assume that is a copy and post issue.

But, you may be misunderstanding the direction
("departure") vector and the trace result.

1. This is not a line segment intersection test. The length
is irrelevant. If it hits anything in the direction it points
to it will return something. So you should paint the boxes where
the surface is hit (trace result), not at the coordinate you
start out testing.

2. As it is a direction you do not need to define the vector
relative to the coordinate. If you want it to point 45° away
you use <1,1,1>. If you want it to point inward to the origin
you could use -<xx,yy,zz>.


Post a reply to this message

From: Lightbeam
Subject: Re: trace functiuon help !
Date: 17 Jun 2013 09:54:12
Message: <51bf1504@news.povray.org>
Le 17/06/2013 02:39, Christian Froeschlin a écrit :
> I'm not quite sure what you are testing, because touche.gray
> is not one of the variables you are actually using in trace.
> I assume that is a copy and post issue.
>
> But, you may be misunderstanding the direction
> ("departure") vector and the trace result.
>
> 1. This is not a line segment intersection test. The length
> is irrelevant. If it hits anything in the direction it points
> to it will return something. So you should paint the boxes where
> the surface is hit (trace result), not at the coordinate you
> start out testing.
>
> 2. As it is a direction you do not need to define the vector
> relative to the coordinate. If you want it to point 45° away
> you use <1,1,1>. If you want it to point inward to the origin
> you could use -<xx,yy,zz>.
>

Ok, I'll try, thank you.


Post a reply to this message

From: Bald Eagle
Subject: Re: trace functiuon help !
Date: 27 Aug 2013 20:00:01
Message: <web.521d3ce4aa8ef02cbcfd532f0@news.povray.org>
See if this helps any.

http://news.povray.org/web.51f61e827603294573fc9ebb0%40news.povray.org


Post a reply to this message

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