home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / formats / radiance / spec / tutorial.ms < prev    next >
Text File  |  1994-04-15  |  29KB  |  1,121 lines

  1. .\" SCCSid "@(#)tutorial.1 2.2 1/24/93 LBL"
  2. .\"Print using the -ms macro package
  3. .ps 11
  4. .nr PS 11
  5. .vs 14
  6. .nr VS 14
  7. .TL
  8. RADIANCE Tutorial
  9. .AU
  10. Greg Ward
  11. .br
  12. Lawrence Berkeley Laboratory
  13. .NH
  14. Introduction
  15. .sp .5
  16. .LP
  17. RADIANCE is a lighting simulation program that synthesizes images
  18. from 3-dimensional geometric models of physical spaces.
  19. The input model describes each surface's shape, size, location and
  20. composition.
  21. A model may contain many thousands of surfaces, and is often produced
  22. by a separate CAD program.
  23. In addition to arbitrary (planar) polygons, RADIANCE directly models
  24. spheres and cones.
  25. Generator programs are provided for the creation of more complex
  26. shapes from these basic
  27. surface primitives.
  28. Examples include boxes, prisms and surfaces of revolution.
  29. A transformation utility permits the simple duplication of objects and
  30. hierarchical construction of a scene.
  31. .sp .5
  32. .LP
  33. This tutorial assumes a certain familiarity with the UNIX
  34. operating system and its text editing facilities.
  35. Ask your system administrator for a basic introduction.
  36. .sp .5
  37. .LP
  38. The RADIANCE reference manual will be required to understand the following
  39. examples of scene creation and program interaction.
  40. Text in
  41. .I italics
  42. is user input.
  43. .NH
  44. Input of a Simple Room
  45. .sp .5
  46. .LP
  47. In this example, we will use a text editor to create the input for
  48. a simple room containing a box, a ball, and a light source.
  49. In most applications, a CAD system would be used to describe a scene's
  50. geometry, which would then be combined with surface materials,
  51. light fixtures, and (optionally) furniture.
  52. To get a more intimate understanding of the input to RADIANCE, we will
  53. start without the advantages of a CAD program or an object library.
  54. .sp .5
  55. .LP
  56. The scene we will be working towards is shown in Figure 1.
  57. It is usually helpful to start with a simple drawing showing the
  58. coordinate axis and the relative locations of major surfaces.
  59. .sp .5
  60. .LP
  61. The minimum input required to get an image is a source of
  62. illumination and an object to reflect light to the "camera".*\0
  63. .FS
  64. *In fact, a RADIANCE renderer can be thought of an invisible camera
  65. in a simulated world.
  66. .FE
  67. We will begin with two spheres, one emissive and one reflective.
  68. First we define the materials, then the spheres themselves.
  69. Actually, the order is only important insofar as each modifier definition 
  70. (i.e. material) must appear before its first reference.
  71. (Consult the RADIANCE manual for an explanation of the
  72. primitive types and their parameters.)\0
  73. Start your favorite text editor ("vi" in this example) to create the
  74. following file called "room.rad":
  75. .sp .5
  76. .QP
  77. %
  78. .I "vi room.rad"
  79. .sp .5
  80. .QP
  81. .I
  82. .nf
  83. #
  84. #  My first scene.
  85. #
  86.  
  87. # this is the material for my light source:
  88.  
  89. void light bright
  90. 0
  91. 0
  92. 3  100  100  100
  93.  
  94. # this is the material for my test ball:
  95.  
  96. void plastic red_plastic
  97. 0
  98. 0
  99. 5  .7  .05  .05  .05  .05
  100.  
  101. # here is the light source:
  102.  
  103. bright sphere fixture
  104. 0
  105. 0
  106. 4  2  1  1.5  .125
  107.  
  108. # here is the ball:
  109.  
  110. red_plastic sphere ball
  111. 0
  112. 0
  113. 4  .7  1.125  .625  .125
  114. .fi
  115. .R
  116. .sp .5
  117. .LP
  118. Now that we have a simple scene description, we can look at it with
  119. the interactive viewing program,
  120. .B rview.
  121. First, however, we must create the "octree"
  122. file that will be used to accelerate the rendering process.
  123. To accomplish this, type the following command:
  124. .sp .5
  125. .QP
  126. %
  127. .I
  128. oconv room.rad > test.oct
  129. .R
  130. .sp .5
  131. .LP
  132. Note that the suffixes ".rad" and ".oct" are not enforced by the program,
  133. but are merely a convenience to aid the user in identifying files later.
  134. The command
  135. .B getinfo
  136. can be used to get information on the origin of binary (unviewable)
  137. files created by RADIANCE utilities.
  138. Try entering the command:
  139. .sp .5
  140. .QP
  141. %
  142. .I "getinfo test.oct"
  143. .sp .5
  144. .LP
  145. The usefulness of such a function will be apparent when you find
  146. yourself with a dozen files named "test.pic".
  147. .sp .5
  148. .LP
  149. To make an image of our scene,
  150. we must select a suitable set of view parameters telling RADIANCE
  151. where to point its camera.
  152. To simplify our example, we will use the same starting position for
  153. all our renderings, and change views only once
  154. .B rview
  155. is started:
  156. .sp .5
  157. .QP
  158. %
  159. .I
  160. rview -vp 2.25 .375 1 -vd -.25 .125 -.125 -av .5 .5 .5 test.oct
  161. .R
  162. .sp .5
  163. .LP
  164. The "-vp" option gives the view point, and the "-vd" option gives
  165. the view direction vector.
  166. The "-av" option specifies the amount of light globally present
  167. in the scene, permitting portions of the scene that are not
  168. illuminated directly to be visible.
  169. .B Rview
  170. has many more options, and their default values may be discovered using:
  171. .sp .5
  172. .QP
  173. %
  174. .I "rview -defaults"
  175. .sp .5
  176. .LP
  177. You should start to see an image of a red ball forming on your screen.
  178. Take this opportunity to try each of
  179. .B rview's
  180. commands, as described in the manual.
  181. If you make a mistake in a view specification, use the
  182. .B last
  183. command to get back to where you were.
  184. It is probably a good idea to save your favorite view using the rview
  185. command:
  186. .sp .5
  187. .QP
  188. :
  189. .I "view default.vp"
  190. .sp .5
  191. .LP
  192. You can create any number of "viewfiles"
  193. with this command, and retrieve them with:
  194. .sp .5
  195. .QP
  196. :
  197. .I last
  198. viewfile
  199. .sp .5
  200. .LP
  201. If you look around enough, you may even be able to see the light source
  202. itself.
  203. Unlike many rendering programs, the light sources in RADIANCE are
  204. visible objects.
  205. This illustrates the philosophy behind the program, which is the simulation
  206. of physical spaces.
  207. Since it is not possible to create an invisible light source in reality,
  208. there is no reason to do it in simulation.
  209. .sp .5
  210. .LP
  211. Still, there is no guarantee that the user will create physically meaningful
  212. descriptions.
  213. For example, we have just floated a red ball next to a light source somewhere
  214. in intergalactic space.
  215. In the interest of making this scene more realistic, let's enclose the
  216. light and ball in a room by adding the following text to "room.rad":
  217. .sp .5
  218. .QP
  219. %
  220. .I "vi room.rad"
  221. .sp .5
  222. .QP
  223. .I
  224. .nf
  225. # the wall material:
  226.  
  227. void plastic gray_paint
  228. 0
  229. 0
  230. 5  .5  .5  .5  0  0
  231.  
  232. # a box shaped room:
  233.  
  234. !genbox gray_paint room  3  2  1.75  -i
  235. .fi
  236. .R
  237. .sp .5
  238. .LP
  239. The generator program
  240. .B genbox
  241. is just a command that produces a RADIANCE description, and it is
  242. executed when the file is read.
  243. It is more convenient than specifying the coordinates of four vertices
  244. for each of six polygons, and can be changed later quite easily.
  245. (See the manual genbox page for further details.)\0
  246. .sp .5
  247. .LP
  248. You can now look at the modified scene, but remember first to
  249. regenerate the octree:
  250. .sp .5
  251. .QP
  252. %
  253. .I "oconv room.rad > test.oct"
  254. .br
  255. %
  256. .I "rview -vf default.vp -av  .5  .5  .5  test.oct"
  257. .sp .5
  258. .LP
  259. This is better, but our ball and light source are still floating, which
  260. is an unrealistic condition for most rooms.
  261. Let's put a box under the table, and a rod to suspend the light from
  262. the ceiling:
  263. .sp .5
  264. .QP
  265. .I
  266. .nf
  267. # a shiny blue box:
  268.  
  269. void plastic blue_plastic
  270. 0
  271. 0
  272. 5 .1 .1 .6 .05 .1
  273.  
  274. !genbox blue_plastic box  .5  .5  .5  | xform -rz  15  -t  .5  .75  0
  275.  
  276. # a chrome rod to suspend the light from the ceiling:
  277.  
  278. void metal chrome
  279. 0
  280. 0
  281. 5  .8  .8  .8  .9  0
  282.  
  283. chrome cylinder fixture_support
  284. 0
  285. 0
  286. 7
  287. 211.5
  288. 211.75
  289. .05
  290. .fi
  291. .R
  292. .sp .5
  293. .LP
  294. Note that this time the output of genbox was "piped" into another program,
  295. .B xform.
  296. .B Xform
  297. is used to move, scale and rotate RADIANCE descriptions.
  298. .B Genbox
  299. always creates a box in the positive octant of 3-space with
  300. one corner at the origin.
  301. This was what we wanted for the room, but we wanted the box moved away
  302. from the wall and rotated slightly.
  303. First we rotated the box 15 degrees about the z-axis (pivoting on the
  304. origin), then translated the corner from the origin to (.5,.75,0).
  305. By no small coincidence, this position is directly under our original
  306. ball.
  307. .sp .5
  308. .LP
  309. After viewing this new arrangement, you can try changing some of the
  310. materials -- here are a few examples:
  311. .sp .5
  312. .QP
  313. .I
  314. .nf
  315. # solid crystal:
  316.  
  317. void dielectric crystal
  318. 0
  319. 0
  320. 5  .5  .5  .5  1.5  0
  321.  
  322. # dark brown:
  323.  
  324. void plastic brown
  325. 0
  326. 0
  327. 5  .2  .1  .1  0  0
  328.  
  329. # light gray:
  330.  
  331. void plastic white
  332. 0
  333. 0
  334. 5  .7  .7  .7  0  0
  335. .fi
  336. .R
  337. .sp .5
  338. .LP
  339. To change the ball from red_plastic to the crystal defined above, simply
  340. replace
  341. .I "red_plastic sphere ball"
  342. with
  343. .I "crystal sphere ball".
  344. Note once again that the definition of the new materials must
  345. precede any references to them.
  346. Changing the materials for the floor and ceiling of the room is a little
  347. more difficult.
  348. Since
  349. .B genbox
  350. creates six rectangles, all using the same material,
  351. it is necessary to replace the command with its output before we can
  352. make the required changes.
  353. To do this, enter the command directly:
  354. .sp .5
  355. .QP
  356. %
  357. .I
  358. genbox gray_paint room  3  2  1.75  -i >> room.rad
  359. .R
  360. .sp .5
  361. .LP
  362. The double arrow ">>" causes the output to be "appended" to the end
  363. of the file, rather than overwriting its contents.
  364. Now edit the file and change the ceiling
  365. material to "white", and the floor material
  366. to "brown".
  367. (Hint:  the ceiling is the polygon whose z coordinates are all high.
  368. And don't forget to remove the original
  369. .B genbox
  370. command from the file!)
  371. .sp .5
  372. .LP
  373. Once you have chosen a nice view, you can generate a high-resolution
  374. image in batch mode using the
  375. .B rpict
  376. command:
  377. .sp .5
  378. .QP
  379. %
  380. .I "rpict -vf"
  381. myview
  382. .I "-av  .5  .5  .5  test.oct > test.pic &"
  383. .br
  384. [PID]
  385. .sp .5
  386. .LP
  387. The ampersand "&" causes the program to run in the background, so you can
  388. log out and go home while the computer continues to work on your picture.
  389. The bracketed number [PID]
  390. printed by the C-shell command interpreter is the process
  391. id that can be used later to check the progress or kill the program.
  392. This number can also be determined by the
  393. .B ps
  394. command:
  395. .sp .5
  396. .QP
  397. %
  398. .I ps
  399. .sp .5
  400. .LP
  401. The number preceding the
  402. .B rpict
  403. command is the process id.
  404. If you want to kill the process later, use the command:
  405. .sp .5
  406. .QP
  407. %
  408. .I kill
  409. PID
  410. .sp .5
  411. .LP
  412. If you only want a progress report, use the form:
  413. .sp .5
  414. .QP
  415. %
  416. .I "kill -CONT"
  417. PID
  418. .sp .5
  419. .LP
  420. This sends a "continue" signal to
  421. .B rpict,
  422. which then prints out the percentage completion.
  423. Note that this is a special feature of rpict, and will not work with most
  424. programs.
  425. Also note that this works only for the current login session.
  426. If you log on later on a different terminal (or window),
  427. .B rpict
  428. will not send the report to the correct place.
  429. It is usually a good idea, therefore, to give
  430. .B rpict
  431. an error file argument if it is running a long job:
  432. .sp .5
  433. .QP
  434. %
  435. .I rpict
  436. .I -e
  437. errfile ...
  438. .sp .5
  439. .LP
  440. Now sending an alarm signal will result in
  441. .B rpict
  442. reporting to the end of the specified error file.
  443. Alternatively,
  444. you can use the
  445. .I -t
  446. option to generate reports automatically at regular intervals.
  447. You can check the reports at any time by printing the file:
  448. .sp .5
  449. .QP
  450. %
  451. .I cat
  452. errfile
  453. .sp .5
  454. .LP
  455. This file will also contain a header, and any errors that occurred.
  456. .NH
  457. Addition of a Window
  458. .sp .5
  459. .LP
  460. Adding a window to the room requires two basic steps.
  461. The first step is to cut a hole in the wall an put in a piece of glass.
  462. The second step is to put something outside to make the view worth having.
  463. Since there are no explicit holes allowed in RADIANCE polygons, we use the
  464. trick of coincident edges (making a seam) to give the appearance of a hole.
  465. The new polygon for the window wall is shown in Figure 2.
  466. .KF
  467. .sp 18
  468. .QP
  469. .B "Figure 2."
  470. The window wall with a hole cut in it.
  471. .sp
  472. .KE
  473. .sp .5
  474. .LP
  475. To create the window wall, change the appropriate polygon in the scene
  476. file (modified part in italics).
  477. If you haven't done so already, follow the instructions in
  478. the previous section to change the
  479. .B genbox
  480. command in the file to its corresponding polygons.
  481. .sp .5
  482. .KS
  483. .QP
  484. %
  485. .I "vi room.rad"
  486. .sp .5
  487. .QP
  488. .nf
  489. gray_paint polygon room.5137
  490. 0
  491. 0
  492. .I
  493. 30
  494. 321.75
  495. 320
  496. 300
  497. 301.75
  498. 3.6251.75
  499. 3.625.625
  500. 31.375.625
  501. 31.3751.375
  502. 3.6251.375
  503. 3.6251.75
  504. .fi
  505. .R
  506. .sp .5
  507. .KE
  508. .LP
  509. Next, create a separate file for the window.
  510. (The use of separate files is desirable for parts of the scene that
  511. will be manipulated independently, as we will see in a moment.)
  512. .sp .5
  513. .QP
  514. %
  515. .I "vi window.rad"
  516. .sp .5
  517. .QP
  518. .nf
  519. .I
  520. # an 88% transmittance glass window has a transmission of 96%:
  521.  
  522. void glass window_glass
  523. 0
  524. 0
  525. 3 .96 .96 .96
  526.  
  527. window_glass polygon window
  528. 0
  529. 0
  530. 12
  531. 3.6251.375
  532. 31.3751.375
  533. 31.375.625
  534. 3.625.625
  535. .fi
  536. .R
  537. .sp .5
  538. .LP
  539. The vertex order is very important, especially for polygons with holes.
  540. Normally, vertices are listed in counterclockwise order as seen from the
  541. front.
  542. However, the hole of a polygon has its vertices listed in the opposite
  543. order.
  544. This insures that the seam does not cross itself.
  545. .sp .5
  546. .LP
  547. The next step is the description of the scene outside the window.
  548. A special purpose generator,
  549. .B gensky,
  550. will create a description of the sun and sky which will be
  551. stored in a separate file.
  552. The arguments to
  553. .B gensky
  554. are the month, day and hour (local standard time).
  555. The following command produces a description for 10:00 solar time
  556. on March 20th at latitude of 40 degrees:
  557. .sp .5
  558. .QP
  559. %
  560. .I "gensky 3 20 10 -o 0 -m 0 -a 40 > sky.rad"
  561. .sp .5
  562. .LP
  563. The file "sky.rad"
  564. contains only a description of the sun and the sky
  565. .UL distribution.
  566. The actual sky and ground are still undefined, so we will create another
  567. short file containing a generic background:
  568. .sp .5
  569. .QP
  570. %
  571. .I "vi outside.rad"
  572. .sp .5
  573. .QP
  574. .nf
  575. .I
  576. #
  577. # A standard sky and ground to follow a gensky sun and sky distribution.
  578. #
  579.  
  580. skyfunc glow sky_glow
  581. 0
  582. 0
  583. 4 .9 .9 1.15 0
  584.  
  585. sky_glow source sky
  586. 0
  587. 0
  588. 4 0 0 1 180
  589.  
  590. skyfunc glow ground_glow
  591. 0
  592. 0
  593. 4 1.4 .9 .6 0
  594.  
  595. ground_glow source ground
  596. 0
  597. 0
  598. 4 0 0 -1 180
  599. .fi
  600. .R
  601. .sp .5
  602. .LP
  603. We can now put these elements together in one octree file using
  604. .B oconv:
  605. .sp .5
  606. .QP
  607. %
  608. .I "oconv outside.rad sky.rad window.rad room.rad > test.oct"
  609. .sp .5
  610. .LP
  611. Note that the above command results in the following error message:
  612. .DS
  613. oconv: fatal - (outside.rad): undefined modifier "skyfunc"
  614. .DE
  615. The modifier is undefined because we put "outside.rad",
  616. which uses
  617. .I skyfunc
  618. before "sky.rad" where
  619. .I skyfunc
  620. is defined.
  621. It is therefore necessary to change the order of the files so that
  622. .I skyfunc
  623. is defined
  624. .UL before
  625. it is used:
  626. .sp .5
  627. .QP
  628. %
  629. .I "oconv sky.rad outside.rad window.rad room.rad > test.oct"
  630. .sp .5
  631. .LP
  632. Now let's look at our modified scene, using the same rview command as before:
  633. .sp .5
  634. .QP
  635. %
  636. .I "rview -vf default.vp -av .5 .5 .5 test.oct"
  637. .sp .5
  638. .LP
  639. As you look around the scene, you will need to adjust the exposure repeatedly
  640. to be able to see detail over the wide dynamic range now present.
  641. To do this, wait a few seconds after choosing each new view and enter the
  642. command:
  643. .sp .5
  644. .QP
  645. :
  646. .I "exposure 1"
  647. .sp .5
  648. .LP
  649. or simply:
  650. .sp .5
  651. .QP
  652. :
  653. .I "e 1"
  654. .sp .5
  655. .LP
  656. All commands in
  657. .B rview
  658. can be abbreviated by one or two letters.
  659. Additional control over the exposure is possible by changing the multiplier
  660. factor to a value greater than one to lighten or less than one to darken.
  661. It is also possible to use absolute settings and spot normalization.
  662. See the
  663. .B rview
  664. manual entry for details.
  665. .sp .5
  666. .LP
  667. You may notice that other than a patch of sun on the floor, the window does
  668. not seem to illuminate the room.
  669. In RADIANCE, certain surfaces act as light sources and others do not.
  670. Whether or not a surface is a light source is determined by its material
  671. type.
  672. Surfaces made from the material types
  673. .I "light, illum, spotlight"
  674. and (sometimes)
  675. .I glow
  676. will act as light sources, whereas surfaces made from
  677. .I "plastic, metal, glass"
  678. and other material types will not.
  679. In order for the window to directly illuminate the room, it is therefore
  680. necessary to change its material type.
  681. We will use the type
  682. .I illum
  683. because it is specially designed for "secondary" light sources such as
  684. windows and other bright objects that are not merely emitters but have
  685. other important visual properties.
  686. An
  687. .I illum
  688. will act as a light source for parts of the calculation, but when viewed
  689. directly will appear as if made from a different material (or disappear
  690. altogether).
  691. .sp .5
  692. .LP
  693. Rather than modify the contents of "window.rad" which is a perfectly
  694. valid description of a non-source window, let's create a new file, which
  695. we can substitute during octree creation, called "srcwindow.rad":
  696. .sp .5
  697. .QP
  698. %
  699. .I "vi srcwindow.rad"
  700. .sp .5
  701. .QP
  702. .nf
  703. .I
  704. #
  705. # An emissive window
  706. #
  707.  
  708. # visible glass type for illum:
  709.  
  710. void glass window_glass
  711. 0
  712. 0
  713. 3 .96 .96 .96
  714.  
  715. # window distribution function, including angular transmittance:
  716.  
  717. skyfunc brightfunc window_dist
  718. 2 winxmit winxmit.cal
  719. 0
  720. 0
  721.  
  722. # illum for window, using 88% transmittance at normal incidence:
  723.  
  724. window_dist illum window_illum
  725. 1 window_glass
  726. 0
  727. 3 .88 .88 .88
  728.  
  729. # the source polygon:
  730.  
  731. window_illum polygon window
  732. 0
  733. 0
  734. 12
  735.         3       .625    1.375
  736.         3       1.375   1.375
  737.         3       1.375   .625
  738.         3       .625    .625
  739. .R
  740. .fi
  741. .sp .5
  742. .LP
  743. There are a couple of things you should notice in this file
  744. The first definition is the normal glass type, window_glass,
  745. which is used for the alternate material for the
  746. .I illum
  747. window_illum.
  748. Next is the window distribution function, which is the sky distribution
  749. modified by angular transmittance of glass defined in winxmit.cal.
  750. Finally comes the
  751. .I illum
  752. itself, which is the secondary source material for the window.
  753. .sp .5
  754. .LP
  755. To look at the scene, simply substitute "srcwindow.rad" for "window.rad"
  756. in the previous
  757. .B oconv
  758. command, thus:
  759. .sp .5
  760. .QP
  761. %
  762. .I "oconv sky.rad outside.rad srcwindow.rad room.rad > test.oct"
  763. .sp .5
  764. .LP
  765. You can look at the room at different times by changing the
  766. .B gensky
  767. command used to create "sky.rad" and regenerating the octree.
  768. (Although the octree does not strictly need to be recreated for
  769. .UL every
  770. change to the input files, it is good to get in the habit until
  771. the exceptions are well understood.)\0
  772. .NH
  773. Outside Geometry
  774. .sp .5
  775. .LP
  776. If the exterior of a space is not approximated well by an infinitely
  777. distant sky and ground, we can add a better description
  778. to calculate a more accurate window output distribution as well as
  779. a better view outside the window.
  780. Let's add a ground plane and a nearby building to the "outside.rad"
  781. file we created earlier:
  782. .sp .5
  783. .QP
  784. .nf
  785. .I
  786. # Terra Firma:
  787.  
  788. void plastic ground_mat
  789. 0
  790. 0
  791. 5 .28 .18 .12 0 0
  792.  
  793. ground_mat ring groundplane
  794. 0
  795. 0
  796. 8
  797. 00-.01
  798. 001
  799. 030
  800.  
  801. # A big, ugly, mirrored glass building:
  802.  
  803. void mirror reflect20
  804. 0
  805. 0
  806. 3 .15 .2 .2
  807.  
  808. !genbox reflect20 building 10 10 2 | xform -t 10 5 0
  809. .R
  810. .fi
  811. .sp .5
  812. .LP
  813. Note that the groundplane was given a slightly negative z value.
  814. This is very important so that the ground does not peek through
  815. the floor we have defined.
  816. The material type 
  817. .I mirror,
  818. used to define the neighboring structure, is special in RADIANCE.
  819. Surfaces of this type as well as the types
  820. .I prism1
  821. and
  822. .I prism2
  823. participate in something called the "virtual light source" calculation.
  824. In short, this means that the surfaces of the building we have created
  825. will reflect sunlight and any other light source present in our scene.
  826. The virtual light source material types should be used with care since
  827. they can result in substantial growth in the calculation.
  828. It would be a good idea in the example above to remove the bottom
  829. surface of the building (which cannot be seen from the outside anyway)
  830. and change the roof type to metal or some non-reflecting material.
  831. This can be done using the same manual process described earlier for
  832. changing the room surface materials.
  833. .sp .5
  834. .LP
  835. Now that we have a better description of the outside, what do we do
  836. with it?
  837. If we simply substitute it in our scene without changing the description
  838. of the window
  839. .I illum,
  840. the distribution of light from the window will be slightly wrong because
  841. the "skybright" function only describes light from the sky and the ground,
  842. not from other structures.
  843. Using this approximation might be acceptable in some cases, but let's
  844. assume that accuracy is one of our main goals in life.
  845. There are two ways to an accurate calculation of light from a window.
  846. The first is to treat the window as an ordinary window and rely on the
  847. default interreflection calculation of RADIANCE, and the second is to 
  848. use the program
  849. .B mkillum
  850. to calculate the window distribution separately so we can still treat
  851. it as an
  852. .I illum
  853. light source.
  854. Let's try them both.
  855. .sp .5
  856. .LP
  857. Using the default interreflection calculation is probably easier, but
  858. as we shall see it takes a little longer to get a good result in this
  859. case.
  860. To use the interreflection calculation, we first create an octree
  861. using the original glass window and our new description of the outside:
  862. .sp .5
  863. .QP
  864. %
  865. .I "oconv sky.rad outside.rad window.rad room.rad > test.oct"
  866. .sp .5
  867. .LP
  868. Now we just add a few new options to our rview command like so:
  869. .sp .5
  870. .QP
  871. %
  872. .I "rview -vf default.vp -dr 1 -av .5 .5 .5 -ab 1 -ad 200 -as 80 -ar 80 test.oct"
  873. .sp .5
  874. .LP
  875. The
  876. .I \-dr
  877. parameter tells
  878. .B rview
  879. how many reflections to allow in the virtual light source calculation.
  880. Because of the geometry of our scene, there will never be more than
  881. one reflection from our exterior building.
  882. The
  883. .I \-ab
  884. parameter tells
  885. .B rview
  886. how many diffuse interreflections to follow.
  887. When this value is 0, there is no interreflection calculation.
  888. By setting this parameter to 1, we compute the first diffuse interreflection
  889. (eg. from the sun patch to the wall) as well as the contribution from
  890. the sky and exterior objects through the window.
  891. The
  892. .I \-ad
  893. option tells
  894. .B rview
  895. how many rays to use in its initial sampling of the hemisphere for the
  896. diffuse interreflection calculation.
  897. We have set this value high enough so the program can find the
  898. relatively small window and its sun patch.
  899. The
  900. .I \-as
  901. option tells the program how many rays to send to particularly bright
  902. areas of the hemisphere.
  903. Since we know that we will have such bright areas, we set this value to
  904. something which is around half the initial sample.
  905. The
  906. .I \-ar
  907. option tells
  908. .B rview
  909. at what resolution it can relax the accuracy of the interreflection
  910. calculation.
  911. This number is relative to the overall size of our scene, which can be
  912. determined using
  913. .I getinfo
  914. on the octree like so:
  915. .sp .5
  916. .QP
  917. %
  918. .I "getinfo -d test.oct"
  919. .sp .5
  920. .LP
  921. This command reveals that our scene has an overall dimension of 60 (due
  922. to the large ring we have used for our ground plane).
  923. In order to have good resolution in our interior space, we set the value
  924. so that 60 divided by this parameter is somewhat less than one quarter
  925. the dimension of our interior space.
  926. Unfortunately, many of the calculation parameters used in Radiance are
  927. difficult to set correctly the first time, and require some experience
  928. as well as knowledge about the calculation.
  929. .sp .5
  930. .LP
  931. Probably the first thing you notice after starting
  932. .B rview
  933. is that nothing happens.
  934. It takes the calculation a while to get going, as it must trace
  935. may rays at the outset to determine the contribution at each
  936. point from the window area.
  937. Once
  938. .B rview
  939. has stored up some values, the progress rate improves, but it
  940. never really reaches blistering speed.
  941. .sp .5
  942. .LP
  943. A more efficient alternative in this case is to use the program
  944. .B mkillum
  945. to create a modified window file that uses calculated data values to
  946. define its light output distribution.
  947. Applying mkillum is relatively straightforward in this case.
  948. You simply give it an octree defined with the normal window and the file
  949. describing this window and it creates a new window description using
  950. calculated data values:
  951. .sp .5
  952. .QP
  953. %
  954. .I "oconv sky.rad outside.rad window.rad room.rad > test.oct"
  955. .br
  956. %
  957. .I "mkillum -av 18 18 18 -ab 0 test.oct < window.rad > mkiwindow.rad"
  958. .sp .5
  959. .LP
  960. The
  961. .I \-av
  962. value is appropriate for the outside, which is much brighter, as
  963. suggested by the output of the gensky command stored in "sky.rad".
  964. The
  965. .I \-ab
  966. option is set to 0, because outside the building we do not expect
  967. interreflections to play as important a role as in the interior (plus we
  968. are trying to save some time).
  969. The
  970. .B mkillum
  971. command may take a few minutes, so be patient.
  972. If we look at the output file from
  973. .I mkillum,
  974. we see that it uses a pattern type called
  975. .I brightdata,
  976. which refers to a data file called "illum.dat".
  977. This file contains the results of an
  978. .B rtrace
  979. calculation, which traced many rays in each direction from the window in
  980. order to determine its brightness distribution.
  981. Now we can create an octree using this new file and render it with
  982. .B rview,
  983. this time without the interreflection calculation:
  984. .sp .5
  985. .QP
  986. %
  987. .I "oconv sky.rad outside.rad mkiwindow.rad room.rad > test.oct"
  988. .br
  989. %
  990. .I "rview -vf default.vp -av .5 .5 .5 test.oct"
  991. .sp .5
  992. .LP
  993. You will notice that the calculation proceeds much more quickly, and
  994. even produces a smoother looking result.
  995. Aside from waiting for mkillum to finish, there is an additional price
  996. for this speed advantage, however.
  997. The contribution from the sun patch on the floor is no longer being
  998. considered, since we are not performing an interreflection calculation
  999. inside our space.
  1000. The light from the window is being taken care of by the mkillum output,
  1001. but the solar patch is not.
  1002. In most cases, we endeavor to prevent direct sun from entering the
  1003. space, and in the morning hours this is true for our model, but
  1004. otherwise it is necessary to use the diffuse interreflection calculation
  1005. to correctly account for all contributions.
  1006. .NH
  1007. Discomfort Glare
  1008. .sp .5
  1009. .LP
  1010. Especially in scenes containing daylight, situations arise where the
  1011. occupant is uncomfortable due to large differences in the brightness of
  1012. the visual field.
  1013. For example, trying to look at someone's face when they are backlit by a
  1014. bright window is difficult and painful.
  1015. We would therefore like some way to predict the effects of such bright
  1016. sources of illumination when designing a space.
  1017. RADIANCE provides just such a calculation.
  1018. .sp .5
  1019. .LP
  1020. Let's start by generating a fisheye picture of our design space:
  1021. .sp .5
  1022. .QP
  1023. %
  1024. .I "rpict -vta -vp 1.5 .8 1 -vd 0 1 0 -vh 240 -vv 180 -av .5 .5 .5 test.oct > fish.pic"
  1025. .sp .5
  1026. .LP
  1027. This picture will be used to identify sources of glare from a particular
  1028. view point (1.5, 1, 1) about a particular direction (0, 1, 0).
  1029. Since RADIANCE pictures contain true floating point radiance values,
  1030. they can be used to analyze a visual environment for problems such as
  1031. discomfort glare.
  1032. Once
  1033. .I rpict
  1034. has finished (and this may take the better part of an hour), you may
  1035. display the image using
  1036. .B ximage
  1037. or whatever display program you have available on your system.
  1038. A fisheye perspective is a type of distortion that allows a wider field
  1039. of view than a standard perspective image.
  1040. This larger field is used by the program
  1041. .I findglare
  1042. to locate any and all bright spots that might affect visual comfort.
  1043. .B Findglare
  1044. can also use direct calculation with
  1045. .B rtrace,
  1046. but this takes a long time without providing the nice visual feedback one
  1047. gets from an image.
  1048. .sp .5
  1049. .LP
  1050. To facilitate the use of
  1051. .B findglare
  1052. and the associated programs
  1053. .B glarendx
  1054. and
  1055. .B xglaresrc,
  1056. a script has been written called
  1057. .B glare.
  1058. This script asks you some questions and to make it a little easier to
  1059. get a nice result.
  1060. To start the script, simply type
  1061. .I glare
  1062. on the command line.
  1063. When it asks you a name for the glare file you want to work with, enter
  1064. something innocuous like "test.glr".
  1065. It will tell you that the file does not exist, so we will have to create
  1066. it.
  1067. It then prompts you for the name of the picture and the name of the
  1068. octree, which are "fish.pic" and "test.oct", respectively.
  1069. When it asks for the view, just hit return because we want to use the
  1070. default view from the picture file.
  1071. .B Glare
  1072. then asks what parameters it should use for the
  1073. .B rtrace
  1074. calculation.
  1075. .B (Findglare
  1076. will still use
  1077. .B rtrace
  1078. to calculate any points that it needs which are off the picture we have
  1079. given it.)\0
  1080. For this, you should give the 
  1081. .I \-av
  1082. setting from before (.5 .5 .5).
  1083. Then 
  1084. .B glare
  1085. will ask you if the sources of glare are small, which they are
  1086. not, and if you would like to set the glare threshold manually, which
  1087. you would not.
  1088. Finally, you will be asked
  1089. what maximum angle you want to calculate away from the view
  1090. center.
  1091. Let's use 60 degrees (to the right and left).
  1092. .B Glare
  1093. then proceeds to call the program
  1094. .B findglare
  1095. to locate the actual glare sources.
  1096. Once
  1097. .B findglare
  1098. has finished,
  1099. .B glare
  1100. will call the program
  1101. .B xglaresrc
  1102. (if you are running X) to circle the glare sources found on the image.
  1103. .sp .5
  1104. .LP
  1105. You then have a choice of a few different glare indices you may
  1106. calculated from the computed sources.
  1107. The Guth visual comfort probability (VCP) is perhaps the easiest to
  1108. understand for those who are not familiar with glare metrics, because
  1109. it gives a result in terms of a percentage of people who would be
  1110. satisfied.
  1111. Calculating the Guth VCP in this case, we see that looking straight
  1112. ahead (ie. 0 degrees), we see that less than 15% of the people would
  1113. find this visual environment comfortable.
  1114. Although the visual comfort probability increases as we look to the left
  1115. (positive angles), it never gets over 20% for the range of angles we've
  1116. given.
  1117. That is primarily because the window is unshielded and very near the
  1118. horizontal line of sight.
  1119. Skylights and ceiling fixtures are a little nicer from a glare
  1120. standpoint for that reason.
  1121.