1Pamtris User Manual(0) Pamtris User Manual(0)
2
3
4
6 pamtris - triangle rasterizer featuring perspective-correct interpola‐
7 tion of generic vertex attributes and depth buffering
8
9
11 pamtris
12
13 -width=width
14
15 -height=height
16
17 { -num_attribs=attributes_per_vertex [ -tupletype=tupletype ] | -rgb |
18 -grayscale }
19
20 [ -maxval=maxval ]
21
22 All options can be abbreviated to their shortest unique prefix. You
23 may use two hyphens instead of one to designate an option. You may use
24 either white space or an equals sign between an option name and its
25 value.
26
27
29 This program is part of Netpbm(1).
30
31 pamtris can be used to draw a great variety of 2D and 3D graphics by
32 composing arbitrarily complex pictures out of separate triangles, tri‐
33 angle strips and triangle fans. The program reads instructions written
34 in a simple command script notation from Standard Input and outputs its
35 results as a (potentially multi-image) PAM stream on Standard Output.
36
37 For example, the following input
38
39
40 mode fan
41 attribs 0 128 0
42 vertex 0 0 1
43 attribs 0 0 128
44 vertex 200 0 1
45 attribs 50 20 103
46 vertex 190 61 1
47 attribs 100 40 78
48 vertex 161 117 1
49 attribs 150 60 53
50 vertex 117 161 1
51 attribs 200 80 28
52 vertex 61 190 1
53 attribs 250 100 3
54 vertex 0 200 1
55 print
56
57
58
59 produces this:
60
61 Example pamtris output for FAN mode
62
63
64 The input file gives triangle data by setting the appropriate drawing
65 mode, if necessary, and then providing a list of vertices. Each vertex
66 is also associated with a list of up to 20 "attributes," which are
67 integer values between 0 and a given maxval. In the most common usage,
68 you use pamtris to draw a visual image and a vertex has three
69 attributes, which are an RGB specification of a color. Such attribute
70 lists may be provided on a per-vertex basis.
71
72 Prior to effectively writing a PAM image to Standard Output, pamtris
73 first rasterizes it onto an internal frame buffer, which consists of an
74 "image buffer" and a "depth buffer." The image buffer consists of a
75 sequence of height rows containing a sequence of width tuples. There is
76 one sample for each vertex attribute in every tuple plus an opacity
77 (alpha) sample. Each tuple in the image buffer is also associated with
78 an integer depth in the depth buffer, which determines whether subse‐
79 quent drawing operations affect that particular tuple or not. This pro‐
80 vides a way of depth-sorting graphical objects which is adequate for
81 many purposes in 2D and 3D computer graphics. One prominent shortcoming
82 of such an approach to depth-sorting, however, is that it does not
83 automatically work with objects which are intended to appear "translu‐
84 cent," therefore requiring more elaborate strategies to incorporate
85 said objects into pictures generated using this technique.
86
87 The opacity sample is the last sample of the tuple. pamtris manipu‐
88 lates opacity internally and for any tuple it is always either 0 or the
89 maxval. The program does not provide the user direct control over the
90 alpha image plane.
91
92 pamtris rasterizes triangles by approximating their visible area as a
93 collection of tuples at particular positions in the frame buffer, and
94 to each sample of every such tuple it assigns a value which is a per‐
95 spective-correct interpolation between the values of the corresponding
96 attribute for each vertex of the triangle. Whenever a tuple within the
97 area of the frame buffer is produced, it is written to the correspond‐
98 ing position in the frame buffer if and only if it passes a depth test.
99 This test works as follows: the depth value of every incoming tuple
100 (which is itself an interpolation between the Z-coordinates of the ver‐
101 tices of the corresponding triangle) is compared against the value in
102 the corresponding position in the depth buffer. If the depth value of
103 the incoming tuple equals or is smaller than the depth value already
104 present in said position in the depth buffer, the following happens.
105
106
107
108 · Every sample i, where 0 ≤ i < num_attribs, of the tuple in
109 the corresponding position in the image buffer is set to equal
110 the value of the respective sample of the incoming tuple; and
111 the alpha sample (the last one) is updated to the maxval;
112
113
114 · The depth value in the corresponding position in the depth buf‐
115 fer is updated to a depth value directly proportional to that of
116 the incoming tuple.
117
118
119 Otherwise, that particular tuple effects no change at all in the frame
120 buffer.
121
122 The frame buffer is initially set so that all samples in every tuple of
123 the image buffer contain the value 0, and all entries in the depth buf‐
124 fer contain the maximum permitted depth value.
125
126 The attributes' values, and therefore the samples in the output PAM
127 images, have no fixed interpretation ascribed to them (except for the
128 last image plane, which is deliberately supposed to represent tuple
129 opacity information); one may ascribe any suitable meaning to them,
130 such as that of colors, texture coordinates, surface normals, light
131 interaction characteristics, texture influence coefficients for multi-
132 texturing, etc.
133
134
135
137 Fan Mode
138 The following command generates the image from the fan mode example at
139 the top of the DESCRIPTION ⟨#description⟩ section. If the file
140 fan.tris contains that code, you could process it with:
141
142
143 $ pamtris -height=200 -width=200 -rgb <fan.tris >fan.pam
144
145
146
147 Strip Mode
148 The following is an example of strip mode:
149
150
151 mode strip
152 attribs 255 0 0 # red
153 vertex 0 200 1
154 vertex 50 0 1
155 attribs 0 0 0 # black
156 vertex 100 200 1
157 attribs 0 205 205 # cyan
158 vertex 150 0 1
159 attribs 0 0 255 # blue
160 vertex 200 200 1
161 vertex 250 0 1
162 print
163
164
165 Save the above code in a file named strip.tris (for instance) and
166 process it with:
167
168
169 $ pamtris -height=200 -width=200 -rgb <strip.tris >strip.pam
170
171
172 to yield:
173
174 Example pamtris output for STRIP mode
175
176
177 Triangle Mode
178 The following is an example of triangle mode:
179
180
181 # yellow square
182 mode strip
183 attrib 155 155 0
184 vertex 50 50 100
185 vertex 50 200 100
186 vertex 200 50 100
187 vertex 200 200 100
188
189 # blue triangle
190 mode triangles
191 attrib 0 205 205
192 vertex 20 125 70
193 attrib 0 0 140
194 vertex 230 70 120 # Change "120" and see what happens
195 vertex 230 180 120 #
196 print
197
198
199 Save the above code in a file named pierce.tris (for instance) and
200 process it with:
201
202
203 $ pamtris -height=200 -width=200 -rgb <pierce.tris >pierce.pam
204
205
206 to yield:
207
208 Example pamtris output for TRIANGLES mode
209
210
211
212 Meta-programming
213 The pamtris command language is much too rudimentary to be used
214 directly for any serious drawing; you will probably want to use a gen‐
215 eral purpose programming language to generate a temporary pamtris com‐
216 mand file.
217
218 For example, the draw_pacman procedure in the following C program gen‐
219 erates pamtris instructions to produce a picture of NAMCO's Pac-Man,
220 with custom colors, position, radius, orientation and mouth opening
221 angle. It generates dozens of vertex commands tracing around the
222 perimeter of a circle. (Note: The PAM image produced by piping the out‐
223 put of the below program into pamtris was subsequently downscaled
224 through pamscale -linear -xscale 0.5 -yscale 0.5 to achieve an anti-
225 aliased ⟨#antialias⟩ effect.)
226
227 <img alt="Pac-Man" src="pamtris_pacman.png">
228
229
230 /* ------------------------------------
231 * width = 256
232 * height = 256
233 * num_attribs = 3
234 * tupletyple = RGB_ALPHA
235 * --------------------------------- */
236
237 #include <stdint.h>
238 #include <stdio.h>
239 #include <math.h>
240
241 #define PI 3.14159265358979323844
242
243 struct rgb_spec { uint8_t r, g, b; };
244
245 void draw_pacman (
246 int const center_x,
247 int const center_y,
248 int const radius,
249 int const depth,
250 struct rgb_spec const inner_color,
251 struct rgb_spec const outer_color,
252 int const orientation, /* <-- Angle of mouth's horizontal axis, in
253 * degrees. */
254 int const mouth_half_angle /* <-- Half angle between mouth's top and
255 * bottom, in degrees. Use something between 0
256 * and 180. */
257 ) {
258 double const ori_rad = PI*orientation/180;
259 double const mha_rad = PI*mouth_half_angle/180;
260
261 printf("mode fan\n"
262 "attr %d %d %d\n"
263 "vert %d %d %d\n"
264 "attr %d %d %d\n",
265 inner_color.r, inner_color.g, inner_color.b,
266 center_x, center_y, depth,
267 outer_color.r, outer_color.g, outer_color.b
268 );
269
270 {
271 double angle;
272
273 for(angle = mha_rad; angle <= 2*PI - mha_rad; angle += 2*PI/360)
274 {
275 int const x = round(center_x + cos(ori_rad + angle) * radius);
276 int const y = round(center_y - sin(ori_rad + angle) * radius);
277
278 printf("vertex %d %d %d\n", x, y, depth);
279 }
280 }
281 }
282
283 int main(void)
284 {
285 struct rgb_spec const inner_colors[3] = {
286 {255, 255, 0}, { 0, 200, 255}, {0, 255, 80}
287 };
288 struct rgb_spec const outer_colors[3] = {
289 {255, 25, 0}, {200, 0, 255}, {0, 100, 10}
290 };
291
292 int i;
293
294 for(i = 0; i < 3; i++)
295 draw_pacman(128 + cos(i*2*PI/3)*72, 128 - sin(i*2*PI/3)*72,
296 58 , 0 ,
297 inner_colors[i] , outer_colors[i] ,
298 i*120 , (3-i)*15
299 );
300
301 puts("!");
302
303 return 0;
304 }
305
306
307 Below are two other examples which demonstrate what else can be feasi‐
308 bly obtained through this meta-programming approach, especially when
309 combining pamtris with other Netpbm programs (Earth texture from
310 nasa.gov ⟨https://visibleearth.nasa.gov/view.php?id=73580⟩ ):
311
312 <img alt="Isometric Rainbow Waves" src="pamtris_isowaves.gif"> <img
313 alt="Rotating Earth" src="pamtris_earth.gif">
314
315
316
318 In addition to the options common to all programs based on libnetpbm
319 (most notably -quiet, see
320 Common Options ⟨index.html#commonoptions⟩ ), pamtris recognizes the
321 following command line options:
322
323 <dl compact="compact">
324
325 -width=width
326 Sets the width of the internal frame buffer and, by extension,
327 of the output PAM images, given in number of columns. This must
328 be an integer in the closed range [1, 8192].
329
330 This option is mandatory.
331
332
333 -height=height
334 This is the height of the internal frame buffer and, by exten‐
335 sion, of the output PAM images, given in number of rows. This
336 must be an integer in the closed range [1, 8192].
337
338 This option is mandatory.
339
340
341 -num_attribs=attributes_per_vertex
342 This is the number of attributes per vertex. The depth of the
343 output PAM images equals this value plus one (to accomodate the
344 alpha plane). The argument must be an integer in the closed
345 range [1, 20].
346
347 The input instruction stream may override this with a reset com‐
348 mand.
349
350 You must specify exactly one of -num_attribs, -rgb, and
351 -grayscale.
352
353
354
355 -tupletype=tupletype
356 This is the tuple type for the output PAM images. The argument
357 is a string which may be no longer than 255 characters.
358
359 The input instruction stream may override this with a reset com‐
360 mand.
361
362 The default is an empty (null) string.
363
364 This option cannot be specified together with -rgb or
365 -grayscale.
366
367
368
369
370 -rgb This is a convenience option which simply serves as an alias for
371 -num_attribs=3 -tupletype=RGB_ALPHA. In other words, this option
372 is a quick way to specify that you are going to use pamtris to
373 draw RGB(_ALPHA) color images directly, and the three vertex
374 attributes are the red, green and blue levels of the color asso‐
375 ciated with the vertex, in that order.
376
377 The input instruction stream may override this with a reset com‐
378 mand.
379
380 You must specify exactly one of -num_attribs, -rgb, and
381 -grayscale.
382
383 This option was new in Netpbm 10.85 (December 2018).
384
385
386 -grayscale
387 Another convenience option, similar to -rgb; except this one is
388 an alias for -num_attribs=1 -tupletype=GRAYSCALE_ALPHA. The one
389 vertex attribute is the gray level associated with the vertex.
390
391 The input instruction stream may override this with a reset com‐
392 mand.
393
394 You must specify exactly one of -num_attribs, -rgb, and
395 -grayscale.
396
397 This option was new in Netpbm 10.85 (December 2018).
398
399
400 -maxval=maxval
401 Sets the maxval of the output PAM images, which is also the max‐
402 imum permitted value for each vertex attribute. This must be an
403 integer in the closed range [1, 65535].
404
405 The default value is 255.
406
407 The input instruction stream may override this with a reset com‐
408 mand.
409
410
411
412
414 The input for pamtris consists of a stream of text lines read from
415 Standard Input.
416
417 Empty lines or lines that contain only white space characters are
418 called blank lines and are ignored.
419
420 When a # occurs anywhere in a line, pamtris ignores it along with every
421 character after it. In other words, everything from the # until the end
422 of the line receives the same treatment as white space.
423
424 Lines which are not blank must contain a sequence of strings, called
425 tokens, separated by white space. The first such token must be one of
426 the commands recognized by pamtris, and all further tokens are inter‐
427 preted as the arguments for that command, if it takes any. When an
428 insufficient number of arguments is provided for a command, the line is
429 considered invalid and is given the same treatment as a blank line. The
430 same happens when an out of range argument or one of a kind different
431 of what is expected is given (for example, when you give a string of
432 letters where a numerical value is expected), or when an unrecognized
433 command/argument is found. When a number of arguments greater than that
434 required for a particular command is provided, only the portion of the
435 line up to the last required argument is considered and any further
436 tokens are ignored.
437
438 pamtris is case-insensitive. That is, mode, MODE, mODe, etc. are all
439 treated the same way.
440
441 The commands recognized by pamtris are:
442
443
444 mode
445
446 attribs
447
448 vertex
449
450 print
451
452 clear
453
454 reset
455
456 quit
457
458
459 You may use a minimum unique abbreviation of a command name. You may
460 use an exclamation mark (!) in place of the print command name and an
461 asterisk (*) in place of clear.
462
463 The functions of the commands are as follows.
464
465
466
467 mode { triangles | strip | fan }
468
469 This makes pamtris enter a new drawing mode. The argument is a
470 word which specifies the mode to change to. Instead of a full
471 argument name, it is permissible to provide a minimum unique
472 abbreviation, which has the same effect. The drawing mode will
473 remain the same until the next mode command is given.
474
475 This command also resets the current vertex list, which is
476 (re)initialized to an empty state after the command is executed.
477 One may add new vertices to this list through successive invoca‐
478 tions of the vertex command (see below). You do not have to
479 worry about providing "too many" vertices, since the vertex list
480 is virtualized: pamtris maintains only the state pertaining to
481 three vertices at any one time. The current vertex list is ini‐
482 tially empty.
483
484 It is permissible to give pamtris a mode command which instructs
485 it to enter a drawing mode it is currently already in. One might
486 use this approach to reset the current vertex list without
487 changing the current drawing mode.
488
489 Regardless of the current drawing mode, a new triangle is imme‐
490 diately rasterized into the frame buffer as soon as the neces‐
491 sary vertices for it are provided through the current vertex
492 list.
493
494 In the following descriptions of each drawing mode, triangles'
495 and vertices' indices (ordinal numbers) are 0-based.
496
497 The triangles argument instructs pamtris to enter the "TRIAN‐
498 GLES" drawing mode. While in this mode, a series of separate
499 triangles is constructed. Every three vertices pushed into the
500 current vertex list specify a new triangle. Formally, this
501 means that every Nth triangle is specified by vertices 3 * N, 3
502 * N + 1, and 3 * N + 2. This is the default initial mode and is
503 therefore not required to be set explicitly before drawing any
504 triangles.
505
506 The strip argument instructs pamtris to enter the "STRIP" draw‐
507 ing mode. While in this mode, pamtris constructs a "triangle
508 strip." That is, the first three vertices pushed into the cur‐
509 rent vertex list specify the first triangle, and every new ver‐
510 tex pushed after that specifies, together with the previous two,
511 the next triangle. Formally, this means that every Nth triangle
512 is specified by vertices N, N + 1, and N + 2.
513
514 The fan argument instructs pamtris to enter the "FAN" drawing
515 mode. While in this mode, a so-called "triangle fan" is con‐
516 structed. That is, the first three vertices pushed into the
517 current vertex list specify the first triangle, and every new
518 vertex pushed after that specifies, together with the previous
519 vertex and the first one, the next triangle. Formally, this
520 means that every Nth triangle is specified by vertices 0, N + 1,
521 and N + 2.
522
523
524
525
526 attribs a<sub>0</sub> a<sub>1</sub>
527 a<sub>2</sub> ... a<sub>num_attribs - 1</sub>
528
529 This updates the current attribute values list. This command
530 takes as arguments a sequence of num_attribs integers which rep‐
531 resent the values of the attributes to be associated with the
532 next vertex. This sequence of values is the just mentioned "cur‐
533 rent attribute values list."
534
535 Each ith argument, where 0 ≤ i < num_attribs, indicates
536 the value to be assigned to the ith attribute of the current
537 attribute values list. All arguments must be integer values in
538 the closed range [0, maxval]. If a number of arguments less
539 than the current value of num_attribs is given, the command is
540 considered invalid and is therefore ignored.
541
542 The current attribute values list remains unchanged until the
543 next valid attribs or reset command is given. The attribs com‐
544 mand allows one to change the values of each attribute individu‐
545 ally, while the reset command is not specifically designed for
546 that function, but it has the side effect of setting all values
547 in the current attribute values list to the maxval (see below).
548
549 All values in the current attribute values list are initially
550 set to the maxval.
551
552 <dt id="cmd_vertex">vertex x y z [w]
553
554 Adds a new vertex to the current vertex list (see the mode com‐
555 mand above), assigning the values of the arguments to its
556 respective coordinates, and the values in the current attribute
557 values list (see the attribs command above) to the respective
558 entries in the attribute list associated with the vertex.
559
560 x, y and z must be integer values in the closed range [-32767,
561 32767]. x and y represent, respectively, the column and row of
562 the tuple which corresponds to the location of the vertex. Such
563 values may correspond to tuples outside the limits of the frame
564 buffer. The origin of the coordinate system is at the top-left
565 tuple of the frame buffer. The X-axis goes from left to right,
566 and the Y-axis from top to bottom. A negative value for x indi‐
567 cates a column that many tuples to the left of the leftmost col‐
568 umn of the frame buffer. Likewise, a negative value for y indi‐
569 cates a row that many tuples above the uppermost row of the
570 frame buffer. Observe that those coordinates correspond directly
571 to a particular point in the coordinate system delineated above,
572 regardless of whether you are trying to draw an image which is
573 supposed to look as if viewed "in perspective" or not; pamtris
574 does not "warp" the coordinates you give in any way. Therefore,
575 if you want to draw images in perspective, you must compute val‐
576 ues for x and y already projected into pamtris' coordinate sys‐
577 tem yourself, using an external perspective projection method,
578 prior to giving them to the program.
579
580 The z parameter represents the Z-coordinate of the vertex,
581 which is used to compute depth values for tuples within the
582 areas of rasterized triangles. Intuitively, smaller values for z
583 mean "closer to the viewer," and larger ones mean "farther away
584 from the viewer" (but remember: as said above, the x and y coor‐
585 dinates are not warped in any way, which implies that they are
586 not affected by z; neither by the next parameter, for that mat‐
587 ter).
588
589 Optionally, you may provide a w parameter which represents a
590 "perspective correction factor" used to properly interpolate
591 vertex attributes across the area of the corresponding triangle.
592 This must be an integer value in the closed range [1, 1048575].
593 If you don't provide a value for it, the default value of 1 is
594 used (hence, if you want to nullify the effects of perspective
595 correction on a triangle so the output samples are computed as
596 if just linearly interpolated, simply do not provide a value for
597 w for any vertex of the triangle). If, however, you intend to
598 draw 3D geometry in perspective, you must provide an appropriate
599 value for this parameter, otherwise the output images might look
600 very wrong. w was new in Netpbm 10.85 (December 2018).
601
602 Consider the
603 typical model ⟨https://en.wikipedia.org/wiki/Viewing_frustum⟩
604 of the so-called "viewing frustum" used to project vertices in
605 3D "world space" onto a planar "image space." If we adopt the
606 convention that a "z-plane" means any plane parallel to the
607 view-plane (a.k.a. picture plane, a.k.a. near plane), the value
608 of w for a vertex should then be the (smallest/euclidean/orthog‐
609 onal) distance in pixels between the projection reference point
610 (PRP, or "eye") and the z-plane containing the vertex. One way
611 to compute this value amounts to simply taking the dot product
612 between the 3D vector r and the 3D unit vector n, where r is the
613 vector which goes from the projection reference point (PRP, or
614 "eye") to the vertex, and n is a view-plane normal (VPN) of unit
615 length which points away from the PRP. In other words, this is
616 equal to the length of the orthogonal projection of r on the
617 line "determined" by n.
618
619 (Note: For any two 3D vectors a and b, with respective real
620 scalar components a<sub>x</sub>, a<sub>y</sub>, a<sub>z</sub>
621 and b<sub>x</sub>, b<sub>y</sub>, b<sub>z</sub>, the dot product
622 between a and b is simply
623 a<sub>x</sub>*b<sub>x</sub> + a<sub>y</sub>*b<sub>y</sub> + a<sub>z</sub>*b<sub>z</sub>.)
624
625
626
627 print
628
629 This writes a PAM image to Standard Output whose raster is a
630 copy of the current contents of the image buffer. The values of
631 the WIDTH and HEIGHT fields are the same as the width and
632 height, respectively, of the frame buffer, which were given on
633 the command line during program invocation. The MAXVAL field is
634 equal to the current maxval; the DEPTH field is equal to the
635 current value of num_attribs + 1; and the TUPLTYPE field is
636 equal to the current tupletype.
637
638 This command has no effect upon the current drawing state. E. g.
639 it does not modify the current drawing mode, the current vertex
640 list, etc.
641
642 One may issue an arbitrary number of print commands at different
643 positions in the input instruction sequence to produce a multi-
644 image PAM stream.
645
646
647 clear [ image | depth ]
648
649 Clears the frame buffer. That is, all samples in the image buf‐
650 fer are once again set to 0, and all entries in the depth buffer
651 are once again set to the maximum permitted depth value.
652
653 Optionally, one may provide an argument to only clear either the
654 image buffer or the depth buffer individually, while leaving the
655 other intact. With the image argument, only the image buffer is
656 cleared; with the depth argument, only the depth buffer is
657 cleared. Instead of full argument names, one may provide a mini‐
658 mum unique abbreviation, which has the same effect. The single
659 character z is also accepted as an alias for depth.
660
661 Like the print command, this command has no effect upon the cur‐
662 rent drawing state either.
663
664
665
666 reset maxval num_attribs [tupletype]
667
668 This updates the current maxval and number of attributes per
669 vertex (num_attribs), resetting the <u>image</u> buffer with a
670 new maxval and number of samples per tuple while at it. The
671 parameter maxval must be an integer in the closed range [1,
672 65535], and num_attribs must be an integer in the closed range
673 [1, 20].
674
675 Optionally, after the second argument, one may provide a string
676 to be assigned to the current tupletype. The string goes from
677 the first character after the second argument which is not white
678 space and continues until (and including) the last character
679 before the end of the line which is not white space. If a new
680 tupletype is not provided, or the provided string is longer than
681 255 characters, the empty string is assigned to the current
682 tupletype.
683
684 The side effects of running this command are
685
686
687
688 ·
689
690 The new image buffer is completely cleared once the command is
691 executed.
692
693
694 ·
695
696 All values in the current attribute values list are set to the
697 new maxval.
698
699
700 ·
701
702 The current vertex list is reset.
703
704
705
706 However, it does not touch the depth buffer: it is left the same
707 way as it was found before the command. Also the drawing mode
708 remains the same (e. g. if pamtris was in FAN mode, it will con‐
709 tinue in that same mode, etc.).
710
711 If this command is given with an invalid value for maxval or
712 num_attribs, it is ignored and therefore none of the above side
713 effects apply, nor do the current maxval, num_attribs or tuple‐
714 type change at all.
715
716 It is permissible to give a value for maxval and num_attribs
717 equal to the current maxval and num_attribs, respectively,
718 although the above side effects will still apply even in such
719 cases.
720
721 Since this command deals with memory allocation, it may fail to
722 execute successfully. If that happens, no lines of input will be
723 read anymore and pamtris will be terminated as if the quit com‐
724 mand was given.
725
726 quit
727
728 This terminates pamtris. It will not read any more lines of
729 input after this command.
730
731
732
733
734
736 Texturing
737 It is possible to apply so-called "textures" to images produced with
738 pamtris by using a pair of vertex attributes as texture coordinates,
739 then using pamchannel(1) to select the appropriate channels in the out‐
740 put image(s), and finally processing the result through pamlookup(1),
741 providing the desired texture file as a "lookup table." If you are
742 drawing pictures in perspective, make sure to provide adequate values
743 for the w parameter to your vertex commands ( see above ⟨#cmd_vertex⟩ )
744 so that the resulting samples in the images produced by pamtris are
745 perspective-correct.
746
747 You might want to consider using pnmtile(1) to make textures which are
748 inteded to be "repeated" along triangle meshes.
749
750
751
752 Anti-aliased edges
753 pamtris performs no anti-aliasing on triangle edges by itself. How‐
754 ever, it is possible to obtain anti-aliased images through a "super-
755 sampling" approach: draw your image(s) at a size larger than the
756 desired final size, and then, when all postprocessing is done, down‐
757 scale the final image(s) to the desired size. Drawing images with twice
758 the desired width and height, then downscaling them to the intended
759 size while disregarding gamma (i.e. what pamscale -linear does) often
760 produces good enough results.
761
762
763
765 pampick(1) pamchannel(1) pamstack(1) pamlookup(1) pamarith(1) pam‐
766 scale(1) pamdepth(1) pamexec(1) pam(1)
767
768
770 pamtris was originally written by Lucas Brunno Luna. The author is
771 grateful to Bryan Henderson for offering suggestions regarding usabil‐
772 ity.
773
774
776 pamtris was new in Netpbm 10.84 (September 2018).
777
779 This manual page was generated by the Netpbm tool 'makeman' from HTML
780 source. The master documentation is at
781
782 http://netpbm.sourceforge.net/doc/pamtris.html
783
784netpbm documentation 05 November 2020 Pamtris User Manual(0)