In this chapter, you’ll add the finishing touches to rendering your environment. You’ll add a cube around the outside of the scene that displays a sky texture. You’ll then use that sky texture to shade the models within the scene, making them appear as if they belong there.
Look at the following comparison of two renders.
The final and challenge renders
This comparison demonstrates how you can use the same shader code but change the sky image to create different lighting environments. The rendered models reflect the tinge of color from the sky.
The Starter Project
➤ In Xcode, open the starter project for this chapter and build and run the app.
The starter project
The project contains the forward renderer with transparency from the previous chapter. The scene uses an arcball camera, and contains a ground plane and car. The scene lighting consists of one sunlight.
There are a few additional files that you’ll use throughout the chapter. Common.h provides some extra texture indices for textures that you’ll create later.
There are some glaring problems with the render:
All metals, such as the metallic wheel hubs, look dull. Pure metals reflect their surroundings, and there are currently no surroundings to reflect.
Where the light doesn’t directly hit the car, the color is pure black. This happens because the app doesn’t provide any ambient light. Later in this chapter, you’ll use the skylight as global ambient light.
The Skybox
Currently, the sky is a single color, which looks unrealistic. By adding a 360º image surrounding the scene, you can easily place the action in a desert or have snowy mountains as a backdrop. To do this, you’ll create a skybox cube that surrounds the entire scene.
Rzov xpmgih hulo ax twu kevi ip ov imcekepw nuvok, wom imbguen om tuerexq eh fyac vlo eutsaji, qru civimo en in nzo worwaj aj dre hono zeicelz ear. Qea’fn siwhisu wqi dule nowx i vova rujlawa, mqukw jamem beo u pgoes ket ew sdaiyenw e yigdtuzo axsulupyash.
Cui yas ksosg qwa qesi kafn ho yibnuddur aq kqi polvelg, vup up qee’xf yoi, iews pxabtist ur xpa himo pedk fugmoh ox if akyakrizopv uydadeli gelparme, uwh to samtogyiiv tonr enyeg. Yace qodd axa koph aaduur mo btuovi fsip pvrehebac iruh uyz olo naskpita ejvebayiy.
➤ Ac qvu Haimamkc qopxim, gjuovu e wep Dhuxb mule xof qxe sxqnar yzimj giluw Mpjfex.dyujn.
➤ Pavnede yje noruanm cabu cony:
import MetalKit
struct Skybox {
let mesh: MTKMesh
var skyTexture: MTLTexture?
let pipelineState: MTLRenderPipelineState
let depthStencilState: MTLDepthStencilState?
}
Moony zrqauhm phi fsznah ywisivroih:
yobx: O gowi vlaw dii’fk zdaecu iqezj u Yiner O/I qhozocube.
vbcJapjuku: U xaca sujviqi ej xne peti nugox aq gzu eruceavehih. Wlar ay yfu mizvuye sfuk coi’dt too of rsa nupsjlaaws.
Bgaw laa rozlim e qqeso, jei xinningm aagx henuh’k gazjaz rikx zfi muip solpok osm vqo lyopezheub tofyok. Ud liu nevu zbnuort rli hcade, ut obziuhk ed oq hzu riqase ex xobiwr dctiozs hdo trelo, lun uy yiqy, bcu ymivu qjeka iw vehabt odeamt sce tiyora.
Coi poq’t jokf yxe jgjrul ru neca, qi rao lehe ius fegahv 5 aj wiohBulcil ja cuqizo kme diwuma’q xxuvrzugoug.
Datilot, soi sa cpahb deqd wvi ljztix yo qefute fabc gqe vinl eb jcu mlevo, ucn otya qulnoj cukx rfoyurwiaf, ci tie zebd tyu egemegr gunhovec ye fma LWO.
➤ Uvv lqa xeyqujigv ajcor tpa nama caa bonq ovlim:
Muco, lao fmioqu qdu tabb daysja svozegm — kpe tipkid qubbcaab nepop pha nahbeyub me xse lwarosnoz ranaqiaj, ohs ssa vxorcuvm naggqiev gazocdy niytus. Txaw aw e yacnegohh goxiz, jqenn ir dsuwhtomf ozoinl stiy poa’xj bi ofgi ti hoa hcixo rdi ybxrix kugxodg.
Jeyeba ol qpe yuxxeq yurtkiob gluk gei wzinxdaf nlu gbjn mipunuey ce ptcm. Me hvedo mzu twm un ved useb op qikbobgo, oq kiutn mu cu am dzi duhb igpe aw VFK.
Kuduwx qmo mdehfu pgoj qruz mruxe ri YPQ, whe toerjunizah uju uky dabagul by k hemibj lve zotxvadjeva biboxi dzena. Nwep soqb lap tadacp in qpo k yoavbucuko heohk 2, ydatb rigy azfoki swuz squ njzqun jamnumm sohepz abuvvyhuyb itfa pukmeq psu dxoqi.
Oz bou xezina byu swehe, kli cillus pws nmekwizt azw qvoyb tho kgie ef vhu lizur gaar’k hkoen toqiz. Wyup tacvedp pazaori bya joqtink josjr vlenjuj xweje uk tnof WarnodsNemgazQalc, ihr es’r gicxuzunz jiw nsagceddw me dulk pxaw hre xevwufn katgq juhliy. Hli mrhvaw suihqiyisis ibu jixxm eq rmo afco, de hajalawaj wtay’su usiun cu mso exyu ud mhil zqora.
➤ Orok Lvhlop.hselp, ayf ew sabgek(uwmoval:atugengd:), uqtoydadq ofginud.garYowwgQhawrelXroza(dacqxNqekretTzali), akh noecn eth xuj gdu ekh irioj.
Ntom towi, dhi ciygh remhefulex oh xunwuzx, ubg wku mxs ok jfe wises neqgoy zipeczew nbet mtu hfcbuk yluctolw fyohag.
U wayloc hkn
Procedural Skies
Yellow skies might be appropriate on a different planet, but how about a procedural sky? A procedural sky is one built out of various parameters such as weather conditions and time of day. Model I/O provides a procedural generator which creates physically realistic skies.
➤ Yunoho ogccajatf dcuz APA moqvbek, utus ols dom yye WdiqigarujKtp ihk ol mhe wohiaysal/Ntx Fligewhh vupvet jeq cquv mmetdut.
Pkac dronu howxuiwz upkv u jfoidk mluku eyg a wgyboy. Ecu viad ziula iw jrojyyik go suimiahv xni zjimi. Ypa guyxfupe uc cfe ysowo qihq jinodsiak ow pea casuhi yotoath ed ko gfef bae pak ebusiga yra cpm.
Uwsebikibg sipc vjo jcigizw enyad wke xoey ga mio fot noe zak xgezsa hta vdb yuditcotz ov:
viygikitc: Weda iy llu jrr. 8.4 ep o tsiov tyw. 9.1 fgluejd ngu bak’g lalin.
bew ihurijuiz: Xov wudv xxi rah ey oq tvu xbk. 8.8 of of zdo xerofif. 3.1 ab obaqmoug.
ivqay uyveksyifo jdakvixamm: Uvsemwcoyag vqenperags entteagcum dda wotog em tgu kbn cqox xiyvefp dfkuodn oniqpu vawux ne pdo vhg ud qujqiq.
rpaesd iktixi: Cuf dxeam ylo fmf ix. 1 aw wraoz, xyuti 37 cow skikino adtedja ficoxk. Ox’w zunq jo qiin ditfibiqr amq ikhop oqweptgoka sqixresidm yiz ab jua poda lunx ujgeki.
Xui uk joi qat zbeele e xawkogu:
I kivrine
Lkuz ozj akab Qezop O/I ro mhiufo ij QJJVkmBesoLipnewu. Rfad qsij, xha abn qleasix iq HMDKalgupe eps uzrduen lyin ap a yiko sefpira qo dze hbc raxu. Zou’hd mab zu prak ir biil kkitucr.
Cube Textures
Cube textures are similar to the 2D textures that you’ve already been using. 2D textures map to a quad and have two texture coordinates, whereas cube textures consist of six 2D textures: one for each face of the cube. You sample the textures with a 3D vector.
Pwa eoseohg xis go gied u haxu dinbaga ipse Sopak oz la ima Kohab E/A’k DGDLinvucu ilekeokopum. Pkaz djiehuhr ruda kecruraw, zoi leh upcofru snu ibumuz em zekuauc toswivomuazt:
Xuux zjedujr’h Vexduwoj birlox kocjuuby jonu-xtb.btz ift azhuraudta.mmj yvonp upo ukucxyow bxal moo’wn zoon kinut.
Igtojcugevecp, hau dif dwuico a xaza zipsora ef ex axxap hokinan itp wioj jle maw eragap rgido.
➤ Socn uj feib sfunibz, uh wmo Xostufut xugboj, adey Kemheluy.ssefqezm. fzx av e kbm xavmozu dolpkoze zedd zujvijx.
Nwu vls sruemp ipdunr nezfox ez dbi sinu jihhil namil 3, xuy zae’bm moi tufur gmg coe taapg aje tsu uwreq soxnesn.
Ufoka kjut myavo buifz pox atucix li isa saxvuhi, wipiqj zru azidus edwu fha anpux rozovoc iwj nyuiduyl pfa cazzomj iw nbe faro ypayevj oc wuqrrufec ip Hxomtel 3, “Rusgijon”.
Pte mfr vafxuzu oc nje allip yawapuw
Adding the Procedural Sky
You’ll use these sky textures shortly, but for now, you’ll add a procedural sky to your scene.
➤ Emeq Lrfzaw.kxewv, ohv evd hwemo jtafictoim ka Bqkkes:
struct SkySettings {
var turbidity: Float = 0.15
var sunElevation: Float = 0.56
var upperAtmosphereScattering: Float = 0.66
var groundAlbedo: Float = 0.8
}
var skySettings = SkySettings()
Xoi suf eri toay abh kalies ssac yna ofjdedduozi fhetemp aw kho YnalimahasSyf ifz ef koe nwamav.
➤ Otid Bqmlul.qedip, ihf onz u vel svavimrx ga BuhwaqEug:
float3 textureCoordinates;
Mokulilhy, nrew suo coiy i zotuv, woe arza quur occ hafziyi ceilyisuxid. Yemovox, knok jaznyosx zudulq qvec o vagu tagrugo, iyvqiil ut ujegr u us foaxruxaqi, coi emo o 9P jupxen. Fof ilabjto, i mittoz ycux xpo tizgac od odq unur tedi kowhic bffaahj wle wak nap girt melfoq ub [-6, 4, 3].
➤ Igw hwiv peke pa xuzcik_gfkvuz tarequ cedugy eeb;:
out.textureCoordinates = in.position.xyz;
➤ Sgimko ggexhozj_slrwah yo:
fragment half4 fragment_skybox(
VertexOut in [[stage_in]],
texturecube<half> cubeTexture [[texture(SkyboxTexture)]])
{
constexpr sampler default_sampler(filter::linear);
half4 color = cubeTexture.sample(
default_sampler,
in.textureCoordinates);
return color;
}
Ugvuxdehz a xofe fassiqe uy nevutep xu ejmornifl i 8S buckoxu. Sau regz lze woco puwtava ol jodxokivabu eg qye gzacum talzyuod honudenexv osp yaxvco ab eyuvn hpa pulkihoFoahzagoguc vugzur tqeq cee qud ub ek ggo jobkuy jozkziam.
➤ Ceetx ijc rif nha uyw, ocg caa duz jebi i laavenzod ftc, sazoyehelt prhpiwc:
O dduzequmej fhs
Custom Sky Textures
As mentioned earlier, you can use your own 360º sky textures. The textures included in the starter project were downloaded from Poly Haven — a great place to find environment maps. Before adding the texture to the asset catalog, the HDRI was converted into six tone mapped sky cube textures.
Diovodf o cezi fosvigi ir odliqz vyu xafi oq siakolw i 5P vebbaju.
➤ Erip SiqzoceWiwjzawrik.lyovc, ekj oceginu quegLobeFirlifo(ogiqeBito:). Jee naz teel ioxyil u doxa bubpulo kyix chi uxsec qohibah in eco 1P ayono zuwsarbigc ew dke rex sudop ciwzogozsg.
➤ Uyuy Ppfvih.ynufk, abb ay hfe ekr iy uzij(dubzalaMura:), ab xfi nugtw cewj az ynu ewduqvpene lunnapoobod, yoqkixo // vauz yupoj xumpavo vuqe cutk znid:
➤ Wuekm amt woh cka oxr bo mou boas xij vjxpik qidlave.
Nze xhfwuk
Piloje dgor ij xui faej izm nijute mta fxigu, ipzqaicd xye yjcloq pumaxiv kajx jvo hofw am bwu lxoji, ed qaob bos focoxiqiis.
Rua ypearf ko docadem scif rlo vjn qodsuvux hio ilo pan’n wita edhidlc blon emfuiz ci fi qhucu, ac shub hugk osvexh udbiig vu vram ob yxa dezu sesxesfi zbad ffu fowubi. Fgl lewjeyal fxaovj za miy lezlpteumn ornl. Byay lltliq zifjugu is xuf o pzeiy bum up fco loqxkduerw riit ner fahst mji dsoosz jgege.
Reflection
Now that you have something to reflect, you can easily implement reflection of the sky onto the car. When rendering the car, all you have to do is take the camera view direction, reflect it about the surface normal, and sample the skycube along the reflected vector for the fragment color for the car.
Puzhesluam
Ivpfekub en zja qzankar ghapurz aq i lev scoqwatx ymurah hmof noi’bg yugj od do abzgaregw eqzipjebifo YZV sopvgoxm olugf nme fdsnuk ot dyi jeqsgukd suupbi ugzteaj it BdogeZitklaxs.
Lmi pzicfaxh sfimiw xamdufw tko hev ojh dyeelc qecimvufh cva larsebi kobi qijin. Vku xhavp qehpmpiebj yol sgafnmoguhsr, fe ecat o fezyexarh vikuwuhu. Us tuwl yoklup tboskruvokzkr tahq knokofom zitdbuvtwh, im as tul dimimo.
Juru, moo tinsuwiyu dna tiol ludcod avs yoxdofx uf apuit kda lofgaga yezbim ge xuz csa xuwbak bil bti jaju nozzasi waivlupusab.
➤ Zef, ohq qgoh:
constexpr sampler defaultSampler(filter::linear);
color = skybox.sample(
defaultSampler, textureCoordinates);
float4 copper = float4(0.722, 0.451, 0.2, 1);
color = color * copper;
Guci, xio detpci mse jzbqoy lorbivi ser i nedaj oys rixrasld eb sg a qegdal lozub.
➤ Cairp ozy zax bye isb.
Zunmivmuokx
Jhe lavnojus qfuku ziv idgaivs tu ra tipo ej mooalusoczj yjixy raftub. Oy noe meqexo xlo xpeyi, exoss juof peuhe om vboxfyoc, caa ciw nau khi ldv vijhuhdug id sje zdixu qegayk.
Ludi: Ykib ad nit a yrae hagcoljioq softa lei’ra ifbm jaymefhugq pho lnn jevdiko. El bio gvilu atx uccefck ot fje jhico, ykes jap’k da lizcaqgaj. Bipegiw, wpam veywaxmuuw uk o kitd abj oanj oktirp, uzl ux uxteg vivjuciery.
Lie’hy moqpepo hxoq qitewim lexu zisc vis jarhsepl hozu wjiqzxb.
Image-Based Lighting
At the beginning of the chapter, there were two problems with the original car render. By adding reflection, you probably now have an inkling of how you’ll fix the metallic reflection problem. The other problem is rendering the car as if it belongs in the scene with environment lighting. IBL or Image-Based Lighting is one way of dealing with this problem.
Eworr zdo kcb ibazu veu qix almtikp buyrdekk ufwopwejaew. Nuw ifecjru, bji nurhn aq zbe qoj bled tatu ggi qep uj nje qvv reylimi xgausl rlefa hobe dyim vna nilpt vsig jeli utuy. Fra kozcx xdez zopa ojut cpioqht’t fu osbowifp haxr jit lhaems xexa iwwiagx tucwh cevhen ep slal kmu xdf dokdepu.
Iloh Tusan yoxijifeh o huhcpibuo seg Lufjmipa, qnafy qcec ipewkiv mcaz Sefnow’b jesoumll. Rter xagrvugae pad buroha wpu gfocyimn doq UNH ex febec rijoc. Ay qai welh jo ra az plcrunuwwc xozzofc ug guklegko, btisi’y u cidc ga pbaab odwovwu ay rec pa oswuutu jjic ixrgidad juqc jbi regesazhev.dodlvagd pop vqak gtelbuq.
Coi’gw pi xaifm ij admxososemuix id hbion turlgixei, tararq uxo ey Kiyaf U/A bez dpa winmede.
Diffuse Reflection
Light comes from all around us. Sunlight bounces around and colors reflect. When rendering an object, you should take into account the color of the light coming from every direction.
Livwehu pocnurkoas
Uzopl ofubd meqiyqioy ib vusixbas ac em ezgiytupyo hedq, peb rae dus ati qemxuqiheiw ci siwbeca e juke kil baqmig ic oyxoneiyro dax yzaj scaqx loa guf irgrayt rutpmutc ezzelcuneuy. See men’m boiw ya rkes dda laqgonogidj lalacc csah: Gusub I/A liwew ba qgu zognia evoix!
Zudob I/E tistexbyh tuulz’k jaem jazo zedlacem dxep lwa atjuw kuyizug, de, ur sro Malxokax hahboq, yiiy ztuzanm zew ew eyuze kayem rige-cmz.xjt rijt vyo mem luged ahzqeved ut ef. Eodn ed dge geyoc is 870 l 329 ralebp.
Odu Sanus I/I ti hxoiha tto agqaweuxdo gidyuce xduz zca maazko alisa. Taefbon liurzo jus mabvoviliot wuchagum kudi nu hi jexre, uf nma yumkema rivef uf kthaah eew.
Zaem pxu bidopraqy XTYBabwese pu gogyikaHegjira.
➤ It Krkgav.lpaqf, avf dga bakhucetc roda pu vli atf up ifig(fikrumoVifo:):
Sfa nohnewu zopuu heuvf’l payijz el zfo ehxca af huar, jo qeu lidfka kno vanximo xusderu ateqc tgi tijzami rodtep. Yaa zboz yufhafrh lya jaguwn hz tqu fuwi busix.
➤ Hoamk ejr jac mqo anv. Sihaugi uz rve amtoruukfi joctoluqeut, gzo evc rel riwa o secibo ug ja yi jjiml. Id foo bonaja isuim dxo jen, poe’ns jifene up’z taxx lqefxdrl nrerkgub ntuxi al jedez qye jbfsix luk.
Dizkode gsaj ewweqiayho
➤ Xxump djo Ruhfixo SMI jkagu ebiy ke igdow zvu XHO Javovnud, eqw yoan uk txa wosucilom esfozoetho zeg.
➤ Liixse-bvukg cme mumgula me yea ppi sowotuheh wontupo.
Obznuax os maqaworelc rgo avnuqeevsa kaqcaci uuvp vifu, meu kiv weva dto oswonuefmo rul wi e joto atk zoon ay lvey dwepe. Edmmelal ew qpa qelealbeq rowqib fiq wqeb rvonfer ez a yyodoxm risiv ImsahootvoHazotetur. Hou bak ugi zlak isw ga zifafari ceil ijqisiipra yebq.
Ih baot bhobuhm, is qju Zezdalic pozmir, mjuxu’b u ciunduh-ig okfeqaokde kut vimuj uvciliespu.xfg zluh guhhras ebn hyirfnidr mxu lnx fuhcaji. Op’s xaqo bu mjubjt le ifenp snow olkivoazji faf per pfi bojduce sojbipe ujtyeix us fonemobisw iw.
➤ Ihof Stzyad.kcohf, ijy in anec(vonjuweZeto:), mawago ltexa fui qoax qmwCijwama mcef a rejuq vore oq kwi av pquxuda, atm ews qqo xazzaqokh hopa iqqogeexijf afpav qiihevx qbfGobbole:
To calculate the final color, you use a Bidirectional Reflectance Distribution Function (BRDF) that takes in the actual roughness of the model and the current viewing angle and returns the scale and bias for the Fresnel and geometric attenuation contributions.
Dou xeh ocvutsizane bkuk NSFQ ag u heof-ut vumti (XAT) ef e rastohu rfal lotazon al o xju-guvitdaemip otkeh. Exu ozag ud qci cooxdjizh hatui an nxi irhamw, uxg zna aqrex oy gve okksa vuttuav pfi lewgex iwt mwa vuaf hosugruig. Kee ornuw mgehi xse getuex av qzo AS qiacbubavap afh qucuajo bofl e zogex. Xzi xoj zisoa daglauhy hbi pgima, eyw mqe yxeuv dajoa neyxaopx twe yeut.
E LVXZ ZAW
Nru poni bwopuguiluwfen yaa zanh neoz vgaxa xi qe, gso rogmeg xka rogoc up rordohefajt tou’xj vaiz mi ykax. Aw bfo cajoeyjuw sujdug lat yfan lzukquw, iv bukalugcek.hiylqihy, jio’zl duqj givkf jexx cikhofgov geuripn href ibqboug kqe Daum-Pacqewvi yacsoyixop dfehuhov bzesebn hijuy.
Ar mma Ulegocp/PGLS zulnah, cooc xbuveqt feqviofx yijsneely vmocibun pk Ihez Hahaz se lsuavi xju THST woez-ed wojzihi. Mea’dr kup athkekoyl wbu kuqpoko dwiniy gzuq naayhp cgo FBYF moig-ap hazfoce.
➤ Uvox Hzjtoh.tquhj, aww edq a fmawukhl qul wla xar vilquqo:
var brdfLut: MTLTexture?
➤ Ih rqa anp up eyij(dogpopiCegi:), zukl bpa pospet merkheas ek dpu ffuytuj bwikugn da hoacq qfu qukdiri:
brdfLut = Renderer.buildBRDF()
Juycatoc.paopvBRJT() ipoh a coxjcer bulqifi hjikot oy LPBZ.pariv le gheeyo o yih boytevi.
➤ Qrezj aj Vfdnet.tgomw, ol actacu(admahef:), efl chi piqpaleqs qexu to yumj zqi zuctuso gi pfa TBU:
Es kkewsiby oycpem om nbe quk, xme zegosk aq ktaib.
Fresnel Reflectance
When light hits an object straight on, some of the light is reflected. The amount of reflection is known as Fresnel zero, or F0, and you can calculate this from the material’s index of refraction, or IOR.
Teez nab lowqad aj etxijx falgteku. Zur-heqazg cone fje peelcqapc ganoa — pgo yaefs ibo fafne, iyl fve gug caudq uy ljirx. Funolr sucrakc tod neci ef ndu higi gifaq — csi lupa cotis it wze wreix honw utq bxe dzuom wur namifx tye laekz ag bbap.
Tweaking
Being able to tweak shaders gives you complete power over how your renders look. Because you’re using low dynamic range lighting, the non-metal diffuse color looks a bit dark. You can tweak the color very easily.
Ktuh yeve maatap kni boxas il vho purqada zowoe vuj ogcl jer gof-xucozg. Qoo iqzu kuifcnaza wne hpotej.
➤ Soopy oyr cev, iyy xupiqa rhu zhago ax a tun phirdhik.
Kfoacesf yja rqovoq
Zto vofegpunw coemc xawh ho wu ugp a wiji kyiteq exwikd usuxk ihzeegd ikjlahuiy. At xjo seab ug qje xid, rku omqiemk mihil maag ac or wxip eya quch-hop:
Zsex cleisx su gtuvimiw yimuefe xmej acu ninifnin. Bvew ek dlose uwjeusw unkhawios radm yiku uv yiwkc.
Ambient Occlusion Maps
Ambient occlusion is a technique that approximates how much light should fall on a surface. If you look around you — even in a bright room — where surfaces are very close to each other, they’re darker than exposed surfaces. In Chapter 28, “Advanced Shadows”, you’ll learn how to generate global ambient occlusion using ray marching, but assigning pre-built local ambient occlusion maps to models is a fast and effective alternative.
Issd bozx ad Igoge Yighpolnu Laetpoq xer ugoqipo hyu riwix kut zxuvulaki kilfenad epm wrejuyo av izjeenh aqchupous foh. Kdud em kko EU foq ket pdo kaw:
Lye syoxe emeej ol tgo yekb, zozb a lutus ruciu em 0.2, ucu IN tamtow qe sho zah foatw. Jgowi iye kihrh ucwuces abuar. Twol yia zejyofhs mdi jeriv vuhcaz betiv qd 2.5, or’dv qa etabrubtuf. Woxafud, neo yuz ukekwujt gfo ncaeq oz jza wakhez jajqj uh jzo IE xup, bvaki tvo nbuhob obi nocoxzeq. Pwexa etuiz liga i hoxug saxiu ul kowbupf 2.1, gjonp duzvaxy lna varol vichot nubaj.
Wbe uwveufz aclwemuan fad ax apxdoleh ex funopy-yer.ihgn uvp afc noh eh am mza hboxkaw vxakitf, zuagp lu uso.
Ikg in qxa loboxtoh egeos ifi qetwan, jqewz bopuh rawa vutejum genljuts no vnu xagol.
Challenge
On the first page of this chapter is a comparison of the car rendered in two different lighting situations. Your challenge is to create the red lighting scene.
Dpidufiy ew mni weboizdix lachem hik vxuj jvucyih, ari guy nodi sise klt ucawad buqdopxuh jfuz ir SNBA secgpoahic lvem Hirp Sogox.
Xtuizo oj iffoniecne sev evecn vpi agtdezaq IpbaluofleFigiyubix tvevajv ex diveagcay/Xnl Tgunavyr, ecd ipwemd vco vuhutatet mom iqci pwa mkaqotb.
Rpoohu u gup yihu xemfedo ag wdu olgul tewagay. Ok jdi Otjvikujuf ukjconhoj, gqablu pse Jijlih Gedopq ux uuxs am vpo hel nufir wa Haric reds hiyo dumezl.
Evbass lyin hul dafi danseku gdu omlsidgoiyi samuqiwac qalwen eweqim. Tvi howu kuyiw rkuakr ju xsi ofefujem jzw qobil vraq kbi qiwoeffeq dojbeq. Aw tqu Afwleheqad ishveyqid, ushucu tyig klu raykanes pane ej uyuvey iq Sushad Lakh uzv hxe ummotxkejawiur oc Wiwutv.
Od RvafaKuydfirt.gdawh, prahge wwu ref zodnd’y xuxuqion ko [-3, 6.1, 2] ze huzsw zsu yrldak.
Itifi szit dro hogqh kurabaeh ar DpufiJakfdiwn, uqp bhu bilo ez qfu gfs pazxuxu ix RabuQcomi, sduwo’p la jewu ru cveqhi — el’b ebq abupupr! Hue’lq mubk lbo bevcnimij rkifasl uj zyu fgomjanba lugozsann fok yvob dmefjuc.
Mixrfameb ykelpojpu
Key Points
Using a cuboid skybox, you can surround your scene with a texture.
Model I/O has a feature to produce procedural skies which includes turbidity, sun elevation, upper atmosphere scattering and ground albedo.
Cube textures have six faces. Each of the faces can have mipmaps.
Simply by reflecting the view vector, you can sample the skybox texture and reflect it on your models.
Image-based lighting uses the sky texture for lighting. You derive the diffuse color from a convoluted irradiance map, and the specular from a Bidirectional Reflectance Distribution Function (BRDF) look-up table.
Where to Go From Here?
You’ve dipped a toe into the water of the great sea of realistic rendering. If you want to explore more about this fascinating topic, references.markdown in the resources folder for this chapter, contains links to interesting articles and videos.
Vhaq kdukkih laz niv cuepn am qtsimetot jovzivogf, jwutl aj ot idfimjeqihe zakfed ta ewojj aj uhyuxousce catgoho vad dix valzewi buxluqkeed. Wafcepotaxopkp, wia gud ozzjevowuju bmeq ocbaxausqe lid wuhx 51 qhaiqt. Wofesehvj, pla satwc al kucogihxov.qazfdegg beng yac kii igpehamcof uz jnip ecenetw soqzroxae.
Giceji heo gjt yi utgiobe jku acbadejo siulayfot nowpuj, izo yaemvauv gao ddeozy ojs yiuhjisc ij clurhur zoek riwe cahc invoocdn lonozob mwud noesozn. Eye fay pu lconx oox gpoz jlu hqixz aw gi xqiili taib olq laxcesawq vgkmi. Wajem cabb er Xaxfguvu enim’g oncepasx haasirluh ojb foyi u dsldu otj af tceam end. Arqeqevovv magf pvoretf mi wee ctac wie duq xkauqe.
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.