File: render.l

package info (click to toggle)
raster3d 3.0-8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,952 kB
  • sloc: fortran: 9,536; ansic: 1,063; makefile: 315; sh: 272; csh: 1
file content (362 lines) | stat: -rw-r--r-- 11,497 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
.ad l
.nh
.TH RENDER 1 "14 December 2010" "Raster3D V3.0"
.SH NAME
render - Raster3D molecular graphics package rendering program
.SH SYNOPSIS
.B "render"  < infile.r3d > outfile.png

.B "render"  -png < infile.r3d > outfile.png

.B "render"  -avs < infile.r3d > outfile.avs

.B "render"  [\fI-quality NN\fP] -jpeg < infile.r3d > outfile.jpeg

.B "render"   -tiff outfile.tiff < infile.r3d

.B "render"   -sgi "[outfile.rgb]" < infile.r3d

.PP
\fIRender\fP reads an ascii file consisting of several header lines
followed by individual object descriptors.
The objects are rendered using a fast Z-buffer algorithm to produce
a high quality pixel image which contains one light source,
additional non-shadowing light sources,
specular highlighting, transparency, and Phong shaded surfaces.
Output is to stdout [or optional file] in the form of a pixel image
with 24 bits of color information per pixel.
The default output format is PNG.

.SH OPTIONS
.TP 5
.B "-aa"

Force anti-aliasing (SCHEME 4)

.TP 5
.B "-alpha"

Force output of transparency information (SCHEME 0). This only works
if the output image format supports an alpha channel (AVS, TIFF, but
not JPEG). Note that this turns off anti-aliasing.

.TP 5
.B "-avs [outfile.avs]"

By default \fIrender\fP will produce an PNG image on stdout.
The -avs flag will cause it to output an AVS image file instead, or
stream the output to stdout if no file is specified.

.TP 5
.B "-bg white|black|#RRGGBB"

Set background color. #RRGGBB is a hexadecimal number representing
the red, green and blue components.

.TP 5
.B "-draft"

Turn off anti-aliasing (SCHEME 1) to increase rendering speed.

.TP 5
.B "-fontscale"

Only meaningful in conjunction with the -labels option.
Modifies the interpretation of font sizes during label processing.
Defaults to -fontscale 3.0, which will generate images whose
labels are at the correct nominal font size when printed at 300 dpi.
For images to be viewed on the screen, you probably want to set
-fontscale 1.

.TP 5
.B "-gamma GG"

Apply gamma correction to output image.

.TP 5
.B "-help"

Prints a short summary of command line options.

.TP 5
.B "-invert"

Invert image top-to-bottom. This may be necessary if you are using
some odd viewing program.

.TP 5
.B "-jpeg [outfile.jpeg]"

By default \fIrender\fP will produce an PNG image on stdout.
The -jpeg flag will cause it to output a JPEG image file instead, or
stream the output to stdout if no file is specified.

.TP 5
.B "-labels"

Process labels (object types 10, 11, 12) and include them in the
rendered image.

.TP 5
.B "-png [outfile.png]"

This is now the default output format.
The -png flag will stream the output to stdout if no file is specified.

.TP 5
.B "-quality"

Only meaningful in conjunction with -jpeg option; sets the
quality (compression level) of the output image.
Allowable values 1 - 100 (default 90).

.TP 5
.B "-[no]shadow"

Turn shadowing on or off.

.TP 5
.B "-size HHHxVVV"

Override the image size parameters (NTX,NTY,NPX,NPY) in file header
and produce an output image that is exactly HHH pixels in the
horizontal and VVV pixels in the vertical.

.TP 5
.B "-sgi [filename.rgb]"

Only if compiled with -DLIBIMAGE_SUPPORT.
The -sgi flag will cause render to output an SGI libimage style *.rgb file
instead of writing to stdout.
The filename defaults to render.rgb, but specifying a file
on the command line will override this default.

.TP 5
.B "-tiff filename"

Only if compiled with -DTIFF_SUPPORT.
The -tiff flag will cause render to output a TIFF image to the specified
file instead of writing to stdout.

