1 |
.\" RCSid "$Id: tmesh2rad.1,v 1.3 2007/09/04 17:36:41 greg Exp $" |
2 |
.TH TMESH2RAD 1 3/18/96 RADIANCE |
3 |
.SH NAME |
4 |
tmesh2rad - convert a triangular mesh to a RADIANCE scene description |
5 |
.SH SYNOPSIS |
6 |
.B tmesh2rad |
7 |
[ |
8 |
.B "\-o obj" |
9 |
][ |
10 |
.B "\-m mat" |
11 |
][ |
12 |
.B "\-p pat" |
13 |
] |
14 |
[ |
15 |
.B input .. |
16 |
] |
17 |
.SH DESCRIPTION |
18 |
.I Tmesh2rad |
19 |
converts one or more triangle-mesh files to a RADIANCE scene description. |
20 |
The |
21 |
.I \-o |
22 |
option may be used to assign a default object name. |
23 |
The single letter "T" is used if no name is given on the command |
24 |
line or in the file. |
25 |
The |
26 |
.I \-m |
27 |
option may be used to assign a default material name. |
28 |
The non-material "void" is used as a default if none is given on the |
29 |
command line or in the file. |
30 |
The |
31 |
.I \-p |
32 |
option may be used to assign a default picture for a surface |
33 |
pattern. |
34 |
If none is given on the command line or in the file, the surface |
35 |
will not have an associated pattern. |
36 |
.SH "FILE FORMAT" |
37 |
A triangle-mesh is a free-format ASCII file |
38 |
composed of the following eight primitive |
39 |
types. |
40 |
Each primitive is begun with a single, white-space-delimited letter: |
41 |
.TP 10n |
42 |
.BI # \ Comment |
43 |
Whatever follows up until the end of line is passed as a comment |
44 |
to the output. |
45 |
Note that there must be at least one space or tab |
46 |
following the pound-sign. |
47 |
.TP |
48 |
.BI o \ name |
49 |
The white-space-delimited string |
50 |
.I name |
51 |
is used as a prefix for all following output triangles. |
52 |
.TP |
53 |
.BI m \ material |
54 |
The white-space-delimited string |
55 |
.I material |
56 |
is used as the modifier name for all following output triangles. |
57 |
.TP |
58 |
.BI p \ picture |
59 |
The white-space-delimited string |
60 |
.I picture |
61 |
is used as the name of the RADIANCE picture file |
62 |
to be used as a pattern for |
63 |
all following output triangles with properly defined vertices. |
64 |
(See |
65 |
.I i |
66 |
primitive below.)\0 |
67 |
.TP |
68 |
.BI v " id x y z" |
69 |
Defines the vertex |
70 |
.I id |
71 |
with 3-dimensional coordinates |
72 |
.I "x, y" |
73 |
and |
74 |
.I z. |
75 |
The identifier, |
76 |
.I id |
77 |
must be some small, non-negative integer value. |
78 |
If the same integer is used for a later vertex definition, |
79 |
this definition will be lost, though any triangles using the |
80 |
vertex prior to its redefinition will be unaffected. |
81 |
.TP |
82 |
.BI n " nx ny nz" |
83 |
Defines a surface normal vector with the 3-dimensional components |
84 |
.I "nx, ny" |
85 |
and |
86 |
.I nz. |
87 |
This vector will be associated with the most recently defined |
88 |
vertex, and is often placed on the same line as the vertex |
89 |
definition for clarity. |
90 |
The vector need not be normalized. |
91 |
.TP |
92 |
.BI i " u v" |
93 |
Defines a picture index for the most recently defined vertex. |
94 |
The |
95 |
.I u |
96 |
value will be used to lookup the horizontal pixel coordinate |
97 |
in the currently defined picture. |
98 |
The |
99 |
.I v |
100 |
value will be used to lookup the vertical pixel coordinate. |
101 |
(See the RADIANCE reference manual for details on picture coordinate |
102 |
values.)\0 |
103 |
As with associated surface normals, picture indices are interpolated |
104 |
using barycentric coordinates based on the triangle vertices. |
105 |
If these coordinates are calculated correctly, this |
106 |
should result in a smooth mapping of a pattern onto the |
107 |
surface mesh. |
108 |
.TP |
109 |
.BI t " id1 id2 id3" |
110 |
Create a triangle connecting the three vertices identified by |
111 |
.I "id1, id2" |
112 |
and |
113 |
.I id3. |
114 |
The right-hand rule is used to determine the default surface |
115 |
normal orientation, and this should not be too far from the |
116 |
associated vertex normals (if any). |
117 |
All three vertices must have an associated normal if the triangle |
118 |
is to be smoothed. |
119 |
If a picture file is defined and all three vertices have pattern |
120 |
indices associated with them, then this picture will be used as a |
121 |
pattern to modify the triangle's color. |
122 |
.PP |
123 |
We realize there are many similar |
124 |
T-mesh file formats in existence, and that it would have been just |
125 |
as easy to support one of these formats directly. |
126 |
The disadvantage to supporting an existing format is that conversion |
127 |
from other formats might prove difficult. |
128 |
It was our hope to provide a "greatest common multiple" format that |
129 |
would support all similar T-mesh formats, rather than supporting |
130 |
WaveFront's .OBJ format (for example) and being unable to associate |
131 |
a pattern with an object. |
132 |
Converting from other formats should be relatively straightforward. |
133 |
In many cases, an |
134 |
.I "awk(1), rcalc(1)" |
135 |
or even a |
136 |
.I sed(1) |
137 |
script should be sufficient. |
138 |
.SH EXAMPLE |
139 |
Here is an example T-mesh file: |
140 |
.sp |
141 |
.RS |
142 |
.nf |
143 |
# Our object name: |
144 |
o test_object |
145 |
# Our material: |
146 |
m puce |
147 |
# Our vertices: |
148 |
v 1 10 15 5 |
149 |
v 2 10 \-15 5 |
150 |
v 3 0 \-15 0 |
151 |
v 4 \-10 15 \-5 |
152 |
# Two triangles joined together: |
153 |
t 1 2 3 |
154 |
t 2 3 4 |
155 |
.fi |
156 |
.RE |
157 |
.sp |
158 |
Which generates the following output: |
159 |
.sp |
160 |
.RS |
161 |
.nf |
162 |
## T-mesh read from: <stdin> |
163 |
|
164 |
# Our material: |
165 |
|
166 |
# Our vertices: |
167 |
|
168 |
# Two triangles joined together: |
169 |
|
170 |
puce polygon test_object.1 |
171 |
0 |
172 |
0 |
173 |
9 |
174 |
10 15 5 |
175 |
10 \-15 5 |
176 |
0 \-15 0 |
177 |
|
178 |
puce polygon test_object.2 |
179 |
0 |
180 |
0 |
181 |
9 |
182 |
10 \-15 5 |
183 |
0 \-15 0 |
184 |
\-10 15 \-5 |
185 |
.fi |
186 |
.RE |
187 |
.sp |
188 |
.PP |
189 |
Here is another example: |
190 |
.sp |
191 |
.RS |
192 |
.nf |
193 |
# A partial cylinder: |
194 |
m BluePlastic |
195 |
v 1 \-14.673 \-3.119 50 n \-0.95677 \-0.203374 1.17936e\-10 |
196 |
v 2 \-12.136 \-8.817 \-50 n \-0.791363 \-0.574922 4.84915e\-10 |
197 |
v 3 \-12.136 \-8.817 50 n \-0.791363 \-0.574922 4.84915e\-10 |
198 |
t 1 2 3 |
199 |
m OrangePlastic |
200 |
v 1 \-7.501 \-12.991 50 n \-0.549094 \-0.812427 \-1.45812e\-09 |
201 |
v 2 \-12.136 \-8.817 50 n \-0.791363 \-0.574922 4.84915e\-10 |
202 |
v 3 \-12.136 \-8.817 \-50 n \-0.791363 \-0.574922 4.84915e\-10 |
203 |
t 1 2 3 |
204 |
m BluePlastic |
205 |
v 1 \-1.568 \-14.918 50 n \-0.171094 \-0.965568 \-5.69788e\-09 |
206 |
v 2 \-7.501 \-12.991 50 n \-0.549094 \-0.812427 \-1.45812e\-09 |
207 |
v 3 \-7.501 \-12.991 \-50 n \-0.429001 \-0.881759 \-3.6502e\-09 |
208 |
t 1 2 3 |
209 |
.fi |
210 |
.RE |
211 |
.sp |
212 |
Note that the same three vertices were used repeatedly, and |
213 |
intermingled with the triangle definitions. |
214 |
.SH AUTHOR |
215 |
Greg Ward |
216 |
.SH BUGS |
217 |
Triangle smoothing doesn't work very well for glass or trans |
218 |
material types in Radiance, since textures cause distorted |
219 |
transmission through these materials. |
220 |
It is best to use the dielectric material type if smooth |
221 |
transmission is desired. |
222 |
.SH "SEE ALSO" |
223 |
arch2rad(1), awk(1), ies2rad(1), thf2rad(1), |
224 |
oconv(1), rcalc(1), sed(1), xform(1) |