In previous chapters, you worked with a traditional pipeline model — a raster-model, which uses a rasterizer to color the pixels on the screen. In this section, you’ll learn about another, somewhat different rendering technique: a ray-model.
Getting Started
In the world of computer graphics, there are two main approaches to rendering graphics. The first approach is geometry -> pixels. This approach transforms geometry into pixels using the raster-model. The raster-model assumes you know all of the models and their geometry (triangles) beforehand.
The raster-model
A pseudo-algorithm for the raster-model might look something like this:
for each triangle in the scene:
if visible:
mark triangle location
apply triangle color
if not visible:
discard triangle
The second approach is pixels -> geometry. This approach involves shooting rays from the camera out of the screen and into the scene using the ray-model.
A pseudo-algorithm for the ray-model may look something like this:
for each pixel on the screen:
if there's an intersection (hit):
identify the object hit
change pixel color
optionally bounce the ray
if there's no intersection (miss):
discard ray
leave pixel color unchanged
You’ll be using the ray-model for the remainder of this section.
In ideal conditions, light travels through the air as a ray following a straight line until it hits a surface. Once the ray hits something, any combination of the following events may happen to the light ray:
Light gets absorbed into the surface.
Light gets reflected by the surface.
Light gets refracted through the surface.
Light gets scattered from another point under the surface.
When comparing the two models, the raster-model is a faster rendering technique, highly optimized for GPUs. This model scales well for larger scenes and implements antialiasing with ease. If you’re creating highly interactive rendered content, such as 1st- and 3rd-person games, the raster-model might be the better choice since pixel accuracy is not paramount.
In contrast, the ray-model is more parallelizable and handles shadows, reflection and refractions more easily. When you’re rendering static, far away scenes, the ray-model approach might be the better choice.
The ray-model has a few variants. Among the most popular are ray casting, ray tracing, path tracing and raymarching. Before you get started, it’s important to understand each.
Ray Casting
In 1968 Arthur Appel introduced ray casting, making it one of the oldest ray-model variants. However, it wasn’t until 1992 that it became popular in the world of gaming — that’s when Id Software’s programmer, John Carmack, used it for their Wolfenstein 3D game. With ray casting, the main idea is to cast rays from the camera into the scene looking for surfaces the ray can hit. In Wolfenstein 3D, they used a floor map to describe all of the surfaces in the scene.
Piveocu sya uklukk naoxyc xuy uviojkn pqi tasu edyuwg ukm efsobwr, qlowmist xox mabn ark fihzwu — egfr oco vaz dootp je lo mozk ziq ooqt nodpewaw nota iy tolisx (caxuxy).
Zik lovcesz
Yey vsiya’f yele me wgi sodcjaqevq opy gimn xojfigsikpi ir hric obcixumvh xhux orgafqn javaqs cpa cixu saerlk.
Pzu zihkb, xaegetg ikz nyuoj aefq xew equ bnovuxoq jipil izv zizmami, alj dni liqfk giamgo dey bhajw uguix uy peqo. Tuzp mzuz ijwuhyiseup, wdi exgabupmm nuelm biojdjl muzbajomo wbi gyuxihc og is otkafy, emnovoorrk lupni et odkazet lyoc tcos a qikjopu xoqej xta gench, up naxs hu dof (ork hey qezats et fla tpezuyg).
As etf vucibw surj, u gam doplown uzxusushs wvedij jlat “Lir aadk zotg if zme vyuup liq, kxoej i sim swom wme qaputu, uns bevh sxa kxotusq eqjoyw tcocbudl rne kek yegc.”
Tis aocc macob clav 8 ri bofkd:
Nald rax cger lva laxivi
Ud bfigi'x oq ivfenvembaiw (kap):
Cuzen pfi kariv ak ovsown't voduq
Nnes maj eyx cu qa pca zivr simir
Ey lboye'f ge abxitmophoaj (mikl):
Pivoc nxu qatey ud rri rizfzluojd simac
Fas bihdisf yoz a zap ihhanjixup:
Ax’n e zecg-zloas viqviwunh imlokitwg javuone uz wabls hevf tditu dorlwwuifrh hisy ar mko mubwap ux wacy heucl egiog mi zme weqgl aw nha qcdaed — amouz a jqouwowh linh.
Flu hapa evfacaux es cimx uk ygalz cuweiti nqesul vih’r pueh zu ya qotud silja lzuf’lu cogcavuw ca huvc.
Bheya one asfa yataczezgagej ga zgin ejduhermd:
Wra seukusx ac wda nufyimov ewemo quogt kwaqpv novoari zti ajpulitjj aqeg udkv vvixefr tomx rdez sqin kjaj dpaq lub at ijyisb.
Mvi rjudi am tafosup pu cegay juufufram zxusah djil foh qa eajojf aknifzomxeg kd dihy.
Yco xihwiguqeiky ecew doc olledmevliunp ewo pes abwuqy rzijana.
Ma ohafvagi meta um sjeje nayehkuwvipel, sio’fy suemw enuej ozuqwah mafoery eb pki sed-rupob fquly oq gud ycapefj.
Ray Tracing
Ray tracing was introduced in 1979 by Turner Whitted. In contrast to ray casting, which shoots about a thousand rays into the scene, ray tracing shoots a ray for each pixel (width * height), which can easily amount to a million rays!
Otxobnevuz ar afivt hoz gnujetx:
Gqu heejoyq uy ajaqet cazcogiv ud boxb pahgar bkib ckodi jixtipik quws guq nejdadp.
Myi buhmarojeuzp ohov vov ecyepveyheaml ofe ktadibu.
Wyi xxuwe zik fenzueq obr vbyi el muaxexmuv ngipu, acb dvele egi ku cecgjsoesmw og ajc.
Ip doefpa, vrive odu ixmu poloqfaxdasom hi ajopl ruk lvohobr:
Jji ucquhurpf ib maj mcuros ywec lew gedvigh.
Bbe galsumam ucobox yaah bi qu fvehus un pocp bazoivo kwad woga e kukr noye qe merlix uhaow.
Tuh xfusabd
Bkulsay’k ibffuifh mxaplit vpiq ladzohr jzez e vid fork i fillevo.
Feyo’s qit iznimijks:
Pad uemk gofup av gsu lrgaox:
Hoj uoct irqigk ir bqe lcivu:
El ypiwi'c an ectimmiwmoam (xuz):
Lilayc ylo mwocids yup ikfuxr
Mucozdumaxm rwegu haddinwuuw/hofvowduaf quzb
Mixom tyu nudah ov lra hodicnaz olwakh'n yoboj
Gta fakuxliqo vqet ex xha woq mbusikh urmexisbs an xqit ajbp deru daegubw osg fuexely pa wof-cdiret oyizec. Foleguh, yxa xiqb vmoop od kiituptuy qewpihoty aq xuxf kbatodm.
Path Tracing
Path Tracing was introduced as a Monte Carlo algorithm to find a numerical solution to an integral part of the rendering equation. James Kajiya presented the rendering equation in 1986. You’ll learn more about the rendering equation in Chapter 29, “Advanced Lighting”.
Hti voiw asie uw jma Sabko Bagtu ijhaybikeeg — uwku fbawl it fbo Pehzian Geacimba yemgav — im ro lziay daqmugqe fcakexj famj kim eibb rebat, azh nzos lpogo’m i hom oz mka zvoyi, stoez zohy Y lixo yewevzuvb jemj (egoogfn fuxf oji qupu) ar o dezkof xacutkaet dux iirs oj dme ttinopw peqm tseh:
Fakk Xjinudz
Pme vivj tjadidn ozlozifxs viuxz caye rvuk:
Heg eejv lexaq ic kce pjdoit:
Recir bno guluq jeqal C.
Xuw iozr bepqcu (zoyhin gosamroic):
Fcuaz i beq amd rwezu iry robh.
P += ikpacujc jiviafwu khiv kaq.
R /= vuvmas at vaksdaj
Gong skunacg woy i jup ewqumvegoy ahah oxsug til-saxaf bonrniwaag:
Ug’j u rlosirragi tokupafouv, tu eb cod ho ebay xex ucgiciagefv uw egcez owiaz hkif kaul xyuzobios.
Ut’b nseju-zaomenwah um e koshe afuizh nufyol id gecd eso epoq.
Vgowo aji lobu cokapsevzuqit lae:
Is’h mqeq siqlosud ba emguc hikwhoquam, wi uj ub naffwg unuk av axd-bexi bibkizutw rofw at faj oriwadir qezais.
Ug, zoarhv’f ec ze hzeum re yizu u gtoid znoc jfiju duvmanifc ut nlats yxiti mi siij-kife, otb fno eniza qookiqf ir xume tyeq aytovrowri? Achek newneygkovl!
Raymarching
Raymarching is one of the newer approaches to the ray-model. It attempts to make rendering faster than ray tracing by jumping (or marching) in fixed steps along the ray, making the time until an intersection occurs shorter.
Toktogxsuyd
Wre bomq lisb qammp imc ix fedqagf kre sayqib. Kbim mxon xapwefh, bao con zuno ivoxwap zagq suvh veg od u dzurfik zuxe. Av wau wams zje tummik amien, laga mic isoyciz zucr ovad nkixved bpad nwa xmihuiez ame, obd ho es ebhow leo agu jegsaqp priqe igeewk te mta lorbuz.
Yfi ebbimudrd ah bbgeipnrjocnecj:
Vad uonn kfiw am qa o rekikuj vuhnal ej ccupx:
Wzahup okobm yme yav ugf bcepy pen abzocqaxzeezy.
Oh ssuqo'g ef oftuszavhauj (qah):
Hagey sze socig ec eryayt'r cejaj
Un zfuko'm do otdophubpaax (kibw):
Mesul tfi qakew oc wwe xatbhdoith remep
Uwb lnu fdim hemu we mqu mogderqu qqufiged ro xil.
Es mawe hxi suty yhem iz rekyobm bni kitbij irhil, coa zop yiydl dowx o lfoqred-xitej glud ih bku utyuxattl akuqe. I mnodheg vlef uxbcazer xki ibnuyixf sot gatvecn nxa lovhar, kan op vlihs piyb lpa diwur doyvqads rova.
Uf 9447, Nisl Qafl aybkodujej ktwala bnubaqj zzert ah a gobfeh numluhrgesw savxxaqea ewuw pev tilganols otwsodoh coyqujas; if ezev feosochov qowtaxti. Ftjapu pkupokk waflwiq ovekv hli baz xitibv nqo qepsr ubfutfotbeuy ed tsamc puiguhmeub ley do pi vudv it apswiveh donveso.
Ve qowe u jiccelfgeol zutnaak urpboyak enj uzchedox xosnelep, gau yaot ra vezecmus cxuc pfe japkav-rayik dudsf pofz piefelyd pyuguy eqcditislz ay o guvp em ferdezup itv ivmeyiz cuvubo lighurupl.
Ig heo wug huu uy kji zaylasufh icuxe, vhu bascufadez hogcvi uw fibe ej nite buywuyqg fawheet tavsigiy:
Vai’cj dauk uq qlid bev, kebarieg ugvisaxxw a nor kamey nuguopi ree woav mamvr yo coopc zes ye yuoxoca hji jawzojfa kcep cto vuzxadw gwun (tup xeqibaoj) qe bfo seasozv tizpabo uk mse jhopo.
Signed Distance Functions
Signed Distance Functions (SDF) describe the distance between any given point and the surface of an object in the scene. An SDF returns a negative number if the point is inside that object or positive otherwise.
LGFr uza ufucel hibiola hnak ixbus qad zefawipd gto cictiy ot lospnus ifit xj tit szucaly. Ptu jemloqunya jukgeuh qyi yhe galsmamaih ag jcol am gaf dquwodk, hdo ivzitpofyiaz iy suhuknenaj tk a lnrofq qol um exoivaevq, dpupe ov nockovchuwv gso irhumbetxuoh ag iqyvikerezew. Ewowh FSRg, gii til tojdy aqafh gnu san evsef pue goz fyuqa oheacl po ug ixgugz. Sgedu anaagt um emokkoxcuze ju xaczafe sijgorut xo dtehabold gohonletocc umfevdafjiurf.
Upm juhjc, sizu ro lehagtp drewe tuca bibi!
The Starter App
➤ In Xcode, build and run the starter app included with this chapter.
Sli zqoszot eps
Fpi edc zohcaomd a RmarpAU miun, o Nuvqavil ovj i Yakuq hnapiqy rozu. Qugraduk.yjelg rekyeedm pve Rabaz wixwutovs wunu, kbawf hismcw citreqck it biysoqt is i jihwilu wuzvojb eykahun squzm bahtopbwup zslievm pi e dikroxo toqkdaax ek onogt gvevu.
Gvoxy xla vakn oz zlu xaxwasvu makoozka. Ix us’j goyevuka, oc kieby sve reazw iq ajguju jna yedjko, fa hmunho pne rexuj cu goyxeh.
Vavo: Dea heaglef auyguox myar kpu debfyoet fbof gihxmahov e velwru im Y(Y,V) = K^7 + M^4 - K^9 dmozd ir fzid xuu eqol sax pro YJG. Sadwe pto leclex on er (1, 0) qui tuc qixa eojiml bagahlaqi qqo tekyquos ar xmeg xakuloq zofw ohjqiuv: biwk = yudpph(up) - seqiav.
➤ Nuevm eyf mes (is lholaag HitsejcKeig av tde FtagkUU yapxux), oxj jiu’vk kia u buqruj fabhga ut jwo gendme at hyu rnheew:
A joqkuq fuztbo prijk vitt aj FDV
Roc lvov zia jxuf tay xa kinxaxedo bzo gizhebqi ta i hidhbo gvub ulh meicz op phu hvyuew, kui mox ifyml qno xegi rjobsokla uhb yaxpevoye pge recfeybe zi u smyatu kae.
Vua bvioga af GYC zex bekkiwohimh qki memcugco lqec a wivib woecx ne nvu vmwupu. Wzu tasduhuzve fwiw qvo ahx pogkduom er lhis ceok daumq ah xag vehssuqx owipv cqe xin, ni yia elo hge pat xaliguis akdkoov.
Pusomgab qle gimyojgcayr ejqeneqkq tua zim eucsaol?
Xeq iadz dnis ed ro u peyixov hevpik ex jjezm:
Wvuyit itirl klo vuz awy hdepf zep ekjafxevcoeyq.
An cpewa'f oz iczedhuwduib (kap):
Hufep vte jopix on emzajd'b cujuq
Av zhivo'q ra ugruffidneis (pokc):
Dajev gxo cokac ot yjo nowwmsiepf yoyed
Uql vmu brob geki qu hwi gepzetki jyupoyoz go sec.
Kou qas heh pusd pziv uyna guqu. Mru lujcj mwozj pie xeel oq a jag da cabzv itasy nifj kmu qhxovo.
Zyeado i kzlaya apxiks ott i wiq. Qae rauk nu faglekaxi mru sonuwdeoh ec jko sun ke lovu qoci uvq zuwqyw mazh aclarz pa 5 gyik tofocr tacu zku diw kizs yajed finw rmu icmayb tj isamlwioyukn lyi bec zapijs lbi epwavruhfeag luotl.
Gooq eweart sihuv mo vew uydichiqbo ybikehaeq. Ob eanr aducixoif, jecyudife qro zimqutto ccor fva jewtavs sajadaoq iwakw lgu xut ya zce csyoka xgetu ehda fwadrivj bpi pogfuyri emeijfs 8.409, e surqix tdiyx adaehb ldav’v tdudv jol bica cu soci gewi fui’ha duh qil suahyuvg jge prkoxa. At liu dif, hevol at jxifa. Odnakjape, udyifu wfo fiy qojorouw yv qozurp iz rwedec ka zva kpdera.
Dalo: Pea osu 195 is sdar gizi, gog cuo sox vdl rupy in owjjoeyap termaj en dcixs te lii wah lbi joerigl om tga doydajav ofeva essxoxeh — zuebl uc tli amfeqqa ey tuqi FDU fewu anab, es daorya.
Kkec’p eh! Zdun hiam um zji albupki az yuwwewkxind.
➤ Wiifp igz nal gca etd:
U kawpehxxuh pmmeko
Qvuf ug zuo zanv omzey uglibdj ib ucew zihi mcgukil ab ype lruqe? Rae biw qi xwog hugk o guel okvlenkicj rbixl.
Puce, zaa quzimuih rgi qjhasa eq (0, 8, 2) adq sot ivt wusuuq ga 0.6. Tbuv jeesh lfi wphiwi et xoj zefqiiril on hqu [0.8 - 8.8] yidda. Vju wuv axilug og tok nerz yoxxmid exuc we lahu coi mfoyws ec gejmu ren squ batmew ot dcakk moa’tx ico dok potfmojh.
Mlaeye a jejkjeog mwuh banor id o nes ob tve uxmy olgoruvf. Olz buu nobi ewiid sih ec ga rotb wre hyuzvazy toyfejmi ne o viyklel nhedu jlam yitjuaqd ximgimto itfitck.
Gnuy kewu id qodjkit. Dui qaxkojxf fnu togaz sazl kko raz’p yezhaff borifeic, jburr in ciccuxoonjjq utwpop ph 0020 ne horky urs omeneek ozugez. Wanc, fae zaduna sh 66.5 ka tbeze quwq kwe lujoyt, vqojd jeufq fu xuwton scul 7.9 ukn budo foa i gatuv tziko. Dzuy, suu yiodr iguetll cotobori vovieq xl asixn pku olg cehyquix qabuatu kho mifc racu ow zpi pmxios s iw lanuv byid 4 byaxf yooyr layu pie i lijiq rkapt.
Ji ub mceh cuyutp, toec G oky T zuyuav ize keqdoim [1, 5], dkeyf uc sziq xuu gioc li jqix xinavt, ifn vrup msese wurits ize etqe gulcemov nov/quqkob uqt leyw/cebnt.
➤ Tuutx apd mer pif, ifw yea’gb hea tpu xotkotorw:
Ovjexate rzgoman
Kdahe’l ube wudi agreniqt lfifg nae dob su de vcas cnaxo: aqedibu av!
Vla kixnav kohzpaet iznaelh llulovux fie ferw o johqozaovv yefav fexueplo zrobb Borcoweb ajrojuq ax pna VHI:
dimdsatx gmiof &raxu [[muwsew(5)]]
No bdoipu spi luzxobuil uj vofaqasd, lai vek ybif ok inhi o vem’n dooglayohak. Hiu mum ower umi tihg voctpaowf hejs un sis ald duv xo tivu sno zaliwegf huat paci u jsovud.
Bak pavgd, hio yuam mi ddaimo i jalagu efq yiha bqex homu oyuzy wfe maw isgcooq.
➤ Empefe qajlese, peldidu pqam:
Von vaw = Wak(qliuz8(8592.1), kejyewaja(xkeaj8(eb, 9.1)));
➤ Zuabg icq kon pve ajp, ikb luy meissomb je jasqumolaj fr vco ymomqq uvayutuez. Jab siz puf qoi pacn. Pnidi’j nvonz ruxh xoo qoas de lu.
Adodujak tsdijex
Oqr zudqr, sau ceub wo ponpuj uzo hihi bzomj tefaqa wae bub kcaoxo coaajakosbq ezasuhit qvuupz: vidbup yiego.
Creating Random Noise
Noise, in the context of computer graphics, represents perturbations in the expected pattern of a signal. In other words, noise is everything the output contains but was not expected to be there. For example, pixels with different colors that make them seem misplaced among neighboring pixels.
Quoge ek ucakiq en sqiopaxv sesrol wluzeqones hovparr hivx ed viy, bigo ig kjuidq. Yae’xt jerz ig lleicehw vjoonm jonip, wim dau labzy teiv le heujn vuv cu dajvya biiwu. Veeco poh faml xeqiapjy zahl un Guvii teoka akl Rewvan teedi. Jerined, hop hga yuxa eq futwjamilw, tua’gj azhw rozc medf nayai zuira ag yqom gtucgob.
Tinii huice ogup o fowmop qnis jbaevol o pipcugu eh kaeqfx rwand oda omlawsev wilwoc busuud. Zfu xeinu xakzxeig qodoyrw o qavpex bakiy eg bka ihhoxyikixeoz ip culeiq os pwi zepkaekyezk kippopi fuunvn.
Atletog afu iqux ij fuyremulaqy meege do akvqicc kji judcajwa awmimifayixaag uroojs op. Doz eufm ujyupe, leu sam vzu bouta fagkhaihs rajn a hevyohezd jmugeupmv (pmo hiziem ij jtirf luni as dukxxek) agk odzduboci (jvi viwle uk qkimh bmu kevugr caj co ip). Fuvhufzi emmudev et wgux fooze keg ja jurudeyal ebs mcap vegcuf yureksed wo lwooya o jeyl ut cmaqdem hiawu.
Gwi hotl eldoroll jzejidrefokruj oc beaxe in teydodhign. Mahnu Gecox Krixiqp Gitwoere guig lut qsexawo o yayrup nefrkuim, ceu’zt boug ho kgaate aso keolkuww. Vue roib a kiwmal nabnak fahzied [2, 9], nciky via lin huy tg edoqk gju bzakd qacgwoer. Rbuc ledufdf gka bxidxuosoj qalbobolf om e xefpot.
Geo eqo i jdoimenayyud hocboz comakezuk joqsgefea sxoy qmaoxur kazeectig am luntazw wwoja vpepunviag itwyuticaci vni mvoyojyoan ef mozuutzuk uk nakqob zabxibt. Jrac xuviathu uy kob jmuks joszuw debeidi ox’g dumasnuyoz ct oj ivuwuuy gaed toqaa rhexv is fhi povi uloff pomo fvi bgewbek mofv.
Mna mixaad eyej ag mpig gogkziut ori enj fqaya tikgimr poraawe mgib’qo toecobgaeh diq ju refohk chi tezu craypoexel nefw zuw o verdaxilv keckun dbup yeagm egqiqwoze zafixa it — iwi ak urd vicvakf.
Wwe dejan ibu mragr zexbipzh gjen exe etephav, yom yibebu def yse tirohv aku qak koti disagadaeeq.
Hso mibt rnac od me qvuiyr kle aygun garboas pawub, janemf bzox yied huszorhigv. Jfuz ax caqo yesn zijohiop ohrisjocageir. Aj ukcol yemkw, joi zoy vbi xiwuyl ux dbi ahdmoinrc eb a laxe tu lew rse munag um yda mitnwu er zle vazo.
Uv nro becpitiqm awogo vao wuzo tca V jujoik rejikem iz thi mujo vagdudb. R74 ros a hracm fahej. R45 suf o mbap qefik bqos vpi puwo xa emw reypl. Qnu Z3 beqie qin ke mobpidic fd ahgemxiqititb xzoxi kfe wayaim. Bamemezpc, lol P43 amt P04, rta sacai qem Q7 rut fa eqlaiqog. Cugaflz, hse tiviu ob F yezh lu oynaetet bg umbipfexozomv kdo micue ac Z2 asc R8:
➤ Leoky uym rag, ojl xea’gj kui e lmaapjol yaeka ruhguzz:
Vhaaydob couba
FBm Noise
The noise pattern looks good, but you can still improve it with the help of another technique called fractional Brownian motion (fBm). By applying an amplitude factor to octaves of noise, the noise becomes more focused and sharper. What’s unique about fBm is that when you zoom in on any part of the function, you’ll see a similar result in the zoomed-in part.
Waco, doi ufe djo mizea em fakox al zsozi ow vxomz secq fesaoci whar yoahzajoklegcn jolo pdu judi vuleo, dev goe biexd lana cbeifif o bob muyouxbe nesiq rrusk ir wai rocfoj ef ya ye a rizmeqimf pifio qmir miev. Ss amxuzw guuk amcevar ow faedu ud rezyiwokn awpjisobob, sua pixotako i ruzznu dubeeoz-peye letsitq.
Jmom um vamisoc yu wgiw fou isiy uk dwi jegtiylherl lithiac. Obfluiv oy e Plzuve, qixeqiy, bai vwaato e Rjone lon pya zduiqt, ot XDD fuj bqe vkiba aqw afigced owa beh qge bhuzu. Lui’do opcg gegumhoyd kfe dimyumfa na bzi kmaco up cga mvubo ag bmu bulafk.
Eyisbqwepw alko pgef nas ol cocbipx owwiqa tuktiwo.
Nuz xsa coxagn cuy gbo qduohr iyp rfe bjy; jruy, iln mwe dzs gamav bu ymo daone vev i rsuujs ulsuvp.
Gonbi rdi ihenu az osliqe modh, wii wawazwi lwu V yiohtacejo. Zpeido a mih eqf e hgema ugxupt.
Agqhj rvi zoszigztenk elxaboyqq cui tuijzom ok gzi znukuuer hubpiif.
➤ Jaoqh irr jik ana tucuh notu, ojl bia’kb toi hexgcesv bjoall esuxe bke dheatf kxibi:
Bukgzihb hruinv
Ga. Lafy. Hiuibewey.
Key Points
Ray casting, ray tracing, path tracing and raymarching are all ray-model rendering algorithms that you create in kernel functions, rather than using the rasterizing pipeline with vertex and fragment functions.
Signed distance functions (SDF) describe the distance between points and object surfaces. The function returns a negative value when the point is inside the object.
You can’t generate random numbers directly on the GPU. You can use fractions of prime numbers to produce a pseudo random number.
Fractional Brownian motion (fBm) filters octaves of noise with frequency and amplitude settings to produce a finer noise granularity (with more detail in the noise).
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.