.TP 5
.B "-transparent"

(same as -alpha).
Force output of transparency information (SCHEME 0). This only works
if the output image format supports an alpha channel (AVS, TIFF, but
not JPEG). Note that this turns off anti-aliasing.

.TP 5
.B "-zoom ZZ[%]

Rescale image by factor ZZ (ZZ% if the % sign is present).

.SH HEADER RECORDS
.TP 5
.B     TITLE
Anything you like, up to 80 characters.
.TP 5
.B     NTX,NTY
Number of "tiles" in each direction. (The image is rendered piecemeal by
dividing it into an array of equal size rectangular tiles.) The width of
the output image in pixels is NTX*NPX by NTY*NPY. The speed of the program
is sensitive to the number of tiles. However, as a convenience you can set
NPX and NPY to zero and use NTX, NTY to provide the net size of the output
image in pixels.  In this case the program will choose the number of tiles
itself so that you don't have to worry about it.
.TP 5
.B     NPX,NPY
Number of computing pixels per tile in each direction.
Maximum = 36 (MAXNPX, MAXNPY in render.f). If you set NPX and NPY to zero,
the program will use NTX and NTY as the net size of the image in pixels.
.TP 5
.B     SCHEME
Pixel averaging (anti-aliasing) scheme. Anti-aliasing
reduces the jaggedness of edges at the cost of additional
computation.
 0 no anti-aliasing, include alpha blend (matte) channel
 1 no anti-alaising, no matte channel
 2 anti-alias by averaging 2x2 block of computed pixels for
   each output pixel. Resulting image dimensions are 1/2 of
   the nominal requested size.
 3 anti-alias by averaging 3x3 block of computed pixels for
   each 2x2 block of output pixels. Resulting image
   dimensions are 2/3 of the nominal requested size.
   (obsolete - use scheme 4 instead)
 4 anti-alias as in scheme 3, but output image dimensions
   are exactly as requested.

I.e. schemes 0, 1, and 4 produce a NTX*NPX by NTY*NPY pixel image;
scheme 3 produces a (2/3)NTX*NPX by (2/3)NTY*NPY image.
Scheme 3 requires NPX and NPY to be divisible by 3.
Schemes 2 and 4 require NPX and NPY to be divisible by 2.
.TP 5
.B     BKGND
Background colour (red, green, and blue components,
each in the range 0 to 1).
.TP 5
.B     SHADOW
T to calculate shadowing within the scene, F to omit shadows
.TP 5
.B     IPHONG
Phong power (e.g., 25) for specular reflections.
A smaller value results in a larger spot.
.TP 5
.B     STRAIT
Straight-on (secondary) light source contribution
(e.g., 0.15).  The primary light source contribution
(see also SOURCE below) is given by PRIMAR = 1 - STRAIT.
.TP 5
.B     AMBIEN
Ambient reflection quantity (e.g., 0.05).
.TP 5
.B     SPECLR
Specular reflection quantity (e.g., 0.25).
The diffuse reflection quantity is given by
DIFFUS = 1 - (AMBIEN+SPECLR).  Ambient and diffuse
reflections are chromatic, taking on the specified
colour of each object, whereas specular reflections
are white.
.TP 5
.B     EYEPOS
You can think of the image produced by Raster3D as corresponding
to a photograph taken by a camera placed a certain distance away
from the objects making up the scene. This distance is controlled
by the EYEPOS parameter.  EYEPOS = 4 describes a perspective corresponding
to a viewing distance 4 times the narrow dimension of the described scene.
EYEPOS = 0 disables perspective.
.TP 5
.B     SOURCE
Primary light source position (e.g., 1 1 1).
This is a white light point
source at infinite distance in the direction of this vector
(see note on co-ordinate convention below).
The secondary light source is always haed-on.
Only the primary light source casts shadows.
.TP 5
.B     TMAT
Homogeneous global transformation for input objects,
given as a 4x4 matrix on 4 lines just as you would
write it if you intended it to be a postfix (suffix)
operator.  The upper left 3x3 submatrix expresses
a pure rotation, the lower left 1x3 submatrix
gives a translation, the upper right 3x1 submatrix
should be zero (otherwise extra perspective is
introduced), and the lower right scalar produces
global scaling.
Coordinate vectors [x y z] are extended with a 1
to make them homogeneous, and then postmultiplied
by the entire matrix;
 i.e., if
      [x' y' z' h'] = [x y z 1][TMAT],
 then the ultimate co-ordinates are
      [x" y" z"] = (1/h')[x' y' z'].
.TP 5
.B     INMODE
Object input mode (1, 2, or 3), where
mode 1 means that all objects are triangles,
mode 2 means that all objects are spheres,
and mode 3 means that each object will be preceded
by a record containing a single number indicating its type.
The Raster3D programs always use mode INMODE 3.
 type 1 = triangle
 type 2 = sphere
 type 3 = round-ended cylinder
 type 4   (not used)
 type 5 = flat-ended cylinder
 type 6 = plane (triangle with infinite extent)
 type 7 = normals at vertices of previous triangle
 type 8 = material properties for subsequent objects
 type 9 = terminate previous material properties
 type 10/11/12 = reserved for label processing
 type 13 = glow light source
 type 14 = quadric surface
 type 15 = do not apply TMAT to subsequent objects
 type 16 = global rendering properties
 type 17 = colors for vertices of preceding triangle or cylinder
 type 0 = end of input file
.TP 5

.B INFMT or INFMTS
Object input format specifier(s).
Normally * for free-format input.

.TP 1
.B SAMPLE HEADER

 Title (This is a 1280x1024 pixel anti-aliased image)
 80 64     tiles in x,y
 24 24     pixels (x,y) per tile
 3         anti-aliasing level 3;  3x3->2x2
 0 0 0     black background
 F         no shadows cast
 25        Phong power
 0.25      secondary light contribution
 0.05      ambient light contribution
 0.25      specular reflection component
 4.0       eye position
 1 1 1     main light source (from over right shoulder)
 1 0 0 0   TMAT matrix describing
 0 1 0 0        input coordinate transformation
 0 0 1 0
 0 0 0 0.6 enlarge by 40% (smaller scalar -> bigger objects)
 3         mixed objects
 *         (free format triangle descriptors)
 *         (free format sphere descriptors)
 *         (free format cylinder descriptors)


.PP
.SH FILE INDIRECTION
.PP
At any point in the input stream to render where an object descriptor
would be legal, it is also legal to insert a line beginning with `@'.
In this case the remainder of the line is interpreted as the
name of a file from which further input is taken. This mechanism makes
it possible to re-use standard objects in multiple rendered scenes, e.g.
a set of bounding planes or standard definitions of material properties.
When input from this level of file indirection is terminated by
encountering an object descriptor of type 0, control returns to the
previous input stream. Multiple levels of file indirection are possible.

Files are first searched for in the current directory. If this search
fails, they are sought relative to the library directory specified by
the environmental variable R3D_LIB.

.SH RASTER3D OBJECT TYPES
.PP
For Raster3D object types and object descriptor formats,
see the man page for \fBr3d_objects\fP.

.SH ERROR MESSAGES
.PP
Some error messages may be safely ignored.
.PP
	Possible shadowing error NSXMAX= xxx
.PP
This is most usually caused by an object which projects far out of the field
of view, for example a plane surface. In most cases the shadowing "error"
refers to a shadow which lies outside of the image entirely.  However, if
your image does in fact contain missing or truncated shadows you can overcome
this problem by re-compiling the render program with larger values of
NSX and NSY as indicated by the error message.

.SH SOURCE

.B web URL:
 	http://www.bmsc.washington.edu/raster3d/raster3d.html

.B contact:		
 	Ethan A Merritt
 	University of Washington, Seattle WA 98195
 	merritt@u.washington.edu

.SH SEE ALSO
HTML and PostScript documentation
 r3d_objects(l), avs2ps(l), rastep(l), rods(l), ribbon(l),
balls(l), stereo3d(l)
.PP
.SH AUTHORS
Originally written by David J. Bacon.
 Extensions, revisions, and modifications by Ethan A Merritt.