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.3 by greg, Mon May 15 14:42:30 1995 UTC vs.
Revision 1.18 by greg, Fri Mar 21 12:32:30 1997 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 232 | Line 233 | p      x y z   set point position for current vertex
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)
# Line 277 | Line 279 | Context        Cntl. Entity    Default Value   Field Entities  Affe
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{
# Line 296 | Line 298 | Vertex v       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
# Line 746 | Line 748 | o door
748          o
749   o
750  
749        i cubfurn.inc -mx -t 405 133.5 0
750 o
751
751   # Six file cabinets (36" wide each)
752   # ("filecab.inc" was given as an earlier example in Section 1.2)
753   o filecab.x
# Line 818 | Line 817 | Geometry
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)
# Line 1269 | Line 1269 | corresponds to the measurement at
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,
# Line 1676 | Line 1677 | EXAMPLE
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
# Line 1902 | Line 1903 | and
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
# Line 1941 | Line 1944 | SEE ALSO
1944   .UL cone,
1945   .UL cyl,
1946   .UL f,
1947 + .UL fh,
1948   .UL n,
1949   .UL p,
1950   .UL prism,
# Line 1985 | Line 1989 | SEE ALSO
1989   .UL cone,
1990   .UL cyl,
1991   .UL f,
1992 + .UL fh,
1993   .UL n,
1994   .UL prism,
1995   .UL ring,
# Line 2031 | Line 2036 | xf
2036   SEE ALSO
2037   .LP
2038   .UL f,
2039 + .UL fh,
2040   .UL p,
2041   .UL prism,
2042   .UL ring,
# Line 2070 | Line 2076 | when normals are used.
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
# Line 2127 | Line 2140 | SEE ALSO
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
# Line 2181 | Line 2250 | SEE ALSO
2250   .UL cone,
2251   .UL cyl,
2252   .UL f,
2253 + .UL fh,
2254   .UL m,
2255   .UL prism,
2256   .UL ring,
# Line 2228 | Line 2298 | o stylus
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
# Line 2238 | Line 2308 | SEE ALSO
2308   .LP
2309   .UL cone,
2310   .UL f,
2311 + .UL fh,
2312   .UL m,
2313   .UL prism,
2314   .UL ring,
# Line 2310 | Line 2381 | SEE ALSO
2381   .LP
2382   .UL cyl,
2383   .UL f,
2384 + .UL fh,
2385   .UL m,
2386   .UL prism,
2387   .UL ring,
# Line 2376 | Line 2448 | SEE ALSO
2448   .UL cyl,
2449   .UL cone,
2450   .UL f,
2451 + .UL fh,
2452   .UL m,
2453   .UL ring,
2454   .UL sph,
# Line 2390 | Line 2463 | ring - create a circular ring with inner and outer rad
2463   .SH
2464   SYNOPSIS
2465   .LP
2466 < .B cyl
2466 > .B ring
2467   .I "vc rmin rmax"
2468   .SH
2469   DESCRIPTION
# Line 2432 | Line 2505 | SEE ALSO
2505   .UL cyl,
2506   .UL cone,
2507   .UL f,
2508 + .UL fh,
2509   .UL m,
2510   .UL prism,
2511   .UL sph,
# Line 2492 | Line 2566 | SEE ALSO
2566   .UL cyl,
2567   .UL cone,
2568   .UL f,
2569 + .UL fh,
2570   .UL m,
2571   .UL prism,
2572   .UL ring,
# Line 2503 | Line 2578 | SEE ALSO
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
# Line 2518 | Line 2596 | package\(dg.
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.
# Line 2535 | Line 2613 | unwanted entities.
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
# Line 2569 | Line 2655 | In the first form, a single integer is given for the
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
# Line 2593 | Line 2683 | mgfilt f,v,p,xf input.mgf > flatpoly.mgf
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
# Line 3123 | Line 3365 | following:
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            */
# Line 3275 | Line 3517 | and return one of the non-zero values from "parser.h"
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
# Line 3290 | Line 3534 | listed above in the native country's language.
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
# Line 3360 | Line 3604 | The
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.
# Line 3696 | Line 3943 | To link identical vertices, one must also check that t
3943   transform has not changed, which is uniquely identified by the
3944   global
3945   .I xf_context->xid
3946 < variable, but only if one is using the parser libraries transform
3946 > variable, but only if one is using the parser library's transform
3947   handler.
3948   (See the
3949   .I xf_handler
# Line 4427 | Line 4674 | familiar Gaussian model of MGF.
4674   The hardest part is translating the specular power to a roughness value.
4675   For this, we recommend the following approximation:
4676   .IP
4677 < roughness = 0.6/sqrt(specular_power)
4677 > roughness = sqrt(2/specular_power)
4678   .LP
4679   It is not a perfect correlation, but it is about as close as one can get.
4680   .NH 3
# Line 4489 | Line 4736 | and adopt the following code to convert between CIE an
4736   #define  CIE_y_w                0.3333
4737   #endif
4738  
4739 < #define CIE_D           (       CIE_x_r*(CIE_y_g - CIE_y_b) + \\\\
4740 <                                CIE_x_g*(CIE_y_b - CIE_y_r) + \\\\
4739 > #define CIE_D           (       CIE_x_r*(CIE_y_g - CIE_y_b) + \\
4740 >                                CIE_x_g*(CIE_y_b - CIE_y_r) + \\
4741                                  CIE_x_b*(CIE_y_r - CIE_y_g)     )
4742 < #define CIE_C_rD        ( (1./CIE_y_w) * \\\\
4743 <                                ( CIE_x_w*(CIE_y_g - CIE_y_b) - \\\\
4744 <                                  CIE_y_w*(CIE_x_g - CIE_x_b) + \\\\
4742 > #define CIE_C_rD        ( (1./CIE_y_w) * \\
4743 >                                ( CIE_x_w*(CIE_y_g - CIE_y_b) - \\
4744 >                                  CIE_y_w*(CIE_x_g - CIE_x_b) + \\
4745                                    CIE_x_g*CIE_y_b - CIE_x_b*CIE_y_g     ) )
4746 < #define CIE_C_gD        ( (1./CIE_y_w) * \\\\
4747 <                                ( CIE_x_w*(CIE_y_b - CIE_y_r) - \\\\
4748 <                                  CIE_y_w*(CIE_x_b - CIE_x_r) - \\\\
4746 > #define CIE_C_gD        ( (1./CIE_y_w) * \\
4747 >                                ( CIE_x_w*(CIE_y_b - CIE_y_r) - \\
4748 >                                  CIE_y_w*(CIE_x_b - CIE_x_r) - \\
4749                                    CIE_x_r*CIE_y_b + CIE_x_b*CIE_y_r     ) )
4750 < #define CIE_C_bD        ( (1./CIE_y_w) * \\\\
4751 <                                ( CIE_x_w*(CIE_y_r - CIE_y_g) - \\\\
4752 <                                  CIE_y_w*(CIE_x_r - CIE_x_g) + \\\\
4750 > #define CIE_C_bD        ( (1./CIE_y_w) * \\
4751 >                                ( CIE_x_w*(CIE_y_r - CIE_y_g) - \\
4752 >                                  CIE_y_w*(CIE_x_r - CIE_x_g) + \\
4753                                    CIE_x_r*CIE_y_g - CIE_x_g*CIE_y_r     ) )
4754  
4755   #define CIE_rf          (CIE_y_r*CIE_C_rD/CIE_D)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines