home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / graphic / qrt / samples.doc < prev    next >
Text File  |  1989-03-26  |  22KB  |  793 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.         
  8.         
  9.                                QRT Sample Programs
  10.         
  11.         
  12.         Introduction
  13.         
  14.         The following are actual QRT input  files.  They can be used as a
  15.         guide to suggested QRT  indenting  style, or as a quick reference
  16.         to QRT commands.  They both use most  of the advanced features of
  17.         QRT, and would be good examples of  QRT programming.  These files
  18.         require QRT 1.4 or later to run correctly.
  19.         
  20.         
  21.         
  22.         File One
  23.         
  24.            
  25.            {**************************************************
  26.            
  27.                Walls with sphere - demonstrates pattern
  28.                mapping to sphere surfaces.
  29.            
  30.                Rendered with QRT ray tracer on Amiga 1000
  31.            
  32.                - Steve Koren   8 Jun 88
  33.            
  34.             **************************************************}
  35.            
  36.            
  37.            FILE_NAME = Wall_Sphere.RAW
  38.            
  39.            { *********   Some pattern definitions ********** }
  40.            
  41.            PATTERN ( x_size = 16,           { ** A stripe pattern ** }
  42.                      y_size = 8,            { ** for the sphere ** }
  43.                      name   = MIRROR_STRIPE,
  44.            
  45.                      RECTANGLE (
  46.                        start_x = 0, start_y = 0,
  47.                        end_x   = 16, end_y   = 4,
  48.            
  49.                        diff    = (.1, .1, .1),
  50.                        mirror  = (.8, .8, .8),
  51.                      )
  52.                    )
  53.            
  54.            PATTERN ( x_size = 60,        { ** Checkered pattern ** }
  55.                      y_size = 60,
  56.                      name   = CHECK,
  57.                      RECTANGLE (
  58.  
  59.  
  60.         QRT Ray Tracer               Page 1           QRT Sample Programs
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.                        start_x = 0,
  74.                        start_y = 0,
  75.                        end_x   = 30,
  76.                        end_y   = 30,
  77.                        diff    = (.1,1.0,.1),
  78.                      )
  79.                      RECTANGLE (
  80.                        start_x = 30,
  81.                        start_y = 30,
  82.                        end_x   = 60,
  83.                        end_y   = 60,
  84.                        diff    = (.1,1.0,.1),
  85.                      )
  86.                    )
  87.            
  88.            PATTERN ( x_size = 40,        { ** Checkered pattern ** }
  89.                      y_size = 40,
  90.                      name   = CHECK_BLUE,
  91.                      RECTANGLE (
  92.                        start_x = 0,
  93.                        start_y = 0,
  94.                        end_x   = 20,
  95.                        end_y   = 20,
  96.                        diff    = (.7,.2,.7)
  97.                        amb     = (.32, .32, .32),
  98.                        reflect = .55
  99.                        sreflect= 20
  100.                      )
  101.                      RECTANGLE (
  102.                        start_x = 20,
  103.                        start_y = 20,
  104.                        end_x   = 40,
  105.                        end_y   = 40,
  106.                        diff    = (.7,.5,.7),
  107.                        amb     = (.32, .32, .32),
  108.                        reflect = .55
  109.                        sreflect= 20
  110.                      )
  111.                    )
  112.            PATTERN ( x_size = 80,               { ** brick pattern ** }
  113.                      y_size = 50,
  114.                      name   = BRICK,
  115.                      RECTANGLE (                { 1st half brick 1 }
  116.                        start_x = 0, start_y = 2,
  117.                        end_x   = 18, end_y   = 23,
  118.                        diff    = (1.00, .20, .20);
  119.                      )
  120.                      RECTANGLE (                { 2nd hald brick 1 }
  121.                        start_x = 62, start_y = 2,
  122.                        end_x   = 80, end_y   = 23,
  123.                        diff    = (1.00, .20, .20);
  124.  
  125.  
  126.         QRT Ray Tracer               Page 2           QRT Sample Programs
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.                      )
  140.                      RECTANGLE (                { brick 2 }
  141.                        start_x = 22, start_y = 2,
  142.                        end_x   = 58, end_y   = 23,
  143.                        diff    = (.80, .20, .20);
  144.                      )
  145.                      RECTANGLE (                { brick 3 }
  146.                        start_x = 2, start_y = 27,
  147.                        end_x   = 38, end_y   = 48,
  148.                        diff    = (.85, .35, .10);
  149.                      )
  150.                      RECTANGLE (                { brick 4 }
  151.                        start_x = 42, start_y = 27,
  152.                        end_x   = 78, end_y   = 48,
  153.                        diff    = (.70, .25, .20);
  154.                      )
  155.                    )
  156.            
  157.            { *******************  OBJECTS  ******************* }
  158.            
  159.            { ** ground ** }
  160.            
  161.            PARALLELOGRAM ( loc  = (  -10000, 0,  -10000),
  162.                            v1   = (20000, 0,    0),
  163.                            v2   = (  0, 0, 20000),
  164.            
  165.                            diff = (  .8, .8, 0),
  166.                            pattern = CHECK
  167.                            xmult = 2
  168.                            ymult = 2
  169.                          )
  170.            
  171.            
  172.            BEGIN_BBOX
  173.            
  174.                BEGIN_BBOX
  175.            
  176.                    SPHERE ( loc = (200, 50, -80),
  177.                             radius = 35,
  178.                             diff = (.7, .3, .5),
  179.            
  180.                             pattern = MIRROR_STRIPE,
  181.                             xmult   = 1.5,
  182.                             ymult   = 1.5
  183.                           )
  184.            
  185.                    QUADRATIC ( loc = (200, 0, -80),
  186.            
  187.                                a    = 1,
  188.                                b    = 0,
  189.                                c    = 1,
  190.  
  191.  
  192.         QRT Ray Tracer               Page 3           QRT Sample Programs
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.                                d    = 150,
  206.                                xmin = -13,
  207.                                xmax = 13,
  208.                                ymin = 0,
  209.                                ymax = 50,
  210.                                zmin = -13,
  211.                                zmax = 13,
  212.            
  213.                                diff = (.1, .1, .1),
  214.                                mirror = (.8, .8, .8)
  215.                              )
  216.            
  217.                END_BBOX
  218.            
  219.            
  220.                BEGIN_BBOX
  221.            
  222.                    SPHERE ( loc      = (200, 90, 80),
  223.                             radius   = 35,
  224.                             diff     = (.3, .3, .8),
  225.                             amb      = (.32, .32, .32),
  226.                             reflect  = .40
  227.                             sreflect = 20
  228.            
  229.                             pattern = CHECK_BLUE,
  230.                             xmult   = 1.0,
  231.                             ymult   = 1.0
  232.                           )
  233.            
  234.                    QUADRATIC ( loc = (200, 0, 80),
  235.            
  236.                                a    = 1,
  237.                                b    = 0,
  238.                                c    = 1,
  239.                                d    = 150,
  240.                                xmin = -13,
  241.                                xmax = 13,
  242.                                ymin = 0,
  243.                                ymax = 90,
  244.                                zmin = -13,
  245.                                zmax = 13,
  246.            
  247.                                diff = (.1, .1, .1),
  248.                                mirror = (.8, .8, .8)
  249.                              )
  250.            
  251.                END_BBOX
  252.            
  253.            END_BBOX
  254.            
  255.            
  256.  
  257.  
  258.         QRT Ray Tracer               Page 4           QRT Sample Programs
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.            BEGIN_BBOX
  272.            
  273.                { ** a small brick wall ** }
  274.            
  275.                PARALLELOGRAM ( loc = (150, 00, -15),
  276.                                v1  = (0, 0, 30),
  277.                                v2  = (0, 100, 0)
  278.            
  279.                                diff = (1, 1, 1),
  280.                                pattern = BRICK
  281.            
  282.                                xmult = .5,
  283.                                ymult = .5
  284.                              )
  285.            
  286.                PARALLELOGRAM ( loc = (150, 00, -15),
  287.                                v1  = (100, 0, 0),
  288.                                v2  = (0, 100, 0)
  289.            
  290.                                diff = (1, 1, 1),
  291.                                pattern = BRICK
  292.            
  293.                                xmult = .5,
  294.                                ymult = .5
  295.                              )
  296.            
  297.                PARALLELOGRAM ( loc = (150, 00, 15),
  298.                                v1  = (100, 0, 0),
  299.                                v2  = (0, 100, 0)
  300.            
  301.                                diff = (1, 1, 1),
  302.                                pattern = BRICK
  303.            
  304.                                xmult = .5,
  305.                                ymult = .5
  306.                              )
  307.            
  308.            END_BBOX
  309.            
  310.            
  311.            { ** An observer ** }
  312.            
  313.            OBSERVER ( loc    = (-20 , 70, -40),
  314.                       lookat = (200, 50, 0)
  315.                     )
  316.            
  317.            { ** A lamp ** }
  318.            
  319.            LAMP ( loc = (120, 120, -50),
  320.                   radius = 5,
  321.                   dist = 80
  322.  
  323.  
  324.         QRT Ray Tracer               Page 5           QRT Sample Programs
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.                 )
  338.            
  339.            LAMP ( loc = (120, 150, 80),
  340.                   radius = 5,
  341.                   dist = 70
  342.                 )
  343.            
  344.            SKY  ( horiz  = (.2, .2, .55),
  345.                   zenith = (.1, .1, .25),
  346.                   dither = 4
  347.                 )
  348.            
  349.            DEFAULT ( x_res = 320,      { ** parameters for Amiga ** }
  350.                      y_res = 400
  351.                      aspect= .56
  352.                    )
  353.            
  354.            FOC_LENGTH = 50
  355.            
  356.            
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.         QRT Ray Tracer               Page 6           QRT Sample Programs
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.            
  404.         FILE 2
  405.            
  406.            
  407.            { **************************************************
  408.            
  409.               Glass table with vase and candy bowl.  This
  410.               is the first test of glass surfaces, and came out
  411.               surprisingly well - it actually does look like
  412.               glass!  This image requires QRT 1.4 to run.
  413.            
  414.               Rendered with QRT rayracing system
  415.            
  416.               Steve Koren -  23 AUG 88
  417.            
  418.              ************************************************** }
  419.            
  420.            
  421.            FILE_NAME = Table.RAW
  422.            
  423.            PATTERN ( x_size = 80,
  424.                      y_size = 30,
  425.                      name   = BLOCK,
  426.            
  427.                      RECTANGLE (
  428.                        start_x = 3,  start_y = 3,
  429.                        end_x   = 77, end_y   = 27,
  430.                        diff    = (.8, .7, .4);
  431.                      )
  432.                    )
  433.            
  434.            PATTERN ( x_size = 90,
  435.                      y_size = 90,
  436.                      name   = FLOOR,
  437.            
  438.                      RECTANGLE (
  439.                        start_x = 0,  start_y = 0,
  440.                        end_x   = 55, end_y   = 55,
  441.                        diff    = (.1, .8, .1)
  442.                      )
  443.            
  444.                      RECTANGLE (
  445.                        start_x = 60, start_y = 0
  446.                        end_x   = 85  end_y   = 55
  447.                        diff    = (.2, .3, .8)
  448.                      )
  449.            
  450.                      RECTANGLE (
  451.                        start_x = 0,  start_y = 60
  452.                        end_x   = 55  end_y   = 85
  453.                        diff    = (.2, .3, .8)
  454.  
  455.  
  456.         QRT Ray Tracer               Page 7           QRT Sample Programs
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.                      )
  470.                    )
  471.            
  472.            BEGIN_INSTANCES
  473.            
  474.              { ** glass table leg - hollow glass cylender ** }
  475.            
  476.              NAME = table_leg;
  477.              BEGIN_BBOX
  478.            
  479.                QUADRATIC ( loc     = (0, 0, 0),
  480.                            a       = 1, b  = 0, c  = 1,
  481.                            d       = 300,
  482.            
  483.                            xmin    = -18, xmax = 18,
  484.                            ymin    = 0,   ymax = 70,
  485.                            zmin    = -18, zmax = 18,
  486.            
  487.                            diff    = (0, 0, 0),
  488.                            trans   = (.7, .7, .7),
  489.                            mirror  = (.25, .25, .25),
  490.                            index   = 1.33,
  491.                            density = (.022, .022, .022)
  492.                          )
  493.            
  494.                QUADRATIC ( loc     = (0, 0, 0),
  495.                            a       = 1, b  = 0, c  = 1,
  496.                            d       = 144,
  497.            
  498.                            xmin    = -12, xmax = 12,
  499.                            ymin    = 0,   ymax = 70,
  500.                            zmin    = -12, zmax = 12,
  501.            
  502.                            diff    = (0, 0, 0),
  503.                            trans   = (1, 1, 1),
  504.                            mirror  = (.1, .1, .1),
  505.                            index   = 1.33,
  506.                            density = (.022, .022, .022)
  507.                          )
  508.              END_BBOX
  509.            
  510.            END_INSTANCES
  511.            
  512.            { ******************** GROUND ********************** }
  513.            
  514.            PARALLELOGRAM ( loc = (-10000, 0, -10000),
  515.                            v1  = (0,0, 20000),
  516.                            v2  = (20000, 0, 0)
  517.            
  518.                            diff    = (.1, .1, .1),
  519.                            pattern = BLOCK
  520.  
  521.  
  522.         QRT Ray Tracer               Page 8           QRT Sample Programs
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.                          )
  536.            
  537.            
  538.            { ******************** OBJECTS ********************** }
  539.            
  540.            { ** FLOOR ** }
  541.            
  542.            PARALLELOGRAM ( loc  = (80, .01, -20),
  543.                            v1   = (240, 0, 0),
  544.                            v2   = (0, 0, 240),
  545.                            diff = (0, 0, 0)
  546.            
  547.                            pattern = FLOOR
  548.                            xmult   = .8,
  549.                            ymult   = .8
  550.                          )
  551.            
  552.            { ** TABLE LEGS ** }
  553.            
  554.            BEGIN_BBOX
  555.              INSTANCE_OF ( name   = table_leg,
  556.                            loc    = (140, 0, 40)
  557.                          )
  558.            
  559.              INSTANCE_OF ( name   = table_leg,
  560.                            loc    = (260, 0, 40)
  561.                          )
  562.            END_BBOX
  563.            
  564.            BEGIN_BBOX
  565.              INSTANCE_OF ( name   = table_leg,
  566.                            loc    = (140, 0, 160)
  567.                          )
  568.            
  569.              INSTANCE_OF ( name   = table_leg,
  570.                            loc    = (260, 0, 160)
  571.                          )
  572.            END_BBOX
  573.            
  574.            { ** TABLE TOP ** }
  575.            
  576.            BEGIN_BBOX
  577.            
  578.              PARALLELOGRAM ( loc      = (100, 70, 0),
  579.                              v1       = (0, 0, 200),
  580.                              v2       = (200, 0, 0),
  581.            
  582.                              diff     = (0, 0, 0),
  583.                              trans    = (.7, .7, .7),
  584.                              mirror   = (.23, .23, .23),
  585.                              index    = 1.33,
  586.  
  587.  
  588.         QRT Ray Tracer               Page 9           QRT Sample Programs
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.                              density  = (.015, .015, .015)
  602.                            )
  603.            
  604.              PARALLELOGRAM ( loc      = (100, 85, 0),
  605.                              v1       = (0, 0, 200),
  606.                              v2       = (200, 0, 0),
  607.            
  608.                              diff     = (0, 0, 0),
  609.                              trans    = (1, 1, 1),
  610.                              mirror   = (.25, .25, .25),
  611.                              index    = 1.33,
  612.                              density  = (.015, .015, .015)
  613.                            )
  614.            
  615.            
  616.              { ** SIDES ** }
  617.            
  618.              PARALLELOGRAM ( loc = (100, 70, 0),
  619.                              v1  = (0, 0, 200),
  620.                              v2  = (0, 15, 0),
  621.            
  622.                              diff     = (0, 0, 0),
  623.                              trans    = (.7, .7, .7),
  624.                              mirror   = (.23, .23, .23),
  625.                              index    = 1.33,
  626.                              density  = (.016, .016, .016)
  627.                            )
  628.            
  629.              PARALLELOGRAM ( loc = (100, 70, 0),
  630.                              v1  = (200, 0, 0),
  631.                              v2  = (0, 15, 0),
  632.            
  633.                              diff     = (0, 0, 0),
  634.                              trans    = (.7, .7, .7),
  635.                              mirror   = (.23, .23, .23),
  636.                              index    = 1.33,
  637.                              density  = (.016, .016, .016)
  638.                            )
  639.            
  640.              PARALLELOGRAM ( loc = (100, 70, 200),
  641.                              v1  = (200, 0, 0),
  642.                              v2  = (0, 15, 0),
  643.            
  644.                              diff     = (0, 0, 0),
  645.                              trans    = (.7, .7, .7),
  646.                              mirror   = (.23, .23, .23),
  647.                              index    = 1.33,
  648.                              density  = (.016, .016, .016)
  649.                            )
  650.            
  651.              PARALLELOGRAM ( loc = (300, 70, 0),
  652.  
  653.  
  654.         QRT Ray Tracer               Page 10          QRT Sample Programs
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.                              v1  = (0, 0, 200),
  668.                              v2  = (0, 15, 0),
  669.            
  670.                              diff     = (0, 0, 0),
  671.                              trans    = (.7, .7, .7),
  672.                              mirror   = (.23, .23, .23),
  673.                              index    = 1.33,
  674.                              density  = (.016, .016, .016)
  675.                            )
  676.            
  677.            END_BBOX
  678.            
  679.            { ** CANDY BOWL  & VASE ** }
  680.            
  681.            BEGIN_BBOX
  682.            
  683.              BEGIN_BBOX
  684.                QUADRATIC ( loc     = (200, 100, 100),
  685.                            a       = 1, b  = 2, c  = 1,
  686.                            d       = 900,
  687.            
  688.                            xmin    = -30, xmax = 30,
  689.                            ymin    = -15, ymax = 0,
  690.                            zmin    = -30, zmax = 30,
  691.            
  692.                            diff    = (1, .1, .1),
  693.                            reflect = .8
  694.                            sreflect= 20
  695.                          )
  696.            
  697.                SPHERE   ( loc      = (185, 95, 110),
  698.                           radius   = 7,
  699.                           diff     = (.1, .1, 1)
  700.                         )
  701.            
  702.                SPHERE   ( loc      = (200, 93, 80),
  703.                           radius   = 7,
  704.                           diff     = (.1, 1, .1)
  705.                         )
  706.            
  707.              END_BBOX
  708.            
  709.              { ** VASE ** }
  710.            
  711.              BEGIN_BBOX
  712.            
  713.                QUADRATIC ( loc     = (260, 85, 50),
  714.                            a       = 1, b = 0, c = 1,
  715.                            d       = 100,
  716.            
  717.                            xmin    = -10, xmax = 10,
  718.  
  719.  
  720.         QRT Ray Tracer               Page 11          QRT Sample Programs
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.                            ymin    = 0,   ymax = 50,
  734.                            zmin    = -10, zmax = 10,
  735.            
  736.                            diff    = (.1, .7, .1),
  737.                            reflect = .7,
  738.                            sreflect=20
  739.                          )
  740.              END_BBOX
  741.            
  742.            END_BBOX
  743.            
  744.            OBSERVER ( loc    = (-50, 180, -30)
  745.                       lookat = (180, 50, 100)
  746.                     )
  747.            
  748.            SKY ( horiz  = (.10, .1, .75)
  749.                  zenith = (.10, .1, .60)
  750.                  dither = 4
  751.                )
  752.            
  753.            LAMP ( loc = (150, 250, -80)
  754.                   radius = 5,
  755.                   dist = 250
  756.                 )
  757.            
  758.            LAMP ( loc = (250, 50, 250),
  759.                   radius = 5,
  760.                   dist   = 60
  761.                 )
  762.            
  763.            
  764.            DEFAULT ( x_res = 320,       { Amiga parameters }
  765.                      y_res = 400
  766.                      aspect= .56
  767.                    )
  768.            
  769.            FOC_LENGTH = 50
  770.            
  771.            
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.         QRT Ray Tracer               Page 12          QRT Sample Programs
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.