| 1 |
< |
.\" SCCSid "$SunId$ LBL" |
| 1 |
> |
.\" RCSid "$Id$" |
| 2 |
|
.nr PS 11 |
| 3 |
|
.ps 11 |
| 4 |
|
.nr VS 12 |
| 5 |
|
.vs 12 |
| 6 |
|
.nr PD .5v |
| 7 |
|
.ds LF MGF |
| 8 |
< |
.ds RF Version 1.0 |
| 9 |
< |
.DA May 1995 |
| 8 |
> |
.ds RF Version 1.1 |
| 9 |
> |
.\" !Remember to update date on each modification! |
| 10 |
> |
.DA February 1996 |
| 11 |
|
.TL |
| 12 |
|
The Materials and Geometry Format |
| 13 |
|
.AU |
| 43 |
|
"http://radsite.lbl.gov/mgf/HOME.html". |
| 44 |
|
.RE |
| 45 |
|
.LP |
| 46 |
< |
The standard parser provides both immediate and a long-term |
| 46 |
> |
The standard parser provides both immediate and long-term |
| 47 |
|
benefits, since it presents a programming interface that is more |
| 48 |
|
stable even than the language itself. |
| 49 |
|
Unlike AutoCAD DXF and other de facto standards, a change to the |
| 233 |
|
n dx dy dz set surface normal for current vertex |
| 234 |
|
_ _ _ |
| 235 |
|
f v1 v2 v3 ... polygon using current material, spec. vertices |
| 236 |
+ |
fh v1 v2 v3 - ... face with explicit holes |
| 237 |
|
sph vc radius sphere |
| 238 |
|
cyl v1 radius v2 truncated right cylinder (open-ended) |
| 239 |
|
cone v1 rad1 v2 rad2 truncated right cone (open-ended) |
| 279 |
|
= = = = = |
| 280 |
|
Object o - - - |
| 281 |
|
Transform xf - - T{ |
| 282 |
< |
f, sph, cyl, cone, |
| 282 |
> |
f, fh, sph, cyl, cone, |
| 283 |
|
ring, torus, prism |
| 284 |
|
T} |
| 285 |
|
Material m 2-sided black T{ |
| 286 |
|
sides, rd, td, |
| 287 |
< |
ed, rs, ts |
| 287 |
> |
ed, rs, ts, ir |
| 288 |
|
T} T{ |
| 289 |
< |
f, sph, cyl, cone, |
| 289 |
> |
f, fh, sph, cyl, cone, |
| 290 |
|
ring, torus, prism |
| 291 |
|
T} |
| 292 |
|
Color c neutral grey T{ |
| 298 |
|
(0,0,0), |
| 299 |
|
no normal |
| 300 |
|
T} p, n T{ |
| 301 |
< |
f, sph, cyl, cone, |
| 301 |
> |
f, fh, sph, cyl, cone, |
| 302 |
|
ring, torus, prism |
| 303 |
|
T} |
| 304 |
|
.TE |
| 433 |
|
sufficient. |
| 434 |
|
The following transformation flags and |
| 435 |
|
parameters are defined: |
| 436 |
< |
.TS I |
| 436 |
> |
.TS |
| 437 |
> |
center; |
| 438 |
|
l l. |
| 439 |
|
-t dx dy dz translate objects along the given vector |
| 440 |
|
-rx degrees rotate objects about the X-axis |
| 549 |
|
The following example of a simple room with a single door |
| 550 |
|
and six file cabinets shows MGF in action, with copious comments to |
| 551 |
|
help explain what's going on. |
| 552 |
+ |
.LP |
| 553 |
|
.DS |
| 554 |
|
# "ceiling_tile" is a diffuse white surface with 75% reflectance: |
| 555 |
|
# Create new named material context and clear it |
| 748 |
|
o |
| 749 |
|
o |
| 750 |
|
|
| 747 |
– |
i cubfurn.inc -mx -t 405 133.5 0 |
| 748 |
– |
o |
| 749 |
– |
|
| 751 |
|
# Six file cabinets (36" wide each) |
| 752 |
|
# ("filecab.inc" was given as an earlier example in Section 1.2) |
| 753 |
|
o filecab.x |
| 773 |
|
For ease of reference we have broken these into five categories: |
| 774 |
|
.IP 1. |
| 775 |
|
General |
| 776 |
< |
.TS I |
| 776 |
> |
.TS |
| 777 |
|
lw(.75i) lw(1.75i) lw(3i). |
| 778 |
|
# [anything ...] a comment |
| 779 |
|
o [name] begin/end object context |
| 783 |
|
.TE |
| 784 |
|
.IP 2. |
| 785 |
|
Color |
| 786 |
< |
.TS I |
| 786 |
> |
.TS |
| 787 |
|
lw(.75i) lw(1.75i) lw(3i). |
| 788 |
|
c [id [= [template]]] get/set color context |
| 789 |
|
cxy x y set CIE (x,y) chromaticity for current color |
| 817 |
|
.TS |
| 818 |
|
lw(.75i) lw(1.75i) lw(3i). |
| 819 |
|
f v1 v2 v3 ... polygon using current material, spec. vertices |
| 820 |
+ |
fh v1 v2 v3 - ... face with explicit holes |
| 821 |
|
sph vc radius sphere |
| 822 |
|
cyl v1 radius v2 truncated right cylinder (open-ended) |
| 823 |
|
cone v1 rad1 v2 rad2 truncated right cone (open-ended) |
| 1269 |
|
Values in between are separated by |
| 1270 |
|
.I "(l_max-l_min)/(N-1)" |
| 1271 |
|
nanometers. |
| 1272 |
< |
All values must be non-negative, and the spectrum outside of the |
| 1272 |
> |
All values should be non-negative unless defining a component for |
| 1273 |
> |
complementary color mixing, and the spectrum outside of the |
| 1274 |
|
specified range is assumed to be zero. |
| 1275 |
|
(The visible range is 380 to 780 nm.)\0 |
| 1276 |
|
The actual units and scale of the measurements do not matter, |
| 1677 |
|
# A 100-watt incandescent bulb (1600 lumens) modeled as a sphere |
| 1678 |
|
m |
| 1679 |
|
c |
| 1680 |
< |
cct 3000 |
| 1680 |
> |
cct 3000 |
| 1681 |
|
ed 87712 |
| 1682 |
|
v cent = |
| 1683 |
|
p 0 0 0 |
| 1903 |
|
require a normal direction. |
| 1904 |
|
An |
| 1905 |
|
.UL f |
| 1906 |
+ |
or |
| 1907 |
+ |
.UL fh |
| 1908 |
|
entity will interpolate vertex normals if given, and |
| 1909 |
|
use the polygon plane normal otherwise. |
| 1910 |
|
See the |
| 1944 |
|
.UL cone, |
| 1945 |
|
.UL cyl, |
| 1946 |
|
.UL f, |
| 1947 |
+ |
.UL fh, |
| 1948 |
|
.UL n, |
| 1949 |
|
.UL p, |
| 1950 |
|
.UL prism, |
| 1989 |
|
.UL cone, |
| 1990 |
|
.UL cyl, |
| 1991 |
|
.UL f, |
| 1992 |
+ |
.UL fh, |
| 1993 |
|
.UL n, |
| 1994 |
|
.UL prism, |
| 1995 |
|
.UL ring, |
| 2036 |
|
SEE ALSO |
| 2037 |
|
.LP |
| 2038 |
|
.UL f, |
| 2039 |
+ |
.UL fh, |
| 2040 |
|
.UL p, |
| 2041 |
|
.UL prism, |
| 2042 |
|
.UL ring, |
| 2076 |
|
Also, specified normals should point in the general direction of the |
| 2077 |
|
surface for best results. |
| 2078 |
|
.LP |
| 2079 |
< |
There is no explicit representation of holes in MGF. A hole must be |
| 2080 |
< |
represented implicitly by connecting vertices to form "seams." For |
| 2079 |
> |
There is no explicit representation of holes in this entity, but see |
| 2080 |
> |
the |
| 2081 |
> |
.UL fh |
| 2082 |
> |
entity for an alternative specification. |
| 2083 |
> |
.LP |
| 2084 |
> |
A hole may be represented implicitly in a face entity |
| 2085 |
> |
by connecting vertices to form "seams." |
| 2086 |
> |
For |
| 2087 |
|
example, a wall with a window in it might look as shown in Figure 1. |
| 2088 |
|
In many systems, the wall itself would be represented with the first |
| 2089 |
|
list of vertices, (v1,v2,v3,v4) and the hole associated with that |
| 2090 |
< |
wall as a second set of vertices (v5,v6,v7,v8). In MGF, we must |
| 2090 |
> |
wall as a second set of vertices (v5,v6,v7,v8). |
| 2091 |
> |
Using the face entity, we must |
| 2092 |
|
give the whole thing as a single polygon, connecting the vertices so |
| 2093 |
|
as to create a "seam," as shown in Figure 2. |
| 2094 |
< |
This could be written in MGF as "f v1 v2 v3 v4 v5 v6 v7 v8 v5 v4". |
| 2094 |
> |
This could be written as "f v1 v2 v3 v4 v5 v6 v7 v8 v5 v4". |
| 2095 |
|
.LP |
| 2096 |
|
It is very important that the order of the hole be opposite to the |
| 2097 |
|
order of the outer perimeter, otherwise the polygon will be |
| 2140 |
|
.LP |
| 2141 |
|
.UL cone, |
| 2142 |
|
.UL cyl, |
| 2143 |
+ |
.UL fh, |
| 2144 |
|
.UL m, |
| 2145 |
|
.UL prism, |
| 2146 |
|
.UL ring, |
| 2147 |
|
.UL sph, |
| 2148 |
|
.UL torus, |
| 2149 |
|
.UL v |
| 2150 |
+ |
.ds RH FH |
| 2151 |
+ |
.bp |
| 2152 |
+ |
.SH |
| 2153 |
+ |
NAME |
| 2154 |
+ |
.LP |
| 2155 |
+ |
fh - create a polygonal face with explicit holes |
| 2156 |
+ |
.SH |
| 2157 |
+ |
SYNOPSIS |
| 2158 |
+ |
.LP |
| 2159 |
+ |
.B fh |
| 2160 |
+ |
.I "p1 p2 ... - h1.1 h1.2 ... - h2.1 h2.2 ..." |
| 2161 |
+ |
.SH |
| 2162 |
+ |
DESCRIPTION |
| 2163 |
+ |
.LP |
| 2164 |
+ |
Create a polygonal face with optional holes made of the current material. |
| 2165 |
+ |
The first contour is the outer perimeter, with vertices given in |
| 2166 |
+ |
counter-clockwise order as seen from the front side (the same as the |
| 2167 |
+ |
.UL f |
| 2168 |
+ |
entity). |
| 2169 |
+ |
A hole is indicated by a hyphen ('-') followed by the hole's |
| 2170 |
+ |
vertices, given in clockwise order as seen from the front side. |
| 2171 |
+ |
Multiple hole contours are separated by additional hyphens. |
| 2172 |
+ |
There must be at least three vertices for each contour, and the |
| 2173 |
+ |
last vertex is implicitly connected to the first. |
| 2174 |
+ |
If any vertex is undefined, an error will result. |
| 2175 |
+ |
.LP |
| 2176 |
+ |
If any vertices have associated surface normals, they will be used |
| 2177 |
+ |
instead of the average plane normal, though it is safest to specify |
| 2178 |
+ |
either all normals or no normals, and to stick with triangles |
| 2179 |
+ |
when normals are used. |
| 2180 |
+ |
Also, specified normals should point in the general direction of the |
| 2181 |
+ |
surface for best results. |
| 2182 |
+ |
.LP |
| 2183 |
+ |
Vertices should not be shared between any two contours. |
| 2184 |
+ |
I.e., a hole should not share a vertex or edge with the perimeter or |
| 2185 |
+ |
another hole, or incorrect rendering may result. |
| 2186 |
+ |
.SH |
| 2187 |
+ |
EXAMPLE |
| 2188 |
+ |
.DS |
| 2189 |
+ |
# Make a wall with a window using an explicit hole. |
| 2190 |
+ |
# (See Figures 1 and 2.) |
| 2191 |
+ |
fh v1 v2 v3 v4 - v5 v6 v7 v8 |
| 2192 |
+ |
.DE |
| 2193 |
+ |
.SH |
| 2194 |
+ |
SEE ALSO |
| 2195 |
+ |
.LP |
| 2196 |
+ |
.UL cone, |
| 2197 |
+ |
.UL cyl, |
| 2198 |
+ |
.UL f, |
| 2199 |
+ |
.UL m, |
| 2200 |
+ |
.UL prism, |
| 2201 |
+ |
.UL ring, |
| 2202 |
+ |
.UL sph, |
| 2203 |
+ |
.UL torus, |
| 2204 |
+ |
.UL v |
| 2205 |
|
.ds RH SPH |
| 2206 |
|
.bp |
| 2207 |
|
.SH |
| 2250 |
|
.UL cone, |
| 2251 |
|
.UL cyl, |
| 2252 |
|
.UL f, |
| 2253 |
+ |
.UL fh, |
| 2254 |
|
.UL m, |
| 2255 |
|
.UL prism, |
| 2256 |
|
.UL ring, |
| 2298 |
|
p 0 0 .005 |
| 2299 |
|
v vend = |
| 2300 |
|
p 0 0 .05 |
| 2301 |
< |
cyl vtip1 .0015 |
| 2301 |
> |
cyl vtip1 .0015 vend |
| 2302 |
|
sph vend .0015 |
| 2303 |
|
cone vtip0 0 vtip1 .0015 |
| 2304 |
|
o |
| 2308 |
|
.LP |
| 2309 |
|
.UL cone, |
| 2310 |
|
.UL f, |
| 2311 |
+ |
.UL fh, |
| 2312 |
|
.UL m, |
| 2313 |
|
.UL prism, |
| 2314 |
|
.UL ring, |
| 2381 |
|
.LP |
| 2382 |
|
.UL cyl, |
| 2383 |
|
.UL f, |
| 2384 |
+ |
.UL fh, |
| 2385 |
|
.UL m, |
| 2386 |
|
.UL prism, |
| 2387 |
|
.UL ring, |
| 2448 |
|
.UL cyl, |
| 2449 |
|
.UL cone, |
| 2450 |
|
.UL f, |
| 2451 |
+ |
.UL fh, |
| 2452 |
|
.UL m, |
| 2453 |
|
.UL ring, |
| 2454 |
|
.UL sph, |
| 2463 |
|
.SH |
| 2464 |
|
SYNOPSIS |
| 2465 |
|
.LP |
| 2466 |
< |
.B cyl |
| 2466 |
> |
.B ring |
| 2467 |
|
.I "vc rmin rmax" |
| 2468 |
|
.SH |
| 2469 |
|
DESCRIPTION |
| 2505 |
|
.UL cyl, |
| 2506 |
|
.UL cone, |
| 2507 |
|
.UL f, |
| 2508 |
+ |
.UL fh, |
| 2509 |
|
.UL m, |
| 2510 |
|
.UL prism, |
| 2511 |
|
.UL sph, |
| 2566 |
|
.UL cyl, |
| 2567 |
|
.UL cone, |
| 2568 |
|
.UL f, |
| 2569 |
+ |
.UL fh, |
| 2570 |
|
.UL m, |
| 2571 |
|
.UL prism, |
| 2572 |
|
.UL ring, |
| 2578 |
|
.NH |
| 2579 |
|
MGF Translators |
| 2580 |
|
.LP |
| 2581 |
< |
Initially, there are four translators for MGF data, but only |
| 2582 |
< |
one of these is distributed with the MGF parser itself, |
| 2583 |
< |
.I mgfilt. |
| 2581 |
> |
Initially, there are six translators for MGF data, and |
| 2582 |
> |
three of these are distributed with the MGF parser itself, |
| 2583 |
> |
.I mgfilt, |
| 2584 |
> |
.I mgf2inv |
| 2585 |
> |
and |
| 2586 |
> |
.I 3ds2mgf. |
| 2587 |
|
Two of the other translators, |
| 2588 |
|
.I mgf2rad |
| 2589 |
|
and |
| 2596 |
|
nestor.epfl.ch, or by WWW from |
| 2597 |
|
"http://radsite.lbl.gov/radiance/HOME.html" |
| 2598 |
|
.FE |
| 2599 |
< |
A third translator, |
| 2599 |
> |
The sixth translator, |
| 2600 |
|
.I mgf2meta, |
| 2601 |
|
converts to a 2-dimensional line plot, and is also |
| 2602 |
|
distributed with Radiance. |
| 2613 |
|
In future releases of MGF, this utility will also be handy for |
| 2614 |
|
taking new entities and producing older versions of MGF for |
| 2615 |
|
translators that have not yet been updated properly. |
| 2616 |
+ |
.LP |
| 2617 |
+ |
Mgf2inv converts from MGF to Inventor or VRML format. |
| 2618 |
+ |
Some information is lost, because these formats do not support |
| 2619 |
+ |
physical light sources or materials. |
| 2620 |
+ |
.LP |
| 2621 |
+ |
3ds2mgf converts from 3D Studio binary format to MGF. |
| 2622 |
+ |
Care must be taken to correct for errors in the material descriptions, |
| 2623 |
+ |
since 3D Studio is completely non-physical. |
| 2624 |
|
.ds LH Translators |
| 2625 |
|
.ds RH MGFILT |
| 2626 |
|
.bp |
| 2655 |
|
of MGF that is to be produced. |
| 2656 |
|
Since MGF is in its first major release, this is not yet a useful |
| 2657 |
|
form, but it will be when the second major release comes out. |
| 2658 |
+ |
This has the necessary side-effect of expanding all included files. |
| 2659 |
+ |
(See the |
| 2660 |
+ |
.UL i |
| 2661 |
+ |
entity.)\0 |
| 2662 |
|
.LP |
| 2663 |
|
In the second form, |
| 2664 |
|
.I mgfilt |
| 2683 |
|
.SH |
| 2684 |
|
SEE ALSO |
| 2685 |
|
.LP |
| 2686 |
< |
mgf2rad, rad2mgf |
| 2686 |
> |
i, mgf2inv, mgf2rad, rad2mgf |
| 2687 |
> |
.ds RH MGF2INV |
| 2688 |
> |
.bp |
| 2689 |
> |
.SH |
| 2690 |
> |
NAME |
| 2691 |
> |
.LP |
| 2692 |
> |
mgf2inv - convert from MGF to Inventor or VRML format |
| 2693 |
> |
.SH |
| 2694 |
> |
SYNOPSIS |
| 2695 |
> |
.LP |
| 2696 |
> |
.B mgf2inv |
| 2697 |
> |
[ |
| 2698 |
> |
.B "-1|-2|-vrml" |
| 2699 |
> |
] |
| 2700 |
> |
[ |
| 2701 |
> |
.B input .. |
| 2702 |
> |
] |
| 2703 |
> |
.SH |
| 2704 |
> |
DESCRIPTION |
| 2705 |
> |
.LP |
| 2706 |
> |
.I Mgf2inv |
| 2707 |
> |
takes one or more MGF input files and converts it to |
| 2708 |
> |
Inventor or VRML format. |
| 2709 |
> |
If the |
| 2710 |
> |
.I \-1 |
| 2711 |
> |
option is used, then Inventor 1.0 ASCII output is produced. |
| 2712 |
> |
If the |
| 2713 |
> |
.I \-2 |
| 2714 |
> |
option is used, then Inventor 2.0 ASCII output is produced. |
| 2715 |
> |
(This is the default.)\0 |
| 2716 |
> |
If the |
| 2717 |
> |
.I \-vrml |
| 2718 |
> |
option is used, then VRML 1.0 ASCII output is produced. |
| 2719 |
> |
.LP |
| 2720 |
> |
This converter does not work properly for light sources, since |
| 2721 |
> |
the output formats do not support IES-type luminaires with recorded |
| 2722 |
> |
distributions. |
| 2723 |
> |
Also, some material information may be lost because Inventor lacks |
| 2724 |
> |
a physically valid reflectance model. |
| 2725 |
> |
.SH |
| 2726 |
> |
EXAMPLES |
| 2727 |
> |
.LP |
| 2728 |
> |
To take an MGF file and convert it to VRML format: |
| 2729 |
> |
.IP |
| 2730 |
> |
mgf2inv -vrml myscene.mgf > myscene.iv |
| 2731 |
> |
.SH |
| 2732 |
> |
SEE ALSO |
| 2733 |
> |
.LP |
| 2734 |
> |
mgf2rad(1), mgfilt(1), 3ds2mgf(1), rad2mgf(1) |
| 2735 |
> |
.ds RH 3DS2MGF |
| 2736 |
> |
.bp |
| 2737 |
> |
.SH |
| 2738 |
> |
NAME |
| 2739 |
> |
.LP |
| 2740 |
> |
3ds2mgf - convert 3D Studio binary file to Materials and Geometry Format |
| 2741 |
> |
.SH |
| 2742 |
> |
SYNOPSIS |
| 2743 |
> |
.LP |
| 2744 |
> |
.B 3ds2mgf |
| 2745 |
> |
.B input |
| 2746 |
> |
[ |
| 2747 |
> |
.B output |
| 2748 |
> |
] |
| 2749 |
> |
[ |
| 2750 |
> |
.B -lMatlib |
| 2751 |
> |
][ |
| 2752 |
> |
.B -xObjname |
| 2753 |
> |
][ |
| 2754 |
> |
.B -sAngle |
| 2755 |
> |
][ |
| 2756 |
> |
.B -aAnimfile |
| 2757 |
> |
][ |
| 2758 |
> |
.B -fN |
| 2759 |
> |
] |
| 2760 |
> |
.SH |
| 2761 |
> |
DESCRIPTION |
| 2762 |
> |
.LP |
| 2763 |
> |
.I 3ds2mgf |
| 2764 |
> |
converts a 3D Studio binary scene description |
| 2765 |
> |
to the Materials and Geometry Format (MGF). |
| 2766 |
> |
If no output file name is given, the input root name |
| 2767 |
> |
will be taken as the output root, and an "mgf" extension |
| 2768 |
> |
will be added. |
| 2769 |
> |
This file will contain any light sources and materials, and an include |
| 2770 |
> |
statement for a similarly named file ending in "inc", which will contain |
| 2771 |
> |
the MGF geometry of all the translated 3DS meshes. |
| 2772 |
> |
.LP |
| 2773 |
> |
The MGF material names and properties |
| 2774 |
> |
for the surfaces will be those assigned in 3D Studio, |
| 2775 |
> |
unless they are named in one or more MGF material libraries given in a |
| 2776 |
> |
.I -l |
| 2777 |
> |
option. |
| 2778 |
> |
.LP |
| 2779 |
> |
The |
| 2780 |
> |
.I -x |
| 2781 |
> |
option may be used to exclude a named object from the output. |
| 2782 |
> |
.LP |
| 2783 |
> |
The |
| 2784 |
> |
.I -s |
| 2785 |
> |
option may be used to adjust automatic mesh smoothing such that adjacent |
| 2786 |
> |
triangle faces with less than the given angle between them (in degrees) |
| 2787 |
> |
will be smoothed. |
| 2788 |
> |
A value of zero turns smoothing off. |
| 2789 |
> |
The default value is 60 degrees. |
| 2790 |
> |
.LP |
| 2791 |
> |
The |
| 2792 |
> |
.I -a |
| 2793 |
> |
option may be used to specify a 3D Studio animation file, and together with the |
| 2794 |
> |
.I -f |
| 2795 |
> |
option, |
| 2796 |
> |
.I 3ds2mgf |
| 2797 |
> |
will generate a scene description for the specified frame. |
| 2798 |
> |
.LP |
| 2799 |
> |
Note that there are no spaces between the options and their arguments. |
| 2800 |
> |
.SH |
| 2801 |
> |
LIMITATIONS |
| 2802 |
> |
.LP |
| 2803 |
> |
Obviously, since 3D Studio has no notion of physical materials, the |
| 2804 |
> |
translation to MGF material descriptions is very ad hoc, and it will |
| 2805 |
> |
usually be necessary to edit the materials and light sources in |
| 2806 |
> |
the output file or replace materials with proper entries from a material |
| 2807 |
> |
library using the |
| 2808 |
> |
.I -l |
| 2809 |
> |
option. |
| 2810 |
> |
.LP |
| 2811 |
> |
With smoothing turned on (i.e., a non-zero value for the |
| 2812 |
> |
.I -s |
| 2813 |
> |
option), vertices in the MGF output will not be linked in a proper |
| 2814 |
> |
mesh for each object. |
| 2815 |
> |
This is due to the way the automatic smoothing code was originally |
| 2816 |
> |
written, and is too difficult to repair. |
| 2817 |
> |
If a good mesh is needed, then smoothing must be turned off. |
| 2818 |
> |
.SH |
| 2819 |
> |
EXAMPLES |
| 2820 |
> |
.LP |
| 2821 |
> |
To convert a 3D Studio robot model to MGF without smoothing. |
| 2822 |
> |
(Output will be put into "robot.mgf" and "robot.inc".) |
| 2823 |
> |
.IP |
| 2824 |
> |
3ds2mgf robot.3ds -s0 |
| 2825 |
> |
.LP |
| 2826 |
> |
To convert a DC10 jet model to MGF using a hand-created material library: |
| 2827 |
> |
.IP |
| 2828 |
> |
3ds2mgf dc10.3ds -ldc10mat.mgf |
| 2829 |
> |
.SH |
| 2830 |
> |
AUTHORS |
| 2831 |
> |
.LP |
| 2832 |
> |
Steve Anger, Jeff Bowermaster and Greg Ward |
| 2833 |
> |
.br |
| 2834 |
> |
Extended from 3ds2pov 1.8. |
| 2835 |
> |
.SH |
| 2836 |
> |
SEE ALSO |
| 2837 |
> |
.LP |
| 2838 |
> |
mgf2inv(1), mgf2meta(1), mgf2rad(1) |
| 2839 |
|
.ds RH MGF2RAD |
| 2840 |
|
.bp |
| 2841 |
|
.SH |
| 2939 |
|
SEE ALSO |
| 2940 |
|
.LP |
| 2941 |
|
ies2rad(1), mgf2meta(1), obj2rad(1), oconv(1), rad2mgf(1), xform(1) |
| 2942 |
< |
.ds RH |
| 2699 |
< |
RAD2MGF |
| 2942 |
> |
.ds RH RAD2MGF |
| 2943 |
|
.bp |
| 2944 |
|
.SH |
| 2945 |
|
NAME |
| 3228 |
|
|
| 3229 |
|
if (ac < 4) /* check # arguments */ |
| 3230 |
|
return(MG_EARGC); |
| 3231 |
< |
printf("face\n"); /* begin face output */ |
| 3231 |
> |
printf("face\\\\n"); /* begin face output */ |
| 3232 |
|
for (i = 1; i < ac; i++) { |
| 3233 |
|
if ((vp = c_getvert(av[i])) == NULL) /* vertex from name */ |
| 3234 |
|
return(MG_EUNDEF); |
| 3235 |
|
xf_xfmpoint(vert, vp->p); /* apply transform */ |
| 3236 |
< |
printf("%15.9f %15.9f %15.9f\n", |
| 3236 |
> |
printf("%15.9f %15.9f %15.9f\\\\n", |
| 3237 |
|
vert[0], vert[1], vert[2]); /* output vertex */ |
| 3238 |
|
} |
| 3239 |
< |
printf(";\\n"); /* end of face output */ |
| 3239 |
> |
printf(";\\\\n"); /* end of face output */ |
| 3240 |
|
return(MG_OK); /* normal exit */ |
| 3241 |
|
} |
| 3242 |
|
|
| 3365 |
|
#define MG_E_CMIX 4 /* cmix */ |
| 3366 |
|
#define MG_E_CSPEC 5 /* cspec */ |
| 3367 |
|
#define MG_E_CXY 6 /* cxy */ |
| 3368 |
< |
#define MG_E_CYL 7 /* cyl */ |
| 3368 |
> |
#define MG_E_CYL 7 /* cyl */ |
| 3369 |
|
#define MG_E_ED 8 /* ed */ |
| 3370 |
|
#define MG_E_FACE 9 /* f */ |
| 3371 |
|
#define MG_E_INCLUDE 10 /* i */ |
| 3372 |
|
#define MG_E_IES 11 /* ies */ |
| 3373 |
< |
#define MG_E_IR 12 /* ir */ |
| 3373 |
> |
#define MG_E_IR 12 /* ir */ |
| 3374 |
|
#define MG_E_MATERIAL 13 /* m */ |
| 3375 |
|
#define MG_E_NORMAL 14 /* n */ |
| 3376 |
|
#define MG_E_OBJECT 15 /* o */ |
| 3510 |
|
#define MG_EUNK 1 /* unknown entity */ |
| 3511 |
|
#define MG_EARGC 2 /* wrong number of arguments */ |
| 3512 |
|
#define MG_ETYPE 3 /* argument type error */ |
| 3513 |
< |
#define MG_EILL 4 /* illegal argument value */ |
| 3513 |
> |
#define MG_EILL 4 /* illegal argument value */ |
| 3514 |
|
#define MG_EUNDEF 5 /* undefined reference */ |
| 3515 |
|
#define MG_ENOFILE 6 /* cannot open input file */ |
| 3516 |
|
#define MG_EINCL 7 /* error in included file */ |
| 3517 |
|
#define MG_EMEM 8 /* out of memory */ |
| 3518 |
|
#define MG_ESEEK 9 /* file seek error */ |
| 3519 |
|
#define MG_EBADMAT 10 /* bad material specification */ |
| 3520 |
+ |
#define MG_ELINE 11 /* input line too long */ |
| 3521 |
+ |
#define MG_ECNTXT 12 /* unmatched context close */ |
| 3522 |
|
|
| 3523 |
< |
#define MG_NERRS 11 |
| 3523 |
> |
#define MG_NERRS 13 |
| 3524 |
|
.DE |
| 3525 |
|
If it is inappropriate to send output to standard error, the calling |
| 3526 |
|
program should use the routines listed under |
| 3534 |
|
.SH |
| 3535 |
|
SEE ALSO |
| 3536 |
|
.LP |
| 3537 |
< |
mg_fgetpos, mg_handle, mg_init |
| 3537 |
> |
mg_fgetpos, mg_handle, mg_init, mg_open |
| 3538 |
|
.ds RH MG_OPEN |
| 3539 |
|
.bp |
| 3540 |
|
.SH |
| 3604 |
|
function reads the next input line from the current file, |
| 3605 |
|
returning the number of characters in the line, or zero if the |
| 3606 |
|
end of file is reached or there is a file error. |
| 3607 |
< |
The function skips over escaped newlines, and keeps track of the |
| 3607 |
> |
If the value returned equals MG_MAXLINE-1, |
| 3608 |
> |
then the input line was too long, and you |
| 3609 |
> |
should return an MG_ELINE error. |
| 3610 |
> |
The function keeps track of the |
| 3611 |
|
line number in the current file context |
| 3612 |
|
.I mg_file, |
| 3613 |
|
which also contains the line that was read. |
| 3927 |
|
|
| 3928 |
|
typedef struct { |
| 3929 |
|
int clock; /* incremented each change -- resettable */ |
| 3930 |
+ |
char *client_data; /* pointer to private client data */ |
| 3931 |
|
FVECT p, n; /* point and normal */ |
| 3932 |
|
} C_VERTEX; /* vertex context */ |
| 3933 |
|
.DE |
| 3944 |
|
transform has not changed, which is uniquely identified by the |
| 3945 |
|
global |
| 3946 |
|
.I xf_context->xid |
| 3947 |
< |
variable, but only if one is using the parser libraries transform |
| 3947 |
> |
variable, but only if one is using the parser library's transform |
| 3948 |
|
handler. |
| 3949 |
|
(See the |
| 3950 |
|
.I xf_handler |
| 3951 |
|
page.)\0 |
| 3952 |
+ |
The |
| 3953 |
+ |
.I client_data |
| 3954 |
+ |
pointer may be used to index private application data for vertex |
| 3955 |
+ |
linking, etc. |
| 3956 |
+ |
This pointer is initialized to NULL when the context is created, |
| 3957 |
+ |
and otherwise ignored by the parser library. |
| 3958 |
|
.LP |
| 3959 |
< |
It is possible but not recommended to alter the contents of the |
| 3959 |
> |
It is possible but not recommended to alter the shared contents of the |
| 3960 |
|
vertex structure returned by |
| 3961 |
|
.I c_getvert. |
| 3962 |
|
Normally it is read during the |
| 4077 |
|
|
| 4078 |
|
typedef struct { |
| 4079 |
|
int clock; /* incremented each change */ |
| 4080 |
+ |
char *client_data; /* pointer to private client data */ |
| 4081 |
|
short flags; /* what's been set */ |
| 4082 |
|
short ssamp[C_CNSS]; /* spectral samples, min wl to max */ |
| 4083 |
|
long ssum; /* straight sum of spectral values */ |
| 4093 |
|
This is a convenient way to keep track of whether or not a color has |
| 4094 |
|
changed since its last use. |
| 4095 |
|
The |
| 4096 |
+ |
.I client_data |
| 4097 |
+ |
pointer may be used to index private application data. |
| 4098 |
+ |
This pointer is initialized to NULL when the context is created, |
| 4099 |
+ |
and otherwise ignored by the parser library. |
| 4100 |
+ |
The |
| 4101 |
|
.I flags |
| 4102 |
|
member indicates which color representations have been assigned, |
| 4103 |
|
and is an inclusive OR of one or more of the following: |
| 4242 |
|
|
| 4243 |
|
typedef struct { |
| 4244 |
|
int clock; /* incremented each change -- resettable */ |
| 4245 |
+ |
char *client_data; /* pointer to private client data */ |
| 4246 |
|
int sided; /* 1 if surface is 1-sided, 0 for 2-sided */ |
| 4247 |
|
float nr, ni; /* index of refraction, real and imaginary */ |
| 4248 |
|
float rd; /* diffuse reflectance */ |
| 4266 |
|
desired. |
| 4267 |
|
This is a convenient way to keep track of whether or not a material has |
| 4268 |
|
changed since its last use. |
| 4269 |
+ |
The |
| 4270 |
+ |
.I client_data |
| 4271 |
+ |
pointer may be used to index private application data. |
| 4272 |
+ |
This pointer is initialized to NULL when the context is created, |
| 4273 |
+ |
and otherwise ignored by the parser library. |
| 4274 |
|
.LP |
| 4275 |
|
All reflectance and transmittance values correspond to normal |
| 4276 |
|
incidence, and may vary as a function of angle depending on the |
| 4542 |
|
.SH |
| 4543 |
|
NAME |
| 4544 |
|
.LP |
| 4545 |
< |
xf_xfmpoint xf_xfmvect, xf_rotvect, xf_scale - apply current |
| 4545 |
> |
xf_xfmpoint, xf_xfmvect, xf_rotvect, xf_scale - apply current |
| 4546 |
|
transformation |
| 4547 |
|
.SH |
| 4548 |
|
SYNOPSIS |
| 4571 |
|
.I pold, |
| 4572 |
|
scaling, rotating and moving it to its proper location, which is put in |
| 4573 |
|
.I pnew. |
| 4574 |
< |
(The two arguments may point to the same vector.)\0 |
| 4574 |
> |
(As for |
| 4575 |
> |
.I xf_xfmvect |
| 4576 |
> |
and |
| 4577 |
> |
.I xf_rotvect, |
| 4578 |
> |
the two arguments may point to the same vector.)\0 |
| 4579 |
|
.LP |
| 4580 |
|
The |
| 4581 |
|
.I xf_xfmvect |
| 4583 |
|
.I vold, |
| 4584 |
|
scaling and rotating it to its proper location, which is put in |
| 4585 |
|
.I vnew. |
| 4315 |
– |
(The two arguments may point to the same vector.)\0 |
| 4586 |
|
The only difference between |
| 4587 |
|
.I xf_xfmpoint |
| 4588 |
|
and |
| 4595 |
|
.I nold |
| 4596 |
|
using the current transformation, and stores the result in |
| 4597 |
|
.I nnew. |
| 4328 |
– |
(The two arguments may point to the same vector.)\0 |
| 4598 |
|
No translation or scaling is applied, which is the appropriate |
| 4599 |
|
action for surface normal vectors for example. |
| 4600 |
|
.LP |
| 4693 |
|
The hardest part is translating the specular power to a roughness value. |
| 4694 |
|
For this, we recommend the following approximation: |
| 4695 |
|
.IP |
| 4696 |
< |
roughness = 0.6/sqrt(specular_power) |
| 4696 |
> |
roughness = sqrt(2/specular_power) |
| 4697 |
|
.LP |
| 4698 |
|
It is not a perfect correlation, but it is about as close as one can get. |
| 4699 |
|
.NH 3 |
| 4755 |
|
#define CIE_y_w 0.3333 |
| 4756 |
|
#endif |
| 4757 |
|
|
| 4758 |
< |
#define CIE_D ( CIE_x_r*(CIE_y_g - CIE_y_b) + \\\\ |
| 4759 |
< |
CIE_x_g*(CIE_y_b - CIE_y_r) + \\\\ |
| 4758 |
> |
#define CIE_D ( CIE_x_r*(CIE_y_g - CIE_y_b) + \\ |
| 4759 |
> |
CIE_x_g*(CIE_y_b - CIE_y_r) + \\ |
| 4760 |
|
CIE_x_b*(CIE_y_r - CIE_y_g) ) |
| 4761 |
< |
#define CIE_C_rD ( (1./CIE_y_w) * \\\\ |
| 4762 |
< |
( CIE_x_w*(CIE_y_g - CIE_y_b) - \\\\ |
| 4763 |
< |
CIE_y_w*(CIE_x_g - CIE_x_b) + \\\\ |
| 4761 |
> |
#define CIE_C_rD ( (1./CIE_y_w) * \\ |
| 4762 |
> |
( CIE_x_w*(CIE_y_g - CIE_y_b) - \\ |
| 4763 |
> |
CIE_y_w*(CIE_x_g - CIE_x_b) + \\ |
| 4764 |
|
CIE_x_g*CIE_y_b - CIE_x_b*CIE_y_g ) ) |
| 4765 |
< |
#define CIE_C_gD ( (1./CIE_y_w) * \\\\ |
| 4766 |
< |
( CIE_x_w*(CIE_y_b - CIE_y_r) - \\\\ |
| 4767 |
< |
CIE_y_w*(CIE_x_b - CIE_x_r) - \\\\ |
| 4765 |
> |
#define CIE_C_gD ( (1./CIE_y_w) * \\ |
| 4766 |
> |
( CIE_x_w*(CIE_y_b - CIE_y_r) - \\ |
| 4767 |
> |
CIE_y_w*(CIE_x_b - CIE_x_r) - \\ |
| 4768 |
|
CIE_x_r*CIE_y_b + CIE_x_b*CIE_y_r ) ) |
| 4769 |
< |
#define CIE_C_bD ( (1./CIE_y_w) * \\\\ |
| 4770 |
< |
( CIE_x_w*(CIE_y_r - CIE_y_g) - \\\\ |
| 4771 |
< |
CIE_y_w*(CIE_x_r - CIE_x_g) + \\\\ |
| 4769 |
> |
#define CIE_C_bD ( (1./CIE_y_w) * \\ |
| 4770 |
> |
( CIE_x_w*(CIE_y_r - CIE_y_g) - \\ |
| 4771 |
> |
CIE_y_w*(CIE_x_r - CIE_x_g) + \\ |
| 4772 |
|
CIE_x_r*CIE_y_g - CIE_x_g*CIE_y_r ) ) |
| 4773 |
|
|
| 4774 |
|
#define CIE_rf (CIE_y_r*CIE_C_rD/CIE_D) |