POV-Ray : Newsgroups : povray.newusers : Shoot a ray at a mesh : Re: Shoot a ray at a mesh Server Time
28 Jul 2024 16:15:35 EDT (-0400)
  Re: Shoot a ray at a mesh  
From: Kenneth
Date: 7 Jun 2008 23:15:00
Message: <web.484b4a43784caf0d78dcad930@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:

>
> Yes probably. I just adapted the example from the help. I assumed from his
> question that Dave would know the particular point that he wanted to shoot
> the ray from and the direction he wanted to shoot it in.
>

Ah yes, I see what you mean.  It does make sense, when tracing a sphere.

I do feel sorry for new users trying to make sense of the trace operation, given
the short and somewhat perfunctory explanation of it. It's such a powerful
feature of POV-Ray! But some of the documentation just isn't as clear as it
should be.

For example, although the docs state--in a roundabout way--that the
optional 4th parameter (the found 'normal' at the object's surface) has to have
it's vector pre-#declared before it can be used in the trace operation, and
gives <0,0,0> as an example, in fact it can be any arbitrary vector
value...like <26,-38,1.0046>. It's only a 'place-holder' which will be filled
with REAL values as soon as trace shoots a ray at the object surface. SO...
trace can actually return TWO values, the intersection point and the normal at
that point...both vectors, and both requiring a #declare. Another item of
confusion: Somewhere above the trace explanation, it says, "The following are
the functions which return vector values."  The important word being RETURN.
But there are other functions following trace that actually DON'T return any
value (vnormalize being one.) Pity the poor new user trying to understand all
of this!

Speaking of vnormalize: The 'normal' vector found at the surface during a trace
is automatically 'normalized' to be one unit in length.  This is how the trace
example uses it to make a cylinder sticking out from the surface of the sphere.

Ken W.


Post a reply to this message

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