POV-Ray : Newsgroups : povray.programming : Source Code again ! Server Time
28 Jul 2024 16:24:31 EDT (-0400)
  Source Code again ! (Message 1 to 8 of 8)  
From: Mathias
Subject: Source Code again !
Date: 29 Aug 2000 06:02:52
Message: <39ab8a4c@news.povray.org>
I have to find out how POV Ray calculate a ray. E.G. If i have a box or an
other object and i give them a light source: How can i find out what parts
of the C-Files are in use to calculate this process ? How reflect the
program this ray ? If u have any ideas how to start this difficult task
please write back..... Thanxs so far.

Mathias


Post a reply to this message

From: Thomas Willhalm
Subject: Re: Source Code again !
Date: 29 Aug 2000 08:17:15
Message: <qqm66okz2gk.fsf@schlatt.fmi.uni-konstanz.de>
"Mathias" <Mat### [at] dlrde> writes:

> I have to find out how POV Ray calculate a ray. E.G. If i have a box or an
> other object and i give them a light source: How can i find out what parts
> of the C-Files are in use to calculate this process ? How reflect the
> program this ray ? If u have any ideas how to start this difficult task

The routine that calculates the intersection of a box and a ray is 
Intersect_Box in boxes.c. For most POV objects there exists a c file that
contains the functions for this object type. If you don't have any clue
where to look, "grep" can help you:

grep -i box * | grep -i intersect

This command outputs all lines that contain "box" and "intersect" (ignoring
the lower and upper case). If you don't have grep or a equivalent program,
install one. Similarly to the above, the command

grep -i reflect * | grep -i ray

gives us the hint to look at the file "lighting.c" where we find the 
function Reflect.

You probably already remarked that the calculation of a ray is distributed
over a lot of files. This is understandable, if you keep in mind how many
features the calculation of a ray might include (pigments, normals, object
types, reflection, refraction, media,...)

I hope this helps.
Thomas

-- 
http://www.thomas.willhalm.de/ (includes pgp key)


Post a reply to this message

From: Warp
Subject: Re: Source Code again !
Date: 29 Aug 2000 12:06:17
Message: <39abdf79@news.povray.org>
Mathias <Mat### [at] dlrde> wrote:
: I have to find out how POV Ray calculate a ray. E.G. If i have a box or an
: other object and i give them a light source: How can i find out what parts
: of the C-Files are in use to calculate this process ? How reflect the
: program this ray ? If u have any ideas how to start this difficult task
: please write back..... Thanxs so far.

  Somehow I got the impression that perhaps you haven't understood how
povray raytraces a scene. I may very well be mistaken, but do you think
that povray shoots rays from the light sources towards the objects and
then bounces them from the objects to the camera?
  If not, then just forget this question :)

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Mark Gordon
Subject: Re: Source Code again !
Date: 29 Aug 2000 19:53:16
Message: <39AC4DDC.4C7F1433@mailbag.com>
Thomas Willhalm wrote:

> If you don't have any clue where to look, "grep" can help you:

Assuming Mathias has grep...

-Mark "Got grep?" Gordon


Post a reply to this message

From: Mathias
Subject: Re: Source Code again !
Date: 30 Aug 2000 03:01:36
Message: <39acb150$1@news.povray.org>
Then please tell me how povray raytraces a scene ? I dont know it.......

Mathias


"Warp" <war### [at] tagpovrayorg> schrieb im Newsbeitrag
news:39abdf79@news.povray.org...
> Mathias <Mat### [at] dlrde> wrote:
> : I have to find out how POV Ray calculate a ray. E.G. If i have a box or
an
> : other object and i give them a light source: How can i find out what
parts
> : of the C-Files are in use to calculate this process ? How reflect the
> : program this ray ? If u have any ideas how to start this difficult task
> : please write back..... Thanxs so far.
>
>   Somehow I got the impression that perhaps you haven't understood how
> povray raytraces a scene. I may very well be mistaken, but do you think
> that povray shoots rays from the light sources towards the objects and
> then bounces them from the objects to the camera?
>   If not, then just forget this question :)
>
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Thomas Willhalm
Subject: Re: Source Code again !
Date: 30 Aug 2000 04:12:46
Message: <qqmwvgznp4x.fsf@schlatt.fmi.uni-konstanz.de>
Mark Gordon <mtg### [at] mailbagcom> writes:

> Thomas Willhalm wrote:
> 
> > If you don't have any clue where to look, "grep" can help you:
> 
> Assuming Mathias has grep...

You are right: I should have looked whether he uses Windows (he does) and
provide a link like http://web.pncl.co.uk/~huw/grep/ . 

Thomas

-- 
http://www.thomas.willhalm.de/ (includes pgp key)


Post a reply to this message

From: Thomas Willhalm
Subject: Re: Source Code again !
Date: 30 Aug 2000 04:21:30
Message: <qqmsnrnnoqd.fsf@schlatt.fmi.uni-konstanz.de>
"Mathias" <Mat### [at] dlrde> writes:
> "Warp" <war### [at] tagpovrayorg> schrieb im Newsbeitrag
> >
> >   Somehow I got the impression that perhaps you haven't understood how
> > povray raytraces a scene. I may very well be mistaken, but do you think
> > that povray shoots rays from the light sources towards the objects and
> > then bounces them from the objects to the camera?
> >   If not, then just forget this question :)
>
> Then please tell me how povray raytraces a scene ? I dont know it.......

This is a question for the master of links...

As for hardcopies I have a (German) reference where (among other things)
the principles of raytracing are explained:

T. Rauber
Algorithmen in der Computergrafik
Teubner Verlag, Stuttgart
ISBN 3-519-02127-7

Thomas

-- 
http://www.thomas.willhalm.de/ (includes pgp key)


Post a reply to this message

From: Chris Huff
Subject: Re: Source Code again !
Date: 30 Aug 2000 18:40:35
Message: <chrishuff-E99EE5.17420930082000@news.povray.org>
In article <39acb150$1@news.povray.org>, "Mathias" 
<Mat### [at] dlrde> wrote:

> Then please tell me how povray raytraces a scene ? I dont know it.......

Hmm, I will try my best...at the most basic level, a raytracer works 
this way:

For each pixel, it determines the direction and starting point of a line 
going from that pixel to the portion of the scene visible from that 
pixel. This is a "ray", an infinite line with a starting point and 
direction. It then tests the ray against all the objects in the scene, 
finding all(or a large number of) of the intersections it makes with 
object surfaces. It usually does this by solving an equation. The 
closest intersection found is taken as the first one, and the color of 
the texture at that point is calculated.

To calculate reflections, it then determines a new direction for the 
ray, based on the surface normal at the intersection point, and sets the 
origin to the intersection point. It then "traces the ray" again, much 
like the first ray, to get the contribution reflection makes to the 
color of the surface. Refraction is done similarly, except the ior value 
is also taken into account and a different calculation is used for 
getting the new ray direction. Lighting is done by tracing a ray toward 
a light source, and calculating the effect of transparent objects 
between the object and light source on the light, or producing a shadow 
if an opaque object is encountered.

Most raytracers use recursion, and go several levels deep into the 
scene, so a ray can reflect or refract several times before stopping. In 
POV, the maximum level is controlled by the max_trace_level keyword in 
global_settings.

The exact way POV does things is much more complex, and follows a pretty 
convoluted path through several source files, depending on the exact 
features used and the portion of the scene currently being calculated, 
and unfortunately, there is very little documentation on the source code.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

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