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 |
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) |
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 |
2071 |
|
Also, specified normals should point in the general direction of the |
2072 |
|
surface for best results. |
2073 |
|
.LP |
2074 |
< |
There is no explicit representation of holes in MGF. A hole must be |
2075 |
< |
represented implicitly by connecting vertices to form "seams." For |
2074 |
> |
There is no explicit representation of holes in this entity, but see |
2075 |
> |
the |
2076 |
> |
.UL fh |
2077 |
> |
entity for an alternative specification. |
2078 |
> |
.LP |
2079 |
> |
A hole may be represented implicitly in a face entity |
2080 |
> |
by connecting vertices to form "seams." |
2081 |
> |
For |
2082 |
|
example, a wall with a window in it might look as shown in Figure 1. |
2083 |
|
In many systems, the wall itself would be represented with the first |
2084 |
|
list of vertices, (v1,v2,v3,v4) and the hole associated with that |
2085 |
< |
wall as a second set of vertices (v5,v6,v7,v8). In MGF, we must |
2085 |
> |
wall as a second set of vertices (v5,v6,v7,v8). |
2086 |
> |
Using the face entity, we must |
2087 |
|
give the whole thing as a single polygon, connecting the vertices so |
2088 |
|
as to create a "seam," as shown in Figure 2. |
2089 |
< |
This could be written in MGF as "f v1 v2 v3 v4 v5 v6 v7 v8 v5 v4". |
2089 |
> |
This could be written as "f v1 v2 v3 v4 v5 v6 v7 v8 v5 v4". |
2090 |
|
.LP |
2091 |
|
It is very important that the order of the hole be opposite to the |
2092 |
|
order of the outer perimeter, otherwise the polygon will be |
2135 |
|
.LP |
2136 |
|
.UL cone, |
2137 |
|
.UL cyl, |
2138 |
+ |
.UL fh, |
2139 |
|
.UL m, |
2140 |
|
.UL prism, |
2141 |
|
.UL ring, |
2142 |
|
.UL sph, |
2143 |
|
.UL torus, |
2144 |
|
.UL v |
2145 |
+ |
.ds RH FH |
2146 |
+ |
.bp |
2147 |
+ |
.SH |
2148 |
+ |
NAME |
2149 |
+ |
.LP |
2150 |
+ |
fh - create a polygonal face with explicit holes |
2151 |
+ |
.SH |
2152 |
+ |
SYNOPSIS |
2153 |
+ |
.LP |
2154 |
+ |
.B fh |
2155 |
+ |
.I "p1 p2 ... - h1.1 h1.2 ... - h2.1 h2.2 ..." |
2156 |
+ |
.SH |
2157 |
+ |
DESCRIPTION |
2158 |
+ |
.LP |
2159 |
+ |
Create a polygonal face with optional holes made of the current material. |
2160 |
+ |
The first contour is the outer perimeter, with vertices given in |
2161 |
+ |
counter-clockwise order as seen from the front side (the same as the |
2162 |
+ |
.UL f |
2163 |
+ |
entity). |
2164 |
+ |
A hole is indicated by a hyphen ('-') followed by the hole's |
2165 |
+ |
vertices, given in clockwise order as seen from the front side. |
2166 |
+ |
Multiple hole contours are separated by additional hyphens. |
2167 |
+ |
There must be at least three vertices for each contour, and the |
2168 |
+ |
last vertex is implicitly connected to the first. |
2169 |
+ |
If any vertex is undefined, an error will result. |
2170 |
+ |
.LP |
2171 |
+ |
If any vertices have associated surface normals, they will be used |
2172 |
+ |
instead of the average plane normal, though it is safest to specify |
2173 |
+ |
either all normals or no normals, and to stick with triangles |
2174 |
+ |
when normals are used. |
2175 |
+ |
Also, specified normals should point in the general direction of the |
2176 |
+ |
surface for best results. |
2177 |
+ |
.SH |
2178 |
+ |
EXAMPLE |
2179 |
+ |
.DS |
2180 |
+ |
# Make a wall with a window using an explicit hole. |
2181 |
+ |
# (See Figures 1 and 2.) |
2182 |
+ |
fh v1 v2 v3 v4 - v5 v6 v7 v8 |
2183 |
+ |
.DE |
2184 |
+ |
.SH |
2185 |
+ |
SEE ALSO |
2186 |
+ |
.LP |
2187 |
+ |
.UL cone, |
2188 |
+ |
.UL cyl, |
2189 |
+ |
.UL f, |
2190 |
+ |
.UL m, |
2191 |
+ |
.UL prism, |
2192 |
+ |
.UL ring, |
2193 |
+ |
.UL sph, |
2194 |
+ |
.UL torus, |
2195 |
+ |
.UL v |
2196 |
|
.ds RH SPH |
2197 |
|
.bp |
2198 |
|
.SH |
2563 |
|
.NH |
2564 |
|
MGF Translators |
2565 |
|
.LP |
2566 |
< |
Initially, there are five translators for MGF data, but only |
2567 |
< |
two of these are distributed with the MGF parser itself, |
2568 |
< |
.I mgfilt |
2566 |
> |
Initially, there are six translators for MGF data, and |
2567 |
> |
three of these are distributed with the MGF parser itself, |
2568 |
> |
.I mgfilt, |
2569 |
> |
.I mgf2inv |
2570 |
|
and |
2571 |
< |
.I mgf2inv. |
2571 |
> |
.I 3ds2mgf. |
2572 |
|
Two of the other translators, |
2573 |
|
.I mgf2rad |
2574 |
|
and |
2581 |
|
nestor.epfl.ch, or by WWW from |
2582 |
|
"http://radsite.lbl.gov/radiance/HOME.html" |
2583 |
|
.FE |
2584 |
< |
The fifth translator, |
2584 |
> |
The sixth translator, |
2585 |
|
.I mgf2meta, |
2586 |
|
converts to a 2-dimensional line plot, and is also |
2587 |
|
distributed with Radiance. |
2602 |
|
Mgf2inv converts from MGF to Inventor or VRML format. |
2603 |
|
Some information is lost, because these formats do not support |
2604 |
|
physical light sources or materials. |
2605 |
+ |
.LP |
2606 |
+ |
3ds2mgf converts from 3D Studio binary format to MGF. |
2607 |
+ |
Care must be taken to correct for errors in the material descriptions, |
2608 |
+ |
since 3D Studio is completely non-physical. |
2609 |
|
.ds LH Translators |
2610 |
|
.ds RH MGFILT |
2611 |
|
.bp |
2716 |
|
.SH |
2717 |
|
SEE ALSO |
2718 |
|
.LP |
2719 |
< |
mgf2rad, mgfilt, rad2mgf |
2719 |
> |
mgf2rad(1), mgfilt(1), 3ds2mgf(1), rad2mgf(1) |
2720 |
> |
.ds RH 3DS2MGF |
2721 |
> |
.bp |
2722 |
> |
.SH |
2723 |
> |
NAME |
2724 |
> |
.LP |
2725 |
> |
3ds2mgf - convert 3D Studio binary file to Materials and Geometry Format |
2726 |
> |
.SH |
2727 |
> |
SYNOPSIS |
2728 |
> |
.LP |
2729 |
> |
.B 3ds2mgf |
2730 |
> |
.B input |
2731 |
> |
[ |
2732 |
> |
.B output |
2733 |
> |
] |
2734 |
> |
[ |
2735 |
> |
.B -lMatlib |
2736 |
> |
][ |
2737 |
> |
.B -xObjname |
2738 |
> |
][ |
2739 |
> |
.B -sAngle |
2740 |
> |
][ |
2741 |
> |
.B -aAnimfile |
2742 |
> |
][ |
2743 |
> |
.B -fN |
2744 |
> |
] |
2745 |
> |
.SH |
2746 |
> |
DESCRIPTION |
2747 |
> |
.LP |
2748 |
> |
.I 3ds2mgf |
2749 |
> |
converts a 3D Studio binary scene description |
2750 |
> |
to the Materials and Geometry Format (MGF). |
2751 |
> |
If no output file name is given, the input root name |
2752 |
> |
will be taken as the output root, and an "mgf" extension |
2753 |
> |
will be added. |
2754 |
> |
This file will contain any light sources and materials, and an include |
2755 |
> |
statement for a similarly named file ending in "inc", which will contain |
2756 |
> |
the MGF geometry of all the translated 3DS meshes. |
2757 |
> |
.LP |
2758 |
> |
The MGF material names and properties |
2759 |
> |
for the surfaces will be those assigned in 3D Studio, |
2760 |
> |
unless they are named in one or more MGF material libraries given in a |
2761 |
> |
.I -l |
2762 |
> |
option. |
2763 |
> |
.LP |
2764 |
> |
The |
2765 |
> |
.I -x |
2766 |
> |
option may be used to exclude a named object from the output. |
2767 |
> |
.LP |
2768 |
> |
The |
2769 |
> |
.I -s |
2770 |
> |
option may be used to adjust automatic mesh smoothing such that adjacent |
2771 |
> |
triangle faces with less than the given angle between them (in degrees) |
2772 |
> |
will be smoothed. |
2773 |
> |
A value of zero turns smoothing off. |
2774 |
> |
The default value is 60 degrees. |
2775 |
> |
.LP |
2776 |
> |
The |
2777 |
> |
.I -a |
2778 |
> |
option may be used to specify a 3D Studio animation file, and together with the |
2779 |
> |
.I -f |
2780 |
> |
option, |
2781 |
> |
.I 3ds2mgf |
2782 |
> |
will generate a scene description for the specified frame. |
2783 |
> |
.LP |
2784 |
> |
Note that there are no spaces between the options and their arguments. |
2785 |
> |
.SH |
2786 |
> |
LIMITATIONS |
2787 |
> |
.LP |
2788 |
> |
Obviously, since 3D Studio has no notion of physical materials, the |
2789 |
> |
translation to MGF material descriptions is very ad hoc, and it will |
2790 |
> |
usually be necessary to edit the materials and light sources in |
2791 |
> |
the output file or replace materials with proper entries from a material |
2792 |
> |
library using the |
2793 |
> |
.I -l |
2794 |
> |
option. |
2795 |
> |
.LP |
2796 |
> |
With smoothing turned on (i.e., a non-zero value for the |
2797 |
> |
.I -s |
2798 |
> |
option), vertices in the MGF output will not be linked in a proper |
2799 |
> |
mesh for each object. |
2800 |
> |
This is due to the way the automatic smoothing code was originally |
2801 |
> |
written, and is too difficult to repair. |
2802 |
> |
If a good mesh is needed, then smoothing must be turned off. |
2803 |
> |
.SH |
2804 |
> |
EXAMPLES |
2805 |
> |
.LP |
2806 |
> |
To convert a 3D Studio robot model to MGF without smoothing. |
2807 |
> |
(Output will be put into "robot.mgf" and "robot.inc".) |
2808 |
> |
.IP |
2809 |
> |
3ds2mgf robot.3ds -s0 |
2810 |
> |
.LP |
2811 |
> |
To convert a DC10 jet model to MGF using a hand-created material library: |
2812 |
> |
.IP |
2813 |
> |
3ds2mgf dc10.3ds -ldc10mat.mgf |
2814 |
> |
.SH |
2815 |
> |
AUTHORS |
2816 |
> |
.LP |
2817 |
> |
Steve Anger, Jeff Bowermaster and Greg Ward |
2818 |
> |
.br |
2819 |
> |
Extended from 3ds2pov 1.8. |
2820 |
> |
.SH |
2821 |
> |
SEE ALSO |
2822 |
> |
.LP |
2823 |
> |
mgf2inv(1), mgf2meta(1), mgf2rad(1) |
2824 |
|
.ds RH MGF2RAD |
2825 |
|
.bp |
2826 |
|
.SH |
3495 |
|
#define MG_EUNK 1 /* unknown entity */ |
3496 |
|
#define MG_EARGC 2 /* wrong number of arguments */ |
3497 |
|
#define MG_ETYPE 3 /* argument type error */ |
3498 |
< |
#define MG_EILL 4 /* illegal argument value */ |
3498 |
> |
#define MG_EILL 4 /* illegal argument value */ |
3499 |
|
#define MG_EUNDEF 5 /* undefined reference */ |
3500 |
|
#define MG_ENOFILE 6 /* cannot open input file */ |
3501 |
|
#define MG_EINCL 7 /* error in included file */ |
3505 |
|
#define MG_ELINE 11 /* input line too long */ |
3506 |
|
#define MG_ECNTXT 12 /* unmatched context close */ |
3507 |
|
|
3508 |
< |
#define MG_NERRS 13 |
3508 |
> |
#define MG_NERRS 13 |
3509 |
|
.DE |
3510 |
|
If it is inappropriate to send output to standard error, the calling |
3511 |
|
program should use the routines listed under |
3928 |
|
transform has not changed, which is uniquely identified by the |
3929 |
|
global |
3930 |
|
.I xf_context->xid |
3931 |
< |
variable, but only if one is using the parser libraries transform |
3931 |
> |
variable, but only if one is using the parser library's transform |
3932 |
|
handler. |
3933 |
|
(See the |
3934 |
|
.I xf_handler |
4659 |
|
The hardest part is translating the specular power to a roughness value. |
4660 |
|
For this, we recommend the following approximation: |
4661 |
|
.IP |
4662 |
< |
roughness = 0.6/sqrt(specular_power) |
4662 |
> |
roughness = sqrt(2/specular_power) |
4663 |
|
.LP |
4664 |
|
It is not a perfect correlation, but it is about as close as one can get. |
4665 |
|
.NH 3 |