Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cmcl2!rna!dan From: dan@rna.UUCP (Dan Ts'o) Newsgroups: comp.graphics Subject: Re: DBW_render for SUN 3 ????? Summary: modified for 8-bit pixels Message-ID: <631@rna.UUCP> Date: 8 Jun 89 05:32:00 GMT References: <93@unmvax.unm.edu> <62500002@uicbert.eecs.uic.edu> <9029@xanth.cs.odu.edu> Organization: Rockefeller University - Neurobiology Lines: 63 In article <9029@xanth.cs.odu.edu>, writes: > daniel@unmvax.unm.edu writes: > >Has anyone converted the public domain ray trace program called DBW_render > >to run on a SUN workstation? > > Ofer Licht has done just that. His > modified DBW_Render is available via anonymous ftp from > xanth.cs.odu.edu as /amiga/dbw.zoo. I picked this program up and started playing with it. I don't claim to know much about it. However, it seemed designed for the Amiga (obviously) and only wanted to output 4bits per color. I decided I wanted a full 8-bits and started to probe into it. I don't know if the calculations are performed to at least 8 bit accuracy, although I'd be surprised if they weren't, so I just arranged to dump out more bits per color per pixel. In ray.h: #define BPP 4 /* Bits per pixel */ should be changed to #define BPP 8 /* Bits per pixel */ Unfortunately, this was not enough. It seems that some code in main() also assumes 4bits/color: In ray.c, line 458: modulo = (((modulo >> 2) + 1) % PPW) << 2; should be changed to something like i = 8 * sizeof (short); modulo = (modulo + (i/PPW))%i; Unfortunately, the code also seems to use 0xFF (decimal 255) as a marker for unknown pixels. But MAXGRAY-1 at 8bits is now also 255. The proper change would be to choose another marker such as 32768 (or eliminate markers). I punted and set MAXGRAY-1 to be 254: In ray.c, line 294: d_maxgray = (float) MAXGRAY; was changed to if (MAXGRAY == (0xFF + 1)) d_maxgray = (float) (MAXGRAY - 1); else d_maxgray = (float) MAXGRAY; Now it seems to produce 8-bit/color. Of course the format of the output file *.tmp is now different, having twice as many bytes. The difference in image quality is apparent, even on 8-bit FB's (not 24bit FB's) with dithering such that each color only gets 6 values. Must be the extra info to dither with. Cheers, Dan Ts'o 212-570-7671 Dept. Neurobiology dan@rna.rockefeller.edu Rockefeller Univ. ...cmcl2!rna!dan 1230 York Ave. rna!dan@nyu.edu NY, NY 10021 tso@rockefeller.arpa tso@rockvax.bitnet