[net.graphics] Ray Trace problems

sdh@joevax.UUCP (The Doctor) (07/30/86)

The ray tracer as posted dumps after doing 37.6% of the task,
returning the error: floating point exception.

There were no compile time errors.

Question: is the resolution of the output supposed to 450 x 450,
and are the pixels supposed to be non-square?
I plotted the data on a macintosh(square pixels) using a routine to
simulate gray level.  What it displayed looked like a grid on an angle
with one squashed sphere.

If there is interest, I will post the routines to convert the files from
256 level gray to 2 level.

Steve Hawley
joevax!sdh

blm@cxsea.UUCP (Brian Matthews) (08/03/86)

In article <220@joevax.UUCP> sdh@joevax.UUCP (The Doctor) writes:
|The ray tracer as posted dumps after doing 37.6% of the task,
|returning the error: floating point exception.

You might want to try commenting out the modification of vect->xzl in the
routine scamult in support.c. According to the author, this has given some
people problems, and xzl isn't used anywhere. I didn't have any problems
with the posted data, but when I moved the balls around, it died until I
removed the offending statement. It then generated some very nice output.

|Question: is the resolution of the output supposed to 450 x 450,
|and are the pixels supposed to be non-square?

The pixels are square, and the resolution is 451 x 451. Although it looks
like it goes from 100 to 250 by 1/3, .33333 etc. isn't quite 1/3, so there's
one extra pixel per line, and one extra line. Note that if you change INC in
tracer.c, it will change the resolution.

-- 

Brian L. Matthews
Computer X Inc. - a division of Motorola New Enterprises
..{utcsri!utzoo!mnetor, uw-beaver!ssc-vax}!cxsea!blm
+1 206 251 6811

liam@cs.qmc.ac.uk (William Roberts) (08/07/86)

Expires:
Sender:
Xpath: ukc eagle

In article <220@joevax.UUCP> sdh@joevax.UUCP writes:
>Question: is the resolution of the output supposed to 450 x 450,
>and are the pixels supposed to be non-square?
>I plotted the data on a macintosh(square pixels) using a routine to
>simulate gray level.  What it displayed looked like a grid on an angle
>with one squashed sphere.

The pixels are supposed to be square, but the image is actually
451 x 451 and not 450 x 450 as advertised.  Using 450 pixels
per row causes the image to appear slanted, as you say.

Q: Why 451 and not 450?
A: Look at the code (in tracer.c):

#define XMIN 100.0
#define XMAX 250.0
#define YMIN 30.0
#define YMAX 180.0
#define INC  0.333333333333

main () {
    static float    xco,
                    yco;

    for (xco = XMIN; xco < XMAX; xco += INC) {
        for (yco = YMIN; yco < YMAX; yco += INC) {

           /* generate a pixel */
        }
}

INC is actually LESS than 1/3, so even if you dont lose
precision on the repeated addition, 450 * INC is going to be
to be less than 150.  Change this to read

#define INC  0.333333333334

or calculate xco and yco from an integer pixel coordinate if
you really want 450 x 450 images.


The result is very nice - it took 6:37 minutes on our VAX 11/750
and a mere 38 minutes on our Sequent Balance 8000.
-- 

William Roberts         ARPA: liam@cs.qmc.ac.uk  (gw: cs.ucl.edu)
Queen Mary College      UUCP: liam@qmc-cs.UUCP
LONDON, UK              Tel:  01-980 4811 ext 3900