home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / formats / qrt / code / samples.txt
Encoding:
Text File  |  1994-06-01  |  19.6 KB  |  585 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. File One
  21.           
  22.  
  23.            {**************************************************
  24.            
  25.                Walls with sphere - demonstrates pattern
  26.                mapping to sphere surfaces.
  27.            
  28.                Rendered with QRT ray tracer on Amiga 1000
  29.            
  30.                - Steve Koren   8 Jun 88
  31.            
  32.             **************************************************}
  33.            
  34.            
  35.            FILE_NAME = Wall_Sphere.RAW
  36.            
  37.            { *********   Some pattern definitions ********** }
  38.            
  39.            PATTERN ( x_size = 16,           { ** A stripe pattern ** }
  40.                      y_size = 8,            { ** for the sphere ** }
  41.                      name   = MIRROR_STRIPE,
  42.            
  43.                      RECTANGLE (
  44.                        start_x = 0, start_y = 0,
  45.                        end_x   = 16, end_y   = 4,
  46.            
  47.                        diff    = (.1, .1, .1),
  48.                        mirror  = (.8, .8, .8),
  49.                      )
  50.                    )
  51.            
  52.            PATTERN ( x_size = 60,        { ** Checkered pattern ** }
  53.                      y_size = 60,
  54.                      name   = CHECK,
  55.                      RECTANGLE (
  56.                        start_x = 0,
  57.                        start_y = 0,
  58.                        end_x   = 30,
  59.                        end_y   = 30,
  60.                        diff    = (.1,1.0,.1),
  61.                      )
  62.                      RECTANGLE (
  63.                        start_x = 30,
  64.                        start_y = 30,
  65.                        end_x   = 60,
  66.                        end_y   = 60,
  67.                        diff    = (.1,1.0,.1),
  68.                      )
  69.                    )
  70.            
  71.            PATTERN ( x_size = 40,        { ** Checkered pattern ** }
  72.                      y_size = 40,
  73.                      name   = CHECK_BLUE,
  74.                      RECTANGLE (
  75.                        start_x = 0,
  76.                        start_y = 0,
  77.                        end_x   = 20,
  78.                        end_y   = 20,
  79.                        diff    = (.7,.2,.7)
  80.                        amb     = (.32, .32, .32),
  81.                        reflect = .55
  82.                        sreflect= 20
  83.                      )
  84.                      RECTANGLE (
  85.                        start_x = 20,
  86.                        start_y = 20,
  87.                        end_x   = 40,
  88.                        end_y   = 40,
  89.                        diff    = (.7,.5,.7),
  90.                        amb     = (.32, .32, .32),
  91.                        reflect = .55
  92.                        sreflect= 20
  93.                      )
  94.                    )
  95.            PATTERN ( x_size = 80,               { ** brick pattern ** }
  96.                      y_size = 50,
  97.                      name   = BRICK,
  98.                      RECTANGLE (                { 1st half brick 1 }
  99.                        start_x = 0, start_y = 2,
  100.                        end_x   = 18, end_y   = 23,
  101.                        diff    = (1.00, .20, .20);
  102.                      )
  103.                      RECTANGLE (                { 2nd hald brick 1 }
  104.                        start_x = 62, start_y = 2,
  105.                        end_x   = 80, end_y   = 23,
  106.                        diff    = (1.00, .20, .20);
  107.                      )
  108.                      RECTANGLE (                { brick 2 }
  109.                        start_x = 22, start_y = 2,
  110.                        end_x   = 58, end_y   = 23,
  111.                        diff    = (.80, .20, .20);
  112.                      )
  113.                      RECTANGLE (                { brick 3 }
  114.                        start_x = 2, start_y = 27,
  115.                        end_x   = 38, end_y   = 48,
  116.                        diff    = (.85, .35, .10);
  117.                      )
  118.                      RECTANGLE (                { brick 4 }
  119.                        start_x = 42, start_y = 27,
  120.                        end_x   = 78, end_y   = 48,
  121.                        diff    = (.70, .25, .20);
  122.                      )
  123.                    )
  124.            
  125.            { *******************  OBJECTS  ******************* }
  126.            
  127.            { ** ground ** }
  128.            
  129.            PARALLELOGRAM ( loc  = (  -10000, 0,  -10000),
  130.                            v1   = (20000, 0,    0),
  131.                            v2   = (  0, 0, 20000),
  132.            
  133.                            diff = (  .8, .8, 0),
  134.                            pattern = CHECK
  135.                            xmult = 2
  136.                            ymult = 2
  137.                          )
  138.            
  139.            
  140.            BEGIN_BBOX
  141.            
  142.                BEGIN_BBOX
  143.            
  144.                    SPHERE ( loc = (200, 50, -80),
  145.                             radius = 35,
  146.                             diff = (.7, .3, .5),
  147.            
  148.                             pattern = MIRROR_STRIPE,
  149.                             xmult   = 1.5,
  150.                             ymult   = 1.5
  151.                           )
  152.            
  153.                    QUADRATIC ( loc = (200, 0, -80),
  154.            
  155.                                a    = 1,
  156.                                b    = 0,
  157.                                c    = 1,
  158.                                d    = 150,
  159.                                xmin = -13,
  160.                                xmax = 13,
  161.                                ymin = 0,
  162.                                ymax = 50,
  163.                                zmin = -13,
  164.                                zmax = 13,
  165.            
  166.                                diff = (.1, .1, .1),
  167.                                mirror = (.8, .8, .8)
  168.                              )
  169.            
  170.                END_BBOX
  171.            
  172.            
  173.                BEGIN_BBOX
  174.            
  175.                    SPHERE ( loc      = (200, 90, 80),
  176.                             radius   = 35,
  177.                             diff     = (.3, .3, .8),
  178.                             amb      = (.32, .32, .32),
  179.                             reflect  = .40
  180.                             sreflect = 20
  181.            
  182.                             pattern = CHECK_BLUE,
  183.                             xmult   = 1.0,
  184.                             ymult   = 1.0
  185.                           )
  186.            
  187.                    QUADRATIC ( loc = (200, 0, 80),
  188.            
  189.                                a    = 1,
  190.                                b    = 0,
  191.                                c    = 1,
  192.                                d    = 150,
  193.                                xmin = -13,
  194.                                xmax = 13,
  195.                                ymin = 0,
  196.                                ymax = 90,
  197.                                zmin = -13,
  198.                                zmax = 13,
  199.            
  200.                                diff = (.1, .1, .1),
  201.                                mirror = (.8, .8, .8)
  202.                              )
  203.            
  204.                END_BBOX
  205.            
  206.            END_BBOX
  207.            
  208.            
  209.            BEGIN_BBOX
  210.            
  211.                { ** a small brick wall ** }
  212.            
  213.                PARALLELOGRAM ( loc = (150, 00, -15),
  214.                                v1  = (0, 0, 30),
  215.                                v2  = (0, 100, 0)
  216.            
  217.                                diff = (1, 1, 1),
  218.                                pattern = BRICK
  219.            
  220.                                xmult = .5,
  221.                                ymult = .5
  222.                              )
  223.            
  224.                PARALLELOGRAM ( loc = (150, 00, -15),
  225.                                v1  = (100, 0, 0),
  226.                                v2  = (0, 100, 0)
  227.            
  228.                                diff = (1, 1, 1),
  229.                                pattern = BRICK
  230.            
  231.                                xmult = .5,
  232.                                ymult = .5
  233.                              )
  234.            
  235.                PARALLELOGRAM ( loc = (150, 00, 15),
  236.                                v1  = (100, 0, 0),
  237.                                v2  = (0, 100, 0)
  238.            
  239.                                diff = (1, 1, 1),
  240.                                pattern = BRICK
  241.            
  242.                                xmult = .5,
  243.                                ymult = .5
  244.                              )
  245.            
  246.            END_BBOX
  247.            
  248.            
  249.            { ** An observer ** }
  250.            
  251.            OBSERVER ( loc    = (-20 , 70, -40),
  252.                       lookat = (200, 50, 0)
  253.                     )
  254.            
  255.            { ** A lamp ** }
  256.            
  257.            LAMP ( loc = (120, 120, -50),
  258.                   radius = 5,
  259.                   dist = 80
  260.                 )
  261.            
  262.            LAMP ( loc = (120, 150, 80),
  263.                   radius = 5,
  264.                   dist = 70
  265.                 )
  266.            
  267.            SKY  ( horiz  = (.2, .2, .55),
  268.                   zenith = (.1, .1, .25),
  269.                   dither = 4
  270.                 )
  271.            
  272.            DEFAULT ( x_res = 320,      { ** parameters for Amiga ** }
  273.                      y_res = 400
  274.                      aspect= .56
  275.                    )
  276.            
  277.            FOC_LENGTH = 50
  278.            
  279.            
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.            
  293. FILE 2
  294.            
  295.  
  296. { **************************************************
  297.               
  298. Glass table with vase and candy bowl.  This
  299. is the first test of glass surfaces, and came out
  300. surprisingly well - it actually does look like
  301. glass!  This image requires QRT 1.4 to run.
  302.               
  303.               Rendered with QRT rayracing system
  304.            
  305.               Steve Koren -  23 AUG 88
  306.            
  307.              ************************************************** }
  308.            
  309.            
  310.            FILE_NAME = Table.RAW
  311.            
  312.            PATTERN ( x_size = 80,
  313.                      y_size = 30,
  314.                      name   = BLOCK,
  315.            
  316.                      RECTANGLE (
  317.                        start_x = 3,  start_y = 3,
  318.                        end_x   = 77, end_y   = 27,
  319.                        diff    = (.8, .7, .4);
  320.                      )
  321.                    )
  322.            
  323.            PATTERN ( x_size = 90,
  324.                      y_size = 90,
  325.                      name   = FLOOR,
  326.            
  327.                      RECTANGLE (
  328.                        start_x = 0,  start_y = 0,
  329.                        end_x   = 55, end_y   = 55,
  330.                        diff    = (.1, .8, .1)
  331.                      )
  332.            
  333.                      RECTANGLE (
  334.                        start_x = 60, start_y = 0
  335.                        end_x   = 85  end_y   = 55
  336.                        diff    = (.2, .3, .8)
  337.                      )
  338.            
  339.                      RECTANGLE (
  340.                        start_x = 0,  start_y = 60
  341.                        end_x   = 55  end_y   = 85
  342.                        diff    = (.2, .3, .8)
  343.                      )
  344.                    )
  345.            
  346.            BEGIN_INSTANCES
  347.            
  348.              { ** glass table leg - hollow glass cylender ** }
  349.            
  350.              NAME = table_leg;
  351.              BEGIN_BBOX
  352.            
  353.                QUADRATIC ( loc     = (0, 0, 0),
  354.                            a       = 1, b  = 0, c  = 1,
  355.                            d       = 300,
  356.            
  357.                            xmin    = -18, xmax = 18,
  358.                            ymin    = 0,   ymax = 70,
  359.                            zmin    = -18, zmax = 18,
  360.            
  361.                            diff    = (0, 0, 0),
  362.                            trans   = (.7, .7, .7),
  363.                            mirror  = (.25, .25, .25),
  364.                            index   = 1.33,
  365.                            density = (.022, .022, .022)
  366.                          )
  367.            
  368.                QUADRATIC ( loc     = (0, 0, 0),
  369.                            a       = 1, b  = 0, c  = 1,
  370.                            d       = 144,
  371.            
  372.                            xmin    = -12, xmax = 12,
  373.                            ymin    = 0,   ymax = 70,
  374.                            zmin    = -12, zmax = 12,
  375.            
  376.                            diff    = (0, 0, 0),
  377.                            trans   = (1, 1, 1),
  378.                            mirror  = (.1, .1, .1),
  379.                            index   = 1.33,
  380.                            density = (.022, .022, .022)
  381.                          )
  382.              END_BBOX
  383.            
  384.            END_INSTANCES
  385.            
  386.            { ******************** GROUND ********************** }
  387.            
  388.            PARALLELOGRAM ( loc = (-10000, 0, -10000),
  389.                            v1  = (0,0, 20000),
  390.                            v2  = (20000, 0, 0)
  391.            
  392.                            diff    = (.1, .1, .1),
  393.                            pattern = BLOCK
  394.                          )
  395.            
  396.            
  397.            { ******************** OBJECTS ********************** }
  398.            
  399.            { ** FLOOR ** }
  400.            
  401.            PARALLELOGRAM ( loc  = (80, .01, -20),
  402.                            v1   = (240, 0, 0),
  403.                            v2   = (0, 0, 240),
  404.                            diff = (0, 0, 0)
  405.            
  406.                            pattern = FLOOR
  407.                            xmult   = .8,
  408.                            ymult   = .8
  409.                          )
  410.            
  411.            { ** TABLE LEGS ** }
  412.            
  413.            BEGIN_BBOX
  414.              INSTANCE_OF ( name   = table_leg,
  415.                            loc    = (140, 0, 40)
  416.                          )
  417.            
  418.              INSTANCE_OF ( name   = table_leg,
  419.                            loc    = (260, 0, 40)
  420.                          )
  421.            END_BBOX
  422.            
  423.            BEGIN_BBOX
  424.              INSTANCE_OF ( name   = table_leg,
  425.                            loc    = (140, 0, 160)
  426.                          )
  427.            
  428.              INSTANCE_OF ( name   = table_leg,
  429.                            loc    = (260, 0, 160)
  430.                          )
  431.            END_BBOX
  432.            
  433.            { ** TABLE TOP ** }
  434.            
  435.            BEGIN_BBOX
  436.            
  437.              PARALLELOGRAM ( loc      = (100, 70, 0),
  438.                              v1       = (0, 0, 200),
  439.                              v2       = (200, 0, 0),
  440.            
  441.                              diff     = (0, 0, 0),
  442.                              trans    = (.7, .7, .7),
  443.                              mirror   = (.23, .23, .23),
  444.                              index    = 1.33,
  445.                              density  = (.015, .015, .015)
  446.                            )
  447.            
  448.              PARALLELOGRAM ( loc      = (100, 85, 0),
  449.                              v1       = (0, 0, 200),
  450.                              v2       = (200, 0, 0),
  451.            
  452.                              diff     = (0, 0, 0),
  453.                              trans    = (1, 1, 1),
  454.                              mirror   = (.25, .25, .25),
  455.                              index    = 1.33,
  456.                              density  = (.015, .015, .015)
  457.                            )
  458.            
  459.            
  460.              { ** SIDES ** }
  461.            
  462.              PARALLELOGRAM ( loc = (100, 70, 0),
  463.                              v1  = (0, 0, 200),
  464.                              v2  = (0, 15, 0),
  465.            
  466.                              diff     = (0, 0, 0),
  467.                              trans    = (.7, .7, .7),
  468.                              mirror   = (.23, .23, .23),
  469.                              index    = 1.33,
  470.                              density  = (.016, .016, .016)
  471.                            )
  472.            
  473.              PARALLELOGRAM ( loc = (100, 70, 0),
  474.                              v1  = (200, 0, 0),
  475.                              v2  = (0, 15, 0),
  476.            
  477.                              diff     = (0, 0, 0),
  478.                              trans    = (.7, .7, .7),
  479.                              mirror   = (.23, .23, .23),
  480.                              index    = 1.33,
  481.                              density  = (.016, .016, .016)
  482.                            )
  483.            
  484.              PARALLELOGRAM ( loc = (100, 70, 200),
  485.                              v1  = (200, 0, 0),
  486.                              v2  = (0, 15, 0),
  487.            
  488.                              diff     = (0, 0, 0),
  489.                              trans    = (.7, .7, .7),
  490.                              mirror   = (.23, .23, .23),
  491.                              index    = 1.33,
  492.                              density  = (.016, .016, .016)
  493.                            )
  494.            
  495.              PARALLELOGRAM ( loc = (300, 70, 0),
  496.                              v1  = (0, 0, 200),
  497.                              v2  = (0, 15, 0),
  498.            
  499.                              diff     = (0, 0, 0),
  500.                              trans    = (.7, .7, .7),
  501.                              mirror   = (.23, .23, .23),
  502.                              index    = 1.33,
  503.                              density  = (.016, .016, .016)
  504.                            )
  505.            
  506.            END_BBOX
  507.            
  508.            { ** CANDY BOWL  & VASE ** }
  509.            
  510.            BEGIN_BBOX
  511.            
  512.              BEGIN_BBOX
  513.                QUADRATIC ( loc     = (200, 100, 100),
  514.                            a       = 1, b  = 2, c  = 1,
  515.                            d       = 900,
  516.            
  517.                            xmin    = -30, xmax = 30,
  518.                            ymin    = -15, ymax = 0,
  519.                            zmin    = -30, zmax = 30,
  520.            
  521.                            diff    = (1, .1, .1),
  522.                            reflect = .8
  523.                            sreflect= 20
  524.                          )
  525.            
  526.                SPHERE   ( loc      = (185, 95, 110),
  527.                           radius   = 7,
  528.                           diff     = (.1, .1, 1)
  529.                         )
  530.            
  531.                SPHERE   ( loc      = (200, 93, 80),
  532.                           radius   = 7,
  533.                           diff     = (.1, 1, .1)
  534.                         )
  535.            
  536.              END_BBOX
  537.            
  538.              { ** VASE ** }
  539.            
  540.              BEGIN_BBOX
  541.            
  542.                QUADRATIC ( loc     = (260, 85, 50),
  543.                            a       = 1, b = 0, c = 1,
  544.                            d       = 100,
  545.            
  546.                            xmin    = -10, xmax = 10,
  547.                            ymin    = 0,   ymax = 50,
  548.                            zmin    = -10, zmax = 10,
  549.            
  550.                            diff    = (.1, .7, .1),
  551.                            reflect = .7,
  552.                            sreflect=20
  553.                          )
  554.              END_BBOX
  555.            
  556.            END_BBOX
  557.            
  558.            OBSERVER ( loc    = (-50, 180, -30)
  559.                       lookat = (180, 50, 100)
  560.                     )
  561.            
  562.            SKY ( horiz  = (.10, .1, .75)
  563.                  zenith = (.10, .1, .60)
  564.                  dither = 4
  565.                )
  566.            
  567.            LAMP ( loc = (150, 250, -80)
  568.                   radius = 5,
  569.                   dist = 250
  570.                 )
  571.            
  572.            LAMP ( loc = (250, 50, 250),
  573.                   radius = 5,
  574.                   dist   = 60
  575.                 )
  576.            
  577.            
  578.            DEFAULT ( x_res = 320,       { Amiga parameters }
  579.                      y_res = 400
  580.                      aspect= .56
  581.                    )
  582.            
  583.            FOC_LENGTH = 50
  584.            
  585.