| 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 | 
| 283 | 
  | 
T} | 
| 284 | 
  | 
Material        m       2-sided black   T{ | 
| 285 | 
  | 
sides, rd, td, | 
| 286 | 
< | 
ed, rs, ts | 
| 286 | 
> | 
ed, rs, ts, ir | 
| 287 | 
  | 
T}      T{ | 
| 288 | 
  | 
f, sph, cyl, cone, | 
| 289 | 
  | 
ring, torus, prism | 
| 1675 | 
  | 
# A 100-watt incandescent bulb (1600 lumens) modeled as a sphere | 
| 1676 | 
  | 
m | 
| 1677 | 
  | 
        c | 
| 1678 | 
< | 
        cct 3000 | 
| 1678 | 
> | 
                cct 3000 | 
| 1679 | 
  | 
        ed 87712 | 
| 1680 | 
  | 
v cent = | 
| 1681 | 
  | 
        p 0 0 0 | 
| 2502 | 
  | 
.NH | 
| 2503 | 
  | 
MGF Translators | 
| 2504 | 
  | 
.LP | 
| 2505 | 
< | 
Initially, there are four translators for MGF data, but only | 
| 2506 | 
< | 
one of these is distributed with the MGF parser itself, | 
| 2507 | 
< | 
.I mgfilt. | 
| 2505 | 
> | 
Initially, there are six translators for MGF data, and | 
| 2506 | 
> | 
three of these are distributed with the MGF parser itself, | 
| 2507 | 
> | 
.I mgfilt, | 
| 2508 | 
> | 
.I mgf2inv | 
| 2509 | 
> | 
and | 
| 2510 | 
> | 
.I 3ds2mgf. | 
| 2511 | 
  | 
Two of the other translators, | 
| 2512 | 
  | 
.I mgf2rad | 
| 2513 | 
  | 
and | 
| 2520 | 
  | 
nestor.epfl.ch, or by WWW from | 
| 2521 | 
  | 
"http://radsite.lbl.gov/radiance/HOME.html" | 
| 2522 | 
  | 
.FE | 
| 2523 | 
< | 
A third translator, | 
| 2523 | 
> | 
The sixth translator, | 
| 2524 | 
  | 
.I mgf2meta, | 
| 2525 | 
  | 
converts to a 2-dimensional line plot, and is also | 
| 2526 | 
  | 
distributed with Radiance. | 
| 2537 | 
  | 
In future releases of MGF, this utility will also be handy for | 
| 2538 | 
  | 
taking new entities and producing older versions of MGF for | 
| 2539 | 
  | 
translators that have not yet been updated properly. | 
| 2540 | 
+ | 
.LP | 
| 2541 | 
+ | 
Mgf2inv converts from MGF to Inventor or VRML format. | 
| 2542 | 
+ | 
Some information is lost, because these formats do not support | 
| 2543 | 
+ | 
physical light sources or materials. | 
| 2544 | 
+ | 
.LP | 
| 2545 | 
+ | 
3ds2mgf converts from 3D Studio binary format to MGF. | 
| 2546 | 
+ | 
Care must be taken to correct for errors in the material descriptions, | 
| 2547 | 
+ | 
since 3D Studio is completely non-physical. | 
| 2548 | 
  | 
.ds LH Translators | 
| 2549 | 
  | 
.ds RH MGFILT | 
| 2550 | 
  | 
.bp | 
| 2607 | 
  | 
.SH | 
| 2608 | 
  | 
SEE ALSO | 
| 2609 | 
  | 
.LP | 
| 2610 | 
< | 
i, mgf2rad, rad2mgf | 
| 2610 | 
> | 
i, mgf2inv, mgf2rad, rad2mgf | 
| 2611 | 
> | 
.ds RH MGF2INV | 
| 2612 | 
> | 
.bp | 
| 2613 | 
> | 
.SH | 
| 2614 | 
> | 
NAME | 
| 2615 | 
> | 
.LP | 
| 2616 | 
> | 
mgf2inv - convert from MGF to Inventor or VRML format | 
| 2617 | 
> | 
.SH | 
| 2618 | 
> | 
SYNOPSIS | 
| 2619 | 
> | 
.LP | 
| 2620 | 
> | 
.B mgf2inv | 
| 2621 | 
> | 
[ | 
| 2622 | 
> | 
.B "-1|-2|-vrml" | 
| 2623 | 
> | 
] | 
| 2624 | 
> | 
[ | 
| 2625 | 
> | 
.B input .. | 
| 2626 | 
> | 
] | 
| 2627 | 
> | 
.SH | 
| 2628 | 
> | 
DESCRIPTION | 
| 2629 | 
> | 
.LP | 
| 2630 | 
> | 
.I Mgf2inv | 
| 2631 | 
> | 
takes one or more MGF input files and converts it to | 
| 2632 | 
> | 
Inventor or VRML format. | 
| 2633 | 
> | 
If the | 
| 2634 | 
> | 
.I \-1 | 
| 2635 | 
> | 
option is used, then Inventor 1.0 ASCII output is produced. | 
| 2636 | 
> | 
If the | 
| 2637 | 
> | 
.I \-2 | 
| 2638 | 
> | 
option is used, then Inventor 2.0 ASCII output is produced. | 
| 2639 | 
> | 
(This is the default.)\0 | 
| 2640 | 
> | 
If the | 
| 2641 | 
> | 
.I \-vrml | 
| 2642 | 
> | 
option is used, then VRML 1.0 ASCII output is produced. | 
| 2643 | 
> | 
.LP | 
| 2644 | 
> | 
This converter does not work properly for light sources, since | 
| 2645 | 
> | 
the output formats do not support IES-type luminaires with recorded | 
| 2646 | 
> | 
distributions. | 
| 2647 | 
> | 
Also, some material information may be lost because Inventor lacks | 
| 2648 | 
> | 
a physically valid reflectance model. | 
| 2649 | 
> | 
.SH | 
| 2650 | 
> | 
EXAMPLES | 
| 2651 | 
> | 
.LP | 
| 2652 | 
> | 
To take an MGF file and convert it to VRML format: | 
| 2653 | 
> | 
.IP | 
| 2654 | 
> | 
mgf2inv -vrml myscene.mgf > myscene.iv | 
| 2655 | 
> | 
.SH | 
| 2656 | 
> | 
SEE ALSO | 
| 2657 | 
> | 
.LP | 
| 2658 | 
> | 
mgf2rad(1), mgfilt(1), 3ds2mgf(1), rad2mgf(1) | 
| 2659 | 
> | 
.ds RH 3DS2MGF | 
| 2660 | 
> | 
.bp | 
| 2661 | 
> | 
.SH | 
| 2662 | 
> | 
NAME | 
| 2663 | 
> | 
.LP | 
| 2664 | 
> | 
3ds2mgf - convert 3D Studio binary file to Materials and Geometry Format | 
| 2665 | 
> | 
.SH | 
| 2666 | 
> | 
SYNOPSIS | 
| 2667 | 
> | 
.LP | 
| 2668 | 
> | 
.B 3ds2mgf | 
| 2669 | 
> | 
.B input | 
| 2670 | 
> | 
[ | 
| 2671 | 
> | 
.B output | 
| 2672 | 
> | 
] | 
| 2673 | 
> | 
[ | 
| 2674 | 
> | 
.B -lMatlib | 
| 2675 | 
> | 
][ | 
| 2676 | 
> | 
.B -xObjname | 
| 2677 | 
> | 
][ | 
| 2678 | 
> | 
.B -sAngle | 
| 2679 | 
> | 
][ | 
| 2680 | 
> | 
.B -aAnimfile | 
| 2681 | 
> | 
][ | 
| 2682 | 
> | 
.B -fN | 
| 2683 | 
> | 
] | 
| 2684 | 
> | 
.SH | 
| 2685 | 
> | 
DESCRIPTION | 
| 2686 | 
> | 
.LP | 
| 2687 | 
> | 
.I 3ds2mgf | 
| 2688 | 
> | 
converts a 3D Studio binary scene description | 
| 2689 | 
> | 
to the Materials and Geometry Format (MGF). | 
| 2690 | 
> | 
If no output file name is given, the input root name | 
| 2691 | 
> | 
will be taken as the output root, and an "mgf" extension | 
| 2692 | 
> | 
will be added. | 
| 2693 | 
> | 
This file will contain any light sources and materials, and an include | 
| 2694 | 
> | 
statement for a similarly named file ending in "inc", which will contain | 
| 2695 | 
> | 
the MGF geometry of all the translated 3DS meshes. | 
| 2696 | 
> | 
.LP | 
| 2697 | 
> | 
The MGF material names and properties | 
| 2698 | 
> | 
for the surfaces will be those assigned in 3D Studio, | 
| 2699 | 
> | 
unless they are named in one or more MGF material libraries given in a | 
| 2700 | 
> | 
.I -l | 
| 2701 | 
> | 
option. | 
| 2702 | 
> | 
.LP | 
| 2703 | 
> | 
The | 
| 2704 | 
> | 
.I -x | 
| 2705 | 
> | 
option may be used to exclude a named object from the output. | 
| 2706 | 
> | 
.LP | 
| 2707 | 
> | 
The | 
| 2708 | 
> | 
.I -s | 
| 2709 | 
> | 
option may be used to adjust automatic mesh smoothing such that adjacent | 
| 2710 | 
> | 
triangle faces with less than the given angle between them (in degrees) | 
| 2711 | 
> | 
will be smoothed. | 
| 2712 | 
> | 
A value of zero turns smoothing off. | 
| 2713 | 
> | 
The default value is 60 degrees. | 
| 2714 | 
> | 
.LP | 
| 2715 | 
> | 
The | 
| 2716 | 
> | 
.I -a | 
| 2717 | 
> | 
option may be used to specify a 3D Studio animation file, and together with the | 
| 2718 | 
> | 
.I -f | 
| 2719 | 
> | 
option, | 
| 2720 | 
> | 
.I 3ds2mgf | 
| 2721 | 
> | 
will generate a scene description for the specified frame. | 
| 2722 | 
> | 
.LP | 
| 2723 | 
> | 
Note that there are no spaces between the options and their arguments. | 
| 2724 | 
> | 
.SH | 
| 2725 | 
> | 
LIMITATIONS | 
| 2726 | 
> | 
.LP | 
| 2727 | 
> | 
Obviously, since 3D Studio has no notion of physical materials, the | 
| 2728 | 
> | 
translation to MGF material descriptions is very ad hoc, and it will | 
| 2729 | 
> | 
usually be necessary to edit the materials and light sources in | 
| 2730 | 
> | 
the output file or replace materials with proper entries from a material | 
| 2731 | 
> | 
library using the | 
| 2732 | 
> | 
.I -l | 
| 2733 | 
> | 
option. | 
| 2734 | 
> | 
.LP | 
| 2735 | 
> | 
With smoothing turned on (i.e., a non-zero value for the | 
| 2736 | 
> | 
.I -s | 
| 2737 | 
> | 
option), vertices in the MGF output will not be linked in a proper | 
| 2738 | 
> | 
mesh for each object. | 
| 2739 | 
> | 
This is due to the way the automatic smoothing code was originally | 
| 2740 | 
> | 
written, and is too difficult to repair. | 
| 2741 | 
> | 
If a good mesh is needed, then smoothing must be turned off. | 
| 2742 | 
> | 
.SH | 
| 2743 | 
> | 
EXAMPLES | 
| 2744 | 
> | 
.LP | 
| 2745 | 
> | 
To convert a 3D Studio robot model to MGF without smoothing. | 
| 2746 | 
> | 
(Output will be put into "robot.mgf" and "robot.inc".) | 
| 2747 | 
> | 
.IP | 
| 2748 | 
> | 
3ds2mgf robot.3ds -s0 | 
| 2749 | 
> | 
.LP | 
| 2750 | 
> | 
To convert a DC10 jet model to MGF using a hand-created material library: | 
| 2751 | 
> | 
.IP | 
| 2752 | 
> | 
3ds2mgf dc10.3ds -ldc10mat.mgf | 
| 2753 | 
> | 
.SH | 
| 2754 | 
> | 
AUTHORS | 
| 2755 | 
> | 
.LP | 
| 2756 | 
> | 
Steve Anger, Jeff Bowermaster and Greg Ward | 
| 2757 | 
> | 
.br | 
| 2758 | 
> | 
Extended from 3ds2pov 1.8. | 
| 2759 | 
> | 
.SH | 
| 2760 | 
> | 
SEE ALSO | 
| 2761 | 
> | 
.LP | 
| 2762 | 
> | 
mgf2inv(1), mgf2meta(1), mgf2rad(1) | 
| 2763 | 
  | 
.ds RH MGF2RAD | 
| 2764 | 
  | 
.bp | 
| 2765 | 
  | 
.SH | 
| 3434 | 
  | 
#define MG_EUNK         1               /* unknown entity */ | 
| 3435 | 
  | 
#define MG_EARGC                2               /* wrong number of arguments */ | 
| 3436 | 
  | 
#define MG_ETYPE                3               /* argument type error */ | 
| 3437 | 
< | 
#define MG_EILL                         4               /* illegal argument value */ | 
| 3437 | 
> | 
#define MG_EILL                 4               /* illegal argument value */ | 
| 3438 | 
  | 
#define MG_EUNDEF               5               /* undefined reference */ | 
| 3439 | 
  | 
#define MG_ENOFILE              6               /* cannot open input file */ | 
| 3440 | 
  | 
#define MG_EINCL                7               /* error in included file */ | 
| 3444 | 
  | 
#define MG_ELINE                11              /* input line too long */ | 
| 3445 | 
  | 
#define MG_ECNTXT               12              /* unmatched context close */ | 
| 3446 | 
  | 
 | 
| 3447 | 
< | 
#define MG_NERRS        13 | 
| 3447 | 
> | 
#define MG_NERRS                13 | 
| 3448 | 
  | 
.DE | 
| 3449 | 
  | 
If it is inappropriate to send output to standard error, the calling | 
| 3450 | 
  | 
program should use the routines listed under | 
| 3867 | 
  | 
transform has not changed, which is uniquely identified by the | 
| 3868 | 
  | 
global | 
| 3869 | 
  | 
.I xf_context->xid | 
| 3870 | 
< | 
variable, but only if one is using the parser libraries transform | 
| 3870 | 
> | 
variable, but only if one is using the parser library's transform | 
| 3871 | 
  | 
handler. | 
| 3872 | 
  | 
(See the | 
| 3873 | 
  | 
.I xf_handler |