Vous êtes sur la page 1sur 18

UNIX for

Radiance
Tutorial
Axel Jacobs
<a DOT jacobs AT londonmet DOT ac DOT uk>

Revision: 12 September 2010

exel tos

UNIX for RADIANCE Tutorial

gyxix

Contents
1 Introduction to UNIX 6

IFI IFP IFQ IFR IFS IFT


2

hells nd roesses F F mn pges F F F F F F F F gommndEline yptions F STDIN nd STDOUT F F F ild rds F F F F F F F F pile truture nd ths

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

F F F F F F

T U U V IH IH
12

UNIX Textprocessing Commands

PFI PFP
3

imple gommnds F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F wore owerful gommnds F F F F F F F F F F F F F F F F F F F F F F F F F F por loops F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F

IP IQ
14

Shell Scripting

QFI
4

IR
16 17

Programming Languages

References

exel tos

UNIX for RADIANCE Tutorial

Revision History
IP ep PHIH

sntro to fer sriptingF


PS yt PHHV

edded tee ommnd


PT wy PHHV

snitil version reted from xs hpters in fsi nd edvned tutorilsF

gyxix

About the Use of Fonts


everl di'erent fonts re used throughout this doument to improve its redilityX typewriterX ommndsD (le listingsD ommnd linesD onsole output italics X pths nd (le nmes sans serif X dine primitivesD modi(ersD identi(ers

Suggested Reading
here re totl of four di'erent dine study guides nd tutorils ville with viexs QF pigure I illustrtes the optiml work )ow tht will give you the est understnding in the shortest mount of timeF

pigure IX ou re strongly enourged to follow this pth while studying the viexs doumenttionF ou re enourged to follow this suggestionF sf you do feel pro(ient enough to skip ertin setions of prtiulr doumentD or even n entire doumentD you might miss out on some importnt informtion tht lter setions rely uponF imply skipping over prts tht you might (nd oring or otherwise unEinteresting will leve serious gps in your understnding of dineF st is importnt tht you try to understnd ll exerisesD nd you solutely w do them yourselfF hon9t just )ik through the pges nd look t the pituresF he viexs qetting trted quide isD nturllyD optionlD nd only neessry if you use the viexs live ghEywD in whih se the guide is essentil redingF here re other soures of informtionD nmelyX

he mn pges SD he o0il dine we site TD he dine miling list nd its rhivesD ville through the dine omE munity we site WD he ook Rendering with Radiance UF
ou my onsult them t ny timeD either while studying with the help of the resoures on viexsD or fterwrdsF qood luk with your e'ortsF S

exel tos

UNIX for RADIANCE Tutorial

Introduction to UNIX

he suessful use of dine mens to lmost ompletely ndon the world qrphil ser snterfes @qssA with ll its nie uttonsD tik oxes nd helpful wizrdsF his is euse ny qss will only llow us to do wht someodyD iFeF the progrmmer tht tht softwreD deided we should e doingD or wht he thought we might wnt to doF hile this is (ne for softwre of limited )exiilityD it is simply impossile to squeeze dine into windowD dd some uttons to it nd expet to e le to ontrol it this wyF dine is just too )exile nd powerful for this to workF he dine syntheti imging softwre is deeply rooted in the xs philosophy of softwreF his mens tht there re mny smller progrms tht typilly only do smll joD ut this they do wellF hrough uilding up lrger projets y omining those smll piees of softwre in lever nd unforseen wysD we re given ultimte power nd ontrol over the end resultF hink of ssemling house or utomoile from viqy riksFV
1.1 Shells and Processes

sn order to intert with the omputer nd tell it wht to doD we use text interfe to the operting system known s shellF his is something oldEtime users of hy will e fmilir withD lthough there it is lled hy promptF e shell is silly ommnd interpreterF hen we type ommndD it exeutes it for us nd returns the resultF hells lso provide onvenient environment tht llows us to work more e0ientlyF por instneD the fer shellD whih is wht we re usingD llows us to rowse through the ommnd history nd reErun ommnd y simply hitting the upErrowF hells n lso e progrmmedF his is lled shell sriptingF yn multiuserD multitsk pltformD mny proesses run t the sme timeF he ps ommnd shows us the proesses tht we re runningF
[student]$ ps PID TTY TIME CMD 710 pts/0 00:00:00 bash 779 pts/0 00:00:09 gedit 787 pts/0 00:00:00 ps

roweverD this is only the soElled foreground proessesF fy ppending n postrophe @989A to the ommndD we n lso run progrms in the kgroundF his is wht we do when the proess tkes long time to ompleteF xo longer n we esily ontrol suh proesses @for instneD we n9t hit gtrlEg to terminte itAD ut it doesn9t lok our ommnd line eitherF
[student]$ ps PID TTY 667 tty1 689 tty1 696 tty1 701 tty1 703 ? 705 ? 707 ? 709 ? 710 pts/0 779 pts/0 788 pts/0 -x STAT S S S S S S SW S S S R TIME 0:00 0:00 0:00 0:01 0:01 0:00 0:00 0:00 0:00 0:09 0:00 COMMAND -bash sh /usr/X11R6/bin/startx xinit /home/axel/.xinitrc -- :0 icewm /usr/bin/gnome-terminal --use-factory esd -terminate -nobeeps -as 2 -spawnpid 703 [gnome-name-serv] gnome-pty-helper bash gedit ps x

I sxyhgsyx y xs he -x swith of the ps ommnd shows ll proesses tht re owned y usD inludE ing kground onesF ivery proess on xs system hs unique proess idF o terminte the proessD type killD followed y the shX
[student]$ kill <pid>
1.2 man pages

wost progrms on our system n e lled with whole unh of di'erent optionsF his is lso true for the dine ommndsF feuse noEone n rememer ll the progrms with their options nd swithesD ll progrms ome with the soElled mn pgesF wn pges re stored on the system nd n e used through the man ommndF rit 9q9 to quitF
[student]$ man kill KILL(1) Linux Programmer's Manual NAME KILL(1)

kill - terminate a process

SYNOPSIS kill [ -s signal | -p ] [ -a ] pid ... kill -l [ signal ] DESCRIPTION kill sends the specified signal to the specified process. If no signal is specified, the TERM signal is sent. The TERM signal will kill processes which do not catch this signal. For other processes, if may be necessary to use the KILL (9) signal, since this signal cannot be caught. OPTIONS pid ... Specify the list of processes that kill should sig nal. Each pid can be one of four things...

ou should lwys ring up the mn pge if you re unler out wht extly the ommnd does nd to lern out options nd syntxFS
1.3 Command-line Options

he ls ommnd gives diretory listingF st is very similr to the hy dir ommndF


[student]$ ls box.rad chair.rad msc.mat msc.oct msc.rif nice.vf

o (nd out more out the (les in the urrent diretoryD the -l swith to ls will give dditionl informtionD suh s the permissionsD ownershipD (le size nd the dte nd time of its lst modi(tionF
[student]$ ls -l -rw-r--r-1 student -rw-r--r-1 student -rw-r--r-1 student -rw-rw-r-1 student -rw-r--r-1 student -rw-r--r-1 student student student student student student student 1624 566 321 13091 543 82 Oct Oct Nov Nov Oct Oct 24 1999 box.rad 24 1999 chair.rad 3 1999 msc.mat 3 1999 msc.oct 24 1999 msc.rif 24 1999 nice.vf

exel tos

UNIX for RADIANCE Tutorial

gommnd line options re lmost lwys preeded y hyphenF wost ommnds operte on (le or s in this se diretoryF his is given s n rgument on the ommnd lineF ometimes this n e n input tht is required or optionlF he diretory /usr/bin is where the dine exeutles re stored on our systemD mongst mny othersF o list them llD typeX
[student]$ ls -l /usr/bin

here re quite lot of progrms in this diretoryD fr too mny to disply on the sreenF o disply them one sreen time pipe the output of the ls ommnd into moreF iping mens tht the output of the (rst ommnd eomes the input for the seond oneF his is explined in the next setionF he vertil r @9|9A is lled the pipe symolF
1.4

STDIN

and

STDOUT

qenerlly spekingD ll ommnds tke n input nd produe some form of outputF he input is normlly tken from the ommndElineD while the output is produed on the sreenF he norml input nd output re lso known s STDIN nd STDOUTD respF e seond outputD STDERRD lso exsists ut is only responsile for printing error messgesF he three ommnd interfes re shown in (gF PF

pigure PX ell ommnd hve three interfesX STDIND STDOUT nd STDERR st is possile to reEdiret ll three of these interfesD for instne to write the output to (leD or pss it on to seond ommndF his onept is illustrted in (gF QF he more ommndD for exmpleD tkes whtever is pssed to its STDIN nd pges through it1 F his llows us to look t long text (les without most of the ontent srolling o' the sreenF

pigure QX he output of one ommnd my eome the input to seond oneF STDERR omitted for lrityF rit the egi r to ring up the next pgeD hit the ixi key to sroll down one lineD nd 9q9 to quitF
[student]$ ls -l /usr/bin | more ... -rwxr-xr-x 1 root root -rwxr-xr-x 1 root root -rwxr-xr-x 1 root root -rwxr-xr-x 1 root root -rwxr-xr-x 1 root root
1
Actually, down, unlike

207405 36190 202125 229305 17347

Jan Jan Jan Jan Jan

31 2000 rpict 31 2000 rpiece 31 2000 rtrace 31 2000 rvu 31 2000 t4014

less is more.

an advanced version of

more,

for instance it allows you to scroll up as well as

I sxyhgsyx y xs

-rwxr-xr-x -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x ...

1 1 1 1 1 1

root root root root root root

root root root root root root

8927 7444 13463 7122 4677 15089

Jan Jan Jan Jan Jan Jan

31 31 31 31 31 31

2000 2000 2000 2000 2000 2000

tabfunc thf2rad tmesh2rad total trad ttyimage

o we n now look t ll the (lesF row mny of them is thereD we wonderc e hndy little progrmD wc @s in 9word ount9A will tell usF st displys the numer of linesD wordsD nd hrters of given inputF he -l swith to wc mkes it produe only the numer of linesF
[student]$ ls -l /usr/bin | wc -l 3565

o preserve the diretory listingD we n rediret the output of ls from STDOUT to (leF e9ll ll it ls.txtF sf ls.txt doesn9t exist yetD it will e reted for usF fut e wre"if it does exists nd ontins dtD it will e overwritten nd the dt will e lostF
[student]$ ls -l /usr/bin > ls.txt

o disply the (le one sreen t timeD more is used one moreF his timeD we tke its input from (le rther thn from STDINF
[student]$ more < ls.txt

vet9s look for ll ommnds tht hve 9gen9 in their nmeF he grep ommnd n do this for us nd disply the result on the sreenF o preserve it we might typeX
[student]$ more < ls.txt [student]$ cat gen.txt -rwxr-xr-x 1 root -rwxr-xr-x 1 root -rwxr-xr-x 1 root -rwxr-xr-x 1 root -rwxr-xr-x 1 root -rwxr-xr-x 1 root -rwxr-xr-x 1 root -rwxr-xr-x 1 root | grep gen > generators.txt root root root root root root root root 7320 6852 7664 10984 25322 12521 32910 26181 Jan Jan Jan Jan Jan Jan Jan Jan 31 31 31 31 31 31 31 31 2000 2000 2000 2000 2000 2000 2000 2000 genblinds genbox genclock genprism genrev gensky gensurf genworm

he echo ommnd tkes whtever it (nds on its ommnd line nd displys itF xot very useful unless we rediret the output nd do something with itF row out ppending it to our generators.txt (lec
[student]$ echo "Hello World" >> generators.txt

he old listing of the serh results in /usr/bin is still thereD we dded new line with 9rello orld9 to itF o hek whether this is orretD use cat to disply itF vike moreD it n disply (les ut it is lso useful for joining (les togetherF
[student]$ cat generators.txt -rwxr-xr-x 1 root root -rwxr-xr-x 1 root root -rwxr-xr-x 1 root root -rwxr-xr-x 1 root root -rwxr-xr-x 1 root root -rwxr-xr-x 1 root root -rwxr-xr-x 1 root root -rwxr-xr-x 1 root root Hello World 7320 6852 7664 10984 25322 12521 32910 26181 Jan Jan Jan Jan Jan Jan Jan Jan 31 31 31 31 31 31 31 31 2000 2000 2000 2000 2000 2000 2000 2000 genblinds genbox genclock genprism genrev gensky gensurf genworm

exel tos

UNIX for RADIANCE Tutorial

1.5

Wild cards

st might e useful t times to list unh of (les tht hve something ommon in their (le nmesF wo soElled wild rds exist for thisX
Questionmark (' ?') Asterisk ('*')

tnds for extly one hrterY tnds for zero or more hrtersF

wo exmples will demonstrte their useX e hve lredy seen tht dine omes with numer of genertorsF ell of them strt with the letters 9gen9F o list ll genertors under /usr/binD we n simply type
[student]$ ls /usr/bin/gen* /usr/bin/genambpos /usr/bin/genclock /usr/bin/genrhgrid /usr/bin/genworm /usr/bin/genblinds /usr/bin/genprism /usr/bin/gensky /usr/bin/genbox /usr/bin/genrev /usr/bin/gensurf

sf we reted kup (les of our dine seneD scene.radD y dding numer efore the dotD eFgF scene1.radD scene2.radD we ould list them ll with the following ommndX
[student]$ ls scene?.rad

lese note tht 9 c9 stnds for extly one hrterD so this will not show the (le we9re urrently working on @scene.rad AD nor will it show kup (les with twoEdigit numerD eFgF scene12.radF por thisD the sterisk would e more ppropriteF
1.6 File Structure and Paths

xs systemsD like most other operting systemsD use tree shped (le struture lso known s 9diretory tree9F he se is lled root nd is indited y forwrd slsh @9G9AF prom hereD ll other diretories nd sudiretories rnh outF he one where the user dt is stored is lled /homeF nder this diretory every user tht hs n ount hs their own home diretoryF sf we re logged on s studentD our home diretory is /home/studentF ynly here re we llowed to write nd modify nd (lesF et the sme timeD our (les n not e seen or ltered y other usersF o (nd out where you reD type pwd @present working diretoryAF o hnge to nother diretoryD use the cd ommndD followed y the pthF ths n e solute or reltiveF yping
[student]$ cd /home

will ring you to /homeD no mtter where you re nowF xow type
[student]$ cd student

his will ring you k to your home diretoryF ou should relise tht the lst ommnd only works if you re in /homeF yping if from G or from nywhere else will tell you there is no diretory lled studentF here is lso quiker wy to go homeF he tild 9~9 is shortEut to the user9s home diretoryF o typing
[student]$ cd ~

IH

I sxyhgsyx y xs works just s wellD from nywhere in the (le strutureF glling cd with no options t ll will lso tke you k to your home diretoryF here re two speil (les in every diretoryF yne of them is the prent diretoryD the level oveF his is expressed with two dotsF o to go up one levelD run cd with two dotsX
[student]$ cd ..

he other importnt (le is just lled 9F9 nd refers to the present working diretoryF fothD 9F9 nd 9FF9D re not listed y ls unless it is lled with the -a swithF o disply the present working diretoryD type pwdF
[student]$ pwd /home/student/msc

ith this muh si xs knowledge under our eltsD we re well prepred to dive into the wonderful world of dineF yne lst omment regrding the ommndElineX ou my use semiolon 9Y9 s seprtor for multiple ommnds on the sme lineD eFgF
[student]$ cd /usr/bin [student]$ ls

is the sme s
[student]$ cd /usr/bin ; ls

whih is the sme s


[student]$ ls /usr/bin

@ut of ourse you knew thtFFFA

II

exel tos

UNIX for RADIANCE Tutorial

UNIX Textprocessing Commands

dine isn9t lwys out pretty pituresF ispeilly engineers (nd it very useful to use dine for simply hurning out numersD whih they n then nlyse in multitude of di'erent wysF he softwre whih immeditely springs to mind for (ddling out with numers would e spred sheetF yn xs systemD howeverD we hve quite numer of little ommnds tht re designed to del with text (lesF rving good understnding of wht those ommnds re nd wht they n do will not only sve you n enormous mount of timeD ut will lso enle you to omine the di'erent dine ommnds in retive nd unexpeted wysF rere is list of xs text proessing ommnds s use most frequentlyF hon9t forget tht the full doumenttion is lwys ville in the relevnt man pgeF
2.1 Simple Commands

rere is very simple test (le whih we re going to use to see the e'et tht some of the ommnd hveF e9ll ll it source.txtF he olumns re tEseprtedF
0 1 2 .629 .826 .931 .988 .731 .666 .142 .265 .393

he ommnds elow re in no prtiulr orderF wost of the short desriptions re diretly opied from the man pgesF
tr

rnslte or delete hrtersF ery hndy for tidying up multiple spes or ts in (le tht is ment to hve it9s olumns seprted y just one tF e spe is denoted s ' 'D nd t s '\t'F
[student]$ cat 0 .621 1 .826 2 .131 [student]$ cat 0 .629 1 .826 2 .931 source.txt | tr 9 1 .188 .142 .731 .265 .666 .313 source.txt |tr -s 6 .988 .142 .731 .265 .6 .393

cat

cut

gontente (les nd print to stndrd outputF ou n lwys use this s link numer one when piping di'erent text proessing ommnds togetherF trip olumns from (lesF essumes tht the olumns re seprted y extly one tF sf this is di'erent hrterD use -dD if it is multiples of the sme hrterD use tr -s (rstF
[student]$ cat source.txt |cut -f2,4 .629 .142 .826 .265 .931 .393

he cut ommnd is it hoosy out the (elds seprtors used in the text (leF st expets the olumns to e seprted y t hrtersF sf this is not the seD you must tell it whih hrter to use s the seprtorF he exmple elow shows you how to do this for speEseprted (leX
[student]$ cat another_source.txt |cut -d' ' -f3
head

yutput the (rst few lines of (lesF hefult is IH linesF IP

P xs iygisxq gywwexh

[student]$ head -2 source.txt 0 .629 .988 .142 1 .826 .731 .265


tail

yutput the lst few lines of (lesF hefult is IH linesF


[student]$ tail -2 source.txt 1 .826 .731 .265 2 .931 .666 .393

o disply the end of the (le s it is eing retedD use the -f option @s in 9follow9AF his is very useful for log (le tht just keep getting igger nd iggerF ou n interrupt the output t ny time y pressing gvEgF echo hisply line of text on STDOUTF yften used s the eginning of piped sequeneF
[student]$ echo "Hello World" Hello World
wc

rint the numer of linesD wordsD nd ytes in (leF


[student]$ wc source.txt 3 12 51 source.txt [student]$ cat source.txt |wc 3 12 51 [student]$ cat source.txt |wc -l 3

basename

trip diretory nd su0x from (lenmesF his omes in hndy for thE proessing or renming of lrge numer of (lesF
[student]$ echo `basename source.txt txt`dat source.dat

sn the fer shellD this my lso e written s


[student]$ echo $(basename source.txt txt)dat source.dat

whih is esier to red euse the kEtiks n e very smll in some fontsF st mens tht the shell gets the echo ommnd to output whtever the ommnd in kEtiks or prenthesis @in this se basenameA returnsF o onvert ll dine *.hdr (les in given diretory into sppsD typeX
[student]$ for f in *.hdr; do ra_tiff $f $(basename $f hdr)tif; done

ort lines of text (lesF uniq eport or omit repeted linesF tee rndy little progrmF sf you re redireting STDOUT of sript or progrm to (leD ut wish to lso see the output on the sreenD you simple pipe it into teeF
sort

[student]$ sh script.sh | tee results.dat ...

e similr result ould e hieved y using the norml rediretorX


[student]$ sh script.sh > results.txt

henD in di'erent shellD you n use tail with its -f optionsX


[student]$ tail -f results.txt
2.2 More Powerful Commands

@needs more explntionFFFA


grep sed

rint lines mthing pttern strem editor for (ltering nd trnsforming text IQ

exel tos

UNIX for RADIANCE Tutorial

Shell Scripting

sf you do lrge numer of repetive tsksD suh s rendering dine imges for difE ferent viewsD you might wish there ws wy of utomting thisF smgine the following situtionX ou wnt to run rpict for multiple view (lesD then (lter the imges nd onvert them ll to xq formtF rere is roughly wht you9d hve to doX
[student]$ oconv materials/boring.mat objects/object1.rad \ objects/object2.rad skies/overcast.mat skies/sky.rad \ > scene.oct [student]$ rpict -ab 3 -ad 1024 -aa 0.13 -vf views/1st.vf \ scene.oct > tmp/scene_1st.hdr [student]$ pfilt -e 1 -x /2 -y /2 tmp/scene_1st.hdr \ > images/scene_1st.hdr [student]$ convert -gamma 2.2 images/scene_1st.hdr \ images/scene_1st.png

ou then need to reEtype those ommndsD sustituting ll ourenes of 91st 9 with 92nd 9D then 93rd 9 nd so onF his is where little fer sript n help youF
3.1 For loops

gopyEndEpst the ove ommnd lines into text (le nd nme it rendering.bashF emove ll the prompts @this is 9[student]$ 9 in our exmpleFA he result should look like thisX
[student]$ cat rendering.bash oconv materials/boring.mat objects/object1.rad \ objects/object2.rad skies/overcast.mat skies/sky.rad \ > scene.oct rpict -ab 3 -ad 1024 -aa 0.13 -vf views/1st.vf scene.oct \ > tmp/tmp.hdr pfilt -e 1 -x /2 -y /2 tmp/tmp.hdr \ > images/scene_1st.hdr rm tmp/tmp.hdr convert -gamma 2.2 images/scene_1st.hdr images/scene_1st.png

ou n now run this (le like soX


[student]$ bash rendering.bash

his does extly the sme s the initil four ommnd lines nd so frD hsn9t relly improved nythingF o run dditionl viewsD we still need to edit this (le y opying nd hnging the lines withinF here isD howeverD more elegnt wyD whih is shown in the exmple elowX
[student]$ cat rendering1.bash #!/bin/bash # # Script to render Radiance images for different skies and views. # Compile the octree. This is only done once. oconv materials/boring.mat objects/object1.rad objects/object2.rad \ skies/overcast.mat skies/sky.rad > scene.oct # Run the simulation with different view files. for view in 1st 2nd 3rd 4th; do rpict -ab 3 -ad 1024 -aa 0.13 -vf views/$view.vf \ scene.oct > tmp/tmp.hdr pfilt -e 1 -x /2 -y /2 tmp/tmp.hdr > images/scene_$view.hdr

IR

Q rivv gssxq

rm tmp/tmp.hdr convert -gamma 2.2 images/scene_$view.hdr \ images/scene_$view.png done

he (rst line is lled 9sheng9F st ensures tht your system knows it9s fer sriptF qiven the right (le permissionsD you n now run the ommnd like soX
[student]$ ./rendering1.bash

he interesting line is the one strting with 9for view in ...9F his onstrut is lled loopF st itertes over ll items etween the 9in9 nd the 9;9F e de(ned the vrile s 9view9F vter oneD when whenever we type 9$view9D the urrent vlue of view is inserted instedF riles don9t need to e used within loopF ou n do nything you like with themF rere is nother exmpleF uppose we wnt to render the sme four viewsD ut for two di'erent skiesD overst nd loudyF e9ll lso introdue third vrileD AMBD whih mkes the rpict line more redleF s tend to use igei vrile nmes for onstntsD nd lowerse ones for vriles tht re hnged y the sriptF
[student]$ cat rendering2.bash #!/bin/bash # # Script to render Radiance images for different views. # Define the ambient parameters for rpict. AMB="-ab 3 -ad 1024 -aa 0.13" for sky in overcast clear; do # Compile the octree. This is done once for each sky distribution. oconv materials/boring.mat objects/object1.rad objects/object2.rad \ skies/$sky.mat skies/sky.rad > scene_$sky.oct # Run the simulation with different view files. for view in 1st 2nd 3rd 4th; do rpict $AMB -vf views/$view.vf \ scene_$sky.oct > tmp/tmp.hdr pfilt -e 1 -x /2 -y /2 tmp/tmp.hdr images/scene_${sky}_$view.hdr rm tmp/tmp.hdr convert -gamma 2.2 images/scene_${sky}_$view.hdr \ images/scene_${sky}_$view.png done done

his modi(ed sript now ontins two loopsX one tht is responsile for the sky onE ditionsD the other one for di'erent viewsF lese note tht fer doesn9t relly re out indenttionF st only relies on the orret order of the ommndsF s would still reommend tht you use indenttion onsistentlyF his mkes it muh esier to spot nd orret mistkesF rile nmes in fer re seEsensitive you my use ny numer of iE geiD lowerse hrtersD numersD 9E9 nd 99D ut the nme must not strt with numerF feuse the undersore is llowed in vrile nmesD we hd to inlude urly res in expression like this oneX scene_${sky}_$view.hdrF ithout the resD fer would hve looked for the vrile nmed 9sky_$view9D not 9sky9D followed y 9_9D followed y 9view9F IS

exel tos

UNIX for RADIANCE Tutorial

Programming Languages

fefore you seriously dig into one of thoseD s suggest you strt with fer shell sriptingF st9s muh esier to pik upD nd it will get you long wy efore you need to look into 9proper9 progrmming lngugeF here re tons of referenes nd tutorils on the snternetF he iggest prolem with fer sripts in my opinion is tht ntive fer lger n only do integer lultionF his is esy to irumvent with dine9s rcalcD ut still somewht limitingF rving sid thtD s quite like awk for some simple lultions tht dine9s rcalc n9t hndleD nd will e using it every now nd then throughout these tutorilsF ou my notie tht the rcalc synt hs orrowed quite hevily from awkF here re no referenes to the other hevyEweightsF sf you do wnt to move eyond nd wnt my opinion"s personlly think tht ython is more wellEoneived lnguge whih is esier to red nd lernF roweverD s tully did get stuk with erl for the we progrmming s doD simply euse the lnguge ene(ts enormously from the modules tht people hve ontriuted to itF ython hsn9t quite uild up the sme ommunity yetD ut this is only mtter of timeF enyhowD everything fny in this doument is done with fer sriptsF o don9t get yourself into ythonEorEerl twist just yetF fer will get you long wyF ttern snning nd proessing lnguge RY perl rtil ixtrtion nd eport vnguge IY python en interpretedD intertiveD ojetEoriented progrmming lnguge PF
awk

IT

ipiixgi

References
I erlForgF v http://www.perl.org/F P ythonForgF v http://python.org/F Q exel tosF viexsF e siteD xov PHHWF v http://luminance.londonmet. ac.uk/learnixF R hine frlow gloseD ernold hF oinsD ul rF uinD ihrd tllmnD nd iet vn yostrumF The awk ManualD IWWSF v http://www.cs.uu.nl/docs/ vakken/st/nawk/nawk_toc.htmlF S qreg rdF Radiance man PagesD PHHVF v http://radsite.lbl.gov/radiance/ man_html/comp.htmlF T qreg rdF y0il dine we siteD PHHVF v http://radsite.lbl.gov/ radianceF U qreg rd vrson nd o hkespereF Rendering with Radiance: The Art and Science of Lighting VisualisationF worgn uufmnn ulishersD n prnisoD IWWUF V wike qnrzF The UNIX PhilosophyF higitl ressD IWWSF W dine gommunityF dineEynlineF e siteD xov PHHWF v http://www. radiance-online.orgF

IU

Index
8D T BD IH FD II FFD II YD II cD IH D IH steriskD IH wkD IT kgroundD T senmeD IQ ferD IT tD WD IP dD IH utD IP ehoD WD IQ foregroundD T genertorD WD IH grepD WD IQ hedD IP rello orldD W killD U lessD V lsD U mnD U mn pgesD U moreD V pthD IH erlD IT shD U pipe symolD V pipingD V proess idD U psD T pwdD IHD II ythonD IT questionmrkD IH IV rti'D IQ rlD IT sedD IQ shellD T shell sriptingD T sortD IQ hiD V hsxD V hyD V tilD IQ tildD IH trD IP uniqD IQ vertil rD V wD WD IQ wild rdsD IH

Vous aimerez peut-être aussi