ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/mgflib/mgfdoc.tr
(Generate patch)

Comparing ray/src/cv/mgflib/mgfdoc.tr (file contents):
Revision 1.1 by greg, Fri May 12 14:26:12 1995 UTC vs.
Revision 1.14 by greg, Wed Feb 21 15:46:44 1996 UTC

# Line 5 | Line 5
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
# Line 42 | Line 43 | and sample scenes and objects at the web site,
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
# Line 282 | Line 283 | ring, torus, prism
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
# Line 431 | Line 432 | Since the arguments are concise and self-explanatory,
432   sufficient.
433   The following transformation flags and
434   parameters are defined:
435 < .TS I
435 > .TS
436 > center;
437   l l.
438   -t dx dy dz     translate objects along the given vector
439   -rx degrees     rotate objects about the X-axis
# Line 546 | Line 548 | Detailed MGF Example
548   The following example of a simple room with a single door
549   and six file cabinets shows MGF in action, with copious comments to
550   help explain what's going on.
551 + .LP
552   .DS
553   # "ceiling_tile" is a diffuse white surface with 75% reflectance:
554   # Create new named material context and clear it
# Line 744 | Line 747 | o door
747          o
748   o
749  
747        i cubfurn.inc -mx -t 405 133.5 0
748 o
749
750   # Six file cabinets (36" wide each)
751   # ("filecab.inc" was given as an earlier example in Section 1.2)
752   o filecab.x
# Line 772 | Line 772 | There are currently 28 entities in the MGF specificati
772   For ease of reference we have broken these into five categories:
773   .IP 1.
774   General
775 < .TS I
775 > .TS
776   lw(.75i) lw(1.75i) lw(3i).
777   #       [anything ...]  a comment
778   o       [name]  begin/end object context
# Line 782 | Line 782 | ies    pathname [-m f][xform]  include IES luminaire (with
782   .TE
783   .IP 2.
784   Color
785 < .TS I
785 > .TS
786   lw(.75i) lw(1.75i) lw(3i).
787   c       [id [= [template]]]     get/set color context
788   cxy     x y     set CIE (x,y) chromaticity for current color
# Line 1267 | Line 1267 | corresponds to the measurement at
1267   Values in between are separated by
1268   .I "(l_max-l_min)/(N-1)"
1269   nanometers.
1270 < All values must be non-negative, and the spectrum outside of the
1270 > All values should be non-negative unless defining a component for
1271 > complementary color mixing, and the spectrum outside of the
1272   specified range is assumed to be zero.
1273   (The visible range is 380 to 780 nm.)\0
1274   The actual units and scale of the measurements do not matter,
# Line 1674 | Line 1675 | EXAMPLE
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
# Line 2226 | Line 2227 | o stylus
2227                  p 0 0 .005
2228          v vend =
2229                  p 0 0 .05
2230 <        cyl vtip1 .0015
2230 >        cyl vtip1 .0015 vend
2231          sph vend .0015
2232          cone vtip0 0 vtip1 .0015
2233   o
# Line 2388 | Line 2389 | ring - create a circular ring with inner and outer rad
2389   .SH
2390   SYNOPSIS
2391   .LP
2392 < .B cyl
2392 > .B ring
2393   .I "vc rmin rmax"
2394   .SH
2395   DESCRIPTION
# Line 2501 | Line 2502 | SEE ALSO
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
# Line 2516 | Line 2520 | package\(dg.
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.
# Line 2533 | Line 2537 | unwanted entities.
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
# Line 2567 | Line 2579 | In the first form, a single integer is given for the
2579   of MGF that is to be produced.
2580   Since MGF is in its first major release, this is not yet a useful
2581   form, but it will be when the second major release comes out.
2582 + This has the necessary side-effect of expanding all included files.
2583 + (See the
2584 + .UL i
2585 + entity.)\0
2586   .LP
2587   In the second form,
2588   .I mgfilt
# Line 2591 | Line 2607 | mgfilt f,v,p,xf input.mgf > flatpoly.mgf
2607   .SH
2608   SEE ALSO
2609   .LP
2610 < 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
# Line 2695 | Line 2863 | Greg Ward
2863   SEE ALSO
2864   .LP
2865   ies2rad(1), mgf2meta(1), obj2rad(1), oconv(1), rad2mgf(1), xform(1)
2866 < .ds RH
2699 < RAD2MGF
2866 > .ds RH RAD2MGF
2867   .bp
2868   .SH
2869   NAME
# Line 2985 | Line 3152 | char   **av;
3152  
3153          if (ac < 4)                     /* check # arguments */
3154                  return(MG_EARGC);
3155 <        printf("face\n");               /* begin face output */
3155 >        printf("face\\\\n");            /* begin face output */
3156          for (i = 1; i < ac; i++) {
3157                  if ((vp = c_getvert(av[i])) == NULL)    /* vertex from name */
3158                          return(MG_EUNDEF);
3159                  xf_xfmpoint(vert, vp->p);                       /* apply transform */
3160 <                printf("%15.9f %15.9f %15.9f\n",
3160 >                printf("%15.9f %15.9f %15.9f\\\\n",
3161                          vert[0], vert[1], vert[2]);                     /* output vertex */
3162          }
3163 <        printf(";\\n");                 /* end of face output */
3163 >        printf(";\\\\n");                       /* end of face output */
3164          return(MG_OK);                  /* normal exit */
3165   }
3166  
# Line 3122 | Line 3289 | following:
3289   #define MG_E_CMIX               4               /* cmix */
3290   #define MG_E_CSPEC              5               /* cspec        */
3291   #define MG_E_CXY                6               /* cxy          */
3292 < #define MG_E_CYL                7               /* cyl  */
3292 > #define MG_E_CYL                7               /* cyl          */
3293   #define MG_E_ED         8               /* ed           */
3294   #define MG_E_FACE               9               /* f            */
3295   #define MG_E_INCLUDE    10              /* i            */
3296   #define MG_E_IES                11              /* ies          */
3297 < #define MG_E_IR         12              /* ir           */
3297 > #define MG_E_IR                 12              /* ir           */
3298   #define MG_E_MATERIAL   13              /* m            */
3299   #define MG_E_NORMAL     14              /* n            */
3300   #define MG_E_OBJECT     15              /* o            */
# Line 3267 | Line 3434 | and return one of the non-zero values from "parser.h"
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 */
3441   #define MG_EMEM         8               /* out of memory */
3442   #define MG_ESEEK                9               /* file seek error */
3443   #define MG_EBADMAT      10              /* bad material specification */
3444 + #define MG_ELINE                11              /* input line too long */
3445 + #define MG_ECNTXT               12              /* unmatched context close */
3446  
3447 < #define MG_NERRS        11
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
# Line 3289 | Line 3458 | listed above in the native country's language.
3458   .SH
3459   SEE ALSO
3460   .LP
3461 < mg_fgetpos, mg_handle, mg_init
3461 > mg_fgetpos, mg_handle, mg_init, mg_open
3462   .ds RH MG_OPEN
3463   .bp
3464   .SH
# Line 3359 | Line 3528 | The
3528   function reads the next input line from the current file,
3529   returning the number of characters in the line, or zero if the
3530   end of file is reached or there is a file error.
3531 < The function skips over escaped newlines, and keeps track of the
3531 > If the value returned equals MG_MAXLINE-1,
3532 > then the input line was too long, and you
3533 > should return an MG_ELINE error.
3534 > The function keeps track of the
3535   line number in the current file context
3536   .I mg_file,
3537   which also contains the line that was read.
# Line 3695 | Line 3867 | To link identical vertices, one must also check that t
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
# Line 4275 | Line 4447 | mg_init, mg_load, obj_handler, xf_xfmpoint
4447   .SH
4448   NAME
4449   .LP
4450 < xf_xfmpoint xf_xfmvect, xf_rotvect, xf_scale - apply current
4450 > xf_xfmpoint, xf_xfmvect, xf_rotvect, xf_scale - apply current
4451   transformation
4452   .SH
4453   SYNOPSIS
# Line 4304 | Line 4476 | to the point
4476   .I pold,
4477   scaling, rotating and moving it to its proper location, which is put in
4478   .I pnew.
4479 < (The two arguments may point to the same vector.)\0
4479 > (As for
4480 > .I xf_xfmvect
4481 > and
4482 > .I xf_rotvect,
4483 > the two arguments may point to the same vector.)\0
4484   .LP
4485   The
4486   .I xf_xfmvect
# Line 4312 | Line 4488 | routine applies the current transformation to the vect
4488   .I vold,
4489   scaling and rotating it to its proper location, which is put in
4490   .I vnew.
4315 (The two arguments may point to the same vector.)\0
4491   The only difference between
4492   .I xf_xfmpoint
4493   and
# Line 4325 | Line 4500 | routine rotates the vector
4500   .I nold
4501   using the current transformation, and stores the result in
4502   .I nnew.
4328 (The two arguments may point to the same vector.)\0
4503   No translation or scaling is applied, which is the appropriate
4504   action for surface normal vectors for example.
4505   .LP
# Line 4486 | Line 4660 | and adopt the following code to convert between CIE an
4660   #define  CIE_y_w                0.3333
4661   #endif
4662  
4663 < #define CIE_D           (       CIE_x_r*(CIE_y_g - CIE_y_b) + \\\\
4664 <                                CIE_x_g*(CIE_y_b - CIE_y_r) + \\\\
4663 > #define CIE_D           (       CIE_x_r*(CIE_y_g - CIE_y_b) + \\
4664 >                                CIE_x_g*(CIE_y_b - CIE_y_r) + \\
4665                                  CIE_x_b*(CIE_y_r - CIE_y_g)     )
4666 < #define CIE_C_rD        ( (1./CIE_y_w) * \\\\
4667 <                                ( CIE_x_w*(CIE_y_g - CIE_y_b) - \\\\
4668 <                                  CIE_y_w*(CIE_x_g - CIE_x_b) + \\\\
4666 > #define CIE_C_rD        ( (1./CIE_y_w) * \\
4667 >                                ( CIE_x_w*(CIE_y_g - CIE_y_b) - \\
4668 >                                  CIE_y_w*(CIE_x_g - CIE_x_b) + \\
4669                                    CIE_x_g*CIE_y_b - CIE_x_b*CIE_y_g     ) )
4670 < #define CIE_C_gD        ( (1./CIE_y_w) * \\\\
4671 <                                ( CIE_x_w*(CIE_y_b - CIE_y_r) - \\\\
4672 <                                  CIE_y_w*(CIE_x_b - CIE_x_r) - \\\\
4670 > #define CIE_C_gD        ( (1./CIE_y_w) * \\
4671 >                                ( CIE_x_w*(CIE_y_b - CIE_y_r) - \\
4672 >                                  CIE_y_w*(CIE_x_b - CIE_x_r) - \\
4673                                    CIE_x_r*CIE_y_b + CIE_x_b*CIE_y_r     ) )
4674 < #define CIE_C_bD        ( (1./CIE_y_w) * \\\\
4675 <                                ( CIE_x_w*(CIE_y_r - CIE_y_g) - \\\\
4676 <                                  CIE_y_w*(CIE_x_r - CIE_x_g) + \\\\
4674 > #define CIE_C_bD        ( (1./CIE_y_w) * \\
4675 >                                ( CIE_x_w*(CIE_y_r - CIE_y_g) - \\
4676 >                                  CIE_y_w*(CIE_x_r - CIE_x_g) + \\
4677                                    CIE_x_r*CIE_y_g - CIE_x_g*CIE_y_r     ) )
4678  
4679   #define CIE_rf          (CIE_y_r*CIE_C_rD/CIE_D)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines