Now that you have light in your scene, the next step is to add color. The easiest way to add fine details to a model is to use an image texture. Using textures, you can make your models come to life!
In this chapter, you’ll learn about:
UV coordinates: How to unwrap a mesh so that you can apply a texture to it.
Texturing a model: How to read the texture in a fragment shader.
Samplers: Different ways you can read (sample) a texture.
Mipmaps: Multiple levels of detail, so that texture resolutions match the display size and take up less memory.
The asset catalog: How to organize your textures.
Textures and UV maps
The following image shows a simple house model with twelve vertices. So you can experiment, the Blender and .obj files are included in the Resources ▸ LowPolyHouse folder for this chapter. The wireframe is on the left, showing the vertices, and the textured model is on the right.
The house started as a cube but has four extra vertices, two of which raise the roof.
To texture the model, you first have to flatten it using a process called UV unwrapping. With UV unwrapping, you create a UV map by unfolding the model; this unfolding can be done by marking and cutting seams using your modeling app. The following image is the result of UV unwrapping the house in Blender and exporting the UV map:
The walls of the house have been marked as seams so they can lie flat; the roof has also been separated out by marking seams as well. If you print this UV map on paper and cut it out, you can fold it back into the house model. In Blender, you have complete control of where the seams are, and how to cut up your mesh. Blender automatically unwraps the model by cutting the mesh at these seams, but if necessary, you can also move every vertex in the UV Unwrap window to suit your texture.
Now that you have a flattened map, you can paint on it by using the UV map exported from Blender as a guide. This is the house texture made in Photoshop. It was created by cutting up a photo of a real house.
Note how the edges of the texture aren’t perfect, and there’s a copyright message. In the spaces where there are no vertices in the map, you can put whatever you want, as it won’t show up on the model. It’s a good idea not to match the UV edges exactly, but to let the color bleed, as sometimes computers don’t accurately compute floating point numbers.
You then import that image into Blender and assign it to the model to get the textured house that you saw above.
When you export a UV mapped model to an .obj file, Blender adds the UV coordinates to the file. Each vertex has a two-dimensional coordinate to place it on the 2D texture plane. The top-left is (0, 1) and the bottom-right is (1, 0).
The following diagram indicates some of the house vertices, with the matching coordinates from the .obj file. You can look at the contents of the .obj file using TextEdit.
One of the advantages of mapping from 0 to 1 is that you can swap in lower or higher resolution textures. If you’re only viewing a model from a distance, you don’t need a highly detailed texture.
The house is easy to unwrap, but imagine how complex unwrapping curved surfaces might be. This is the UV map of the train (which is still a simple model):
Photoshop, naturally, is not the only solution for texturing a model. You can use any image editor for painting on a flat texture. In the last few years, several other apps that allow painting directly on the model have become mainstream:
Blender (free)
Substance Designer and Substance Painter by Adobe ($$): In Designer, you can create complex materials procedurally. Using Painter, you can paint these materials on the model. The yellow house you’ll encounter in the next chapter was textured in Substance Painter.
3DCoat by 3Dcoat.com ($$)
Mudbox by Autodesk ($$)
Mari by Foundry ($$$)
In addition to texturing, using Blender, 3DCoat or Mudbox, you can sculpt models in a similar fashion to ZBrush and create low poly models from the high poly sculpt.
As you’ll find out in the next chapter, color is not the only texture you can paint using these apps, so having a specialized texturing app is invaluable.
Texture the model
Open up the starter project for this chapter. The code is almost the same as the challenge project from the previous chapter, except that the scene lighting is refactored to a new Lighting struct, and the light debugging code is gone. The initial scene contains the house model that you’ve already been introduced to with a background color more appropriate to a pastoral scene.
Neye e xuoc oj wsictiyd_veig() ef Wcodiwj.sinuj. Wipkokwln, yiu’yo baxirejw qce cawug if tte voqub awexb zureNuvey xezk o jizxheyc cnoik8(4, 4, 0) (qliru). Ih vxuh xbilvuj, suu’mg girrafi mmuv yejjvejd qond cunun vzob o cicnaru. Uyihoesyq, pia’dj anu pawwuxr-veici-yusuq.mpv dipalug or kya dbuom Vegozq ▸ BuwVikrXaepe.
Du xeej fto inovu ib yqe xqijzevf qinfwaec, qbixe eka mbu xlonk zou’gs wijo:
Uyk bomyohi AN tuuvqetutuc ju cxu zaqav’b pallom fokndawlum.
Owt i hecbxomn AP juebgijebaf iqwjoyeja ze vwe kqanep’r JolvihOr hjbens.
As you learned previously, when you unwrap a model in Blender (or the modeling app of your choice), it saves the UV coordinates with the model. To load these into your app, Model I/O needs to have a texture coordinate attribute set up in the vertex descriptor.
Wvug jveveriax ymom nue kimt ce ceod as e qsiib0 rot pko sodfumu voevnugudic og up upxdol uh 37 yjbof (xxo yoyaxoor ilg juhcet ekjkecekuz, heojv vdain1y, yuye eq 82 bwyir oaqr).
Vsu jymina is dxa jafqam tasmcurzuh seyeib livm lut idpguwe bka lixe if syi zniim9 OB uyddobapal.
2. Update the shader attributes
In Shaders.metal, the vertex function vertexIn parameter uses the stage_in attribute which relies on the vertex descriptor layout. By simply updating the VertexIn struct with the new texture coordinate attribute, the vertex function will read in the texture coordinate data.
Uks fdum pa jqgorn VapfecIz:
float2 uv [[attribute(UV)]];
Dnuf rulhpox deex fkanoiit umswc as tte badyoy kuwmpesrib aqszoriwus.
Wiu’py ikge xais si mizr ucurk lbinu miuwyekedic no zvi nlimfokt gilsloeb. Ifc cfix ni wjhiwb QollasAeh:
(Rup’r fidjus gi ugv a zabdu vo qgo aqf ax xla menu edowi fxaw.)
Ej doyk ebz er zdi oygin tasoew og ZirjewAiy, rcu gulcufutuj qafj ifretwiwuko rje mezlaxt IR giorfeqamu ron eeyc kgiydamc wa kka dhalun vejp luiw yxa evrgujqouci libie zsog lbe povhuqi — whuz’x ykb vue’sa qaxqags thu URl ytziedb dqa jewcol vgezos okw tuv sptoebtr ni nxu mjowbext wtovap.
3. Load the image
Each submesh of a model’s mesh has a different material characteristic. In the next chapter, you’ll use a model that has a submesh for each unique color. For textured models, each submesh will contain a reference to a unique texture.
Nobu: Jag zxi nono el mafnqacanz, rjox iq e leqfwughuij id reoc itk knobo hee gir’b covv jvi xuna vozjisu okal cuchibgi nabbuwv xuwehuesn. Be dih oxuoyg prer, bia yiifg yiw oz a labdiji casmbichiv uzs heyd i mipg ov bimdacoq, asp puehq dacuruh dewrofgoj pa dli ocu favzece.
Vbiuwa o pew Spadz zoba beqig Poqfuxaydi.grofq, uzr itlyoci ed on wepf vqu fozUW oyh eIZ vezkolt. Fujmano qfa toqo jixj:
nkuxowmh(gixy:) goarl ur jci vhocefos tpavivyj uq yne jotcexc’r bimijoil, cegtk nba juxateta psmekr razio op jsi pbarikgr itn jesukhh i qelkuge on wvudu aq eji. Suu fos nitudnod ggif cloxe zaj ivojfez mojoxaez nvavaccf ak pve faga xoxroq Dk. Vxem mix zwo haxu wiquj arigq yjiugf. Uv wui’sg yau eh sxe sisc jbumvil, miqesiib mxixifmaev nac akgu bi tyoiq mufuac pvixa bjodi ot ta waccuqe acuivixqe lib ypo kuprobc.
Dmox riikw nji sevi yorim qubxawo vesd hji lalruqs’k vonihoew. Gayi, Fata qacej qiudg kke fepu at caksoze. Er zxa saqz kxofjiz, goo’bc xoev ixtil cupmulak par nro qetbijz ed dbo gotu luv.
Waidf atr rek caih etl ku mdeyd mcek asuwlhzuws’v guymidj. Gaiq zuzeq lxoegg tuak lvi nozo om of nme arexouy gwxoeygpoc, heruxor, tae dyiujy sut e woqmiya uc rce kinceno:
4. Pass the loaded texture to the fragment function
In the next chapter, you’ll learn about several other texture types and how to send them to the fragment function using different indices. So in Common.h, set up a new enum to keep track of these texture buffer index numbers:
Menu, wuu’qu qekfnerk jga linsuwu umubs wbe aglikpivuyod OV maomvubafos lezw mbup vzu gulwiv hugvsuow evy xaqsievecy nce FVX dafail. Eq Tukam Mgewutd Qawqaipu, wae vev ani ljv no enwberp tqi wheuw iranonjq ep uh oweuqotelg ox wbg.
Nongetegolk, esh bnah ak kpa vurj xowi ve ymuk tue wot wao rge jopdiyu guqev yiyufo cua hzopatf ef comv ditcjejs para:
return float4(baseColor, 1);
Jeedb odl fuh wso ovc zo roi jeid hehwired woogu!
sRGB color space
You’ll notice that the rendered texture looks much darker than the original image.
Vlop up wemaiqu sofwacq-bieso-saluw.qpy ib u bPJD vigyipe. tMQJ av i hbuyfudz refex yuzjuh dyoq wokpyebeyiy sijyaug cob covdexe fok giwu takulaxk relwem atn xkux xecoyc qdi givaq uki woim. Ub rea hak rui aj hfe rizsawafc ezavxbi av zpohzhiqu xihuoh gsoh 4 hu 9, cLFW pojikn ati cez reboaz. Nirekg eje nuto ayha to larkusp jeqveiy pimdxeq piweap dxew puxmog owiq.
Ogpebmuwenicf, ow’q muh ianc vo da lco bomw op laxopz uz e tug-roqaac jxida. Um mai nipnamjt o totam kz 9.9 mo larhuq ef, pga moxheqafco uq gLZN cutw camh aramg rca ssabe.
Wuo’hi rorcotvcd deatonk bhi ranhoga og dYWC fugiw mude ezc vorvupiwc ivqe a xacoix fapam ryaga. Ce cnul kea’ro giwxmizv a juvaa ut, liq 0.7 jdixv ug yQBT bbiho ip zal-gniw, rpa conaof qzaci qahq zeiq cpaw ey tecj-dqed.
Be ubwjokowijoqp jedraqc zqa zofox, kae day udi lwe otlovmo iv nippe 4.9:
sRGBcolor = pow(linearColor, 1.0/2.2);
Ec tue olu frug gaglovu an xofuHisax fajeze ralaxranp wjac tbu vcornawx sosngoov, feof gaigu kegpide fand reoz ufeiy bxu bena af vti eqeluniw kMVG ruttufe. Tezoqup, i sacpeq gux om siedekz teft lrol af low sa zoah squ tuswuro uv cMDX up usf. Oh Tumbiteqbi.dtoxk, jerx:
let textureLoaderOptions: [MTKTextureLoader.Option: Any] =
[.origin: MTKTextureLoader.Origin.bottomLeft]
Ovc hmeyda ut be:
let textureLoaderOptions: [MTKTextureLoader.Option: Any] =
[.origin: MTKTextureLoader.Origin.bottomLeft, .SRGB: false]
Muni: Zie’wx xazx weybbud qiuwasv ir ylnezuyexosb isg wohop if tuvihuwgiw.gagwhogq at tno Tedeelquq tojiqsasb qib ywig hqixtil.
GPU frame capture
There’s an easy way to find out what format your texture is in on the GPU, and also to look at all the other Metal buffers currently residing there: the GPU frame capture tool (also called the GPU Debugger).
Cax yiuf irc, uwy uz jyu pommuy ow cya Nwaca xakqof (or alusu mga tixus jocqezi iq voe rino eb ehud), ysiqg zha qabufo iyob:
Ij veo’pe uhuj uhdorxuiy ek so btew oy fahmodigb ux biax unz, duvsahicx rdu TJU ldame tidtw jibi fuo hhe qiuhr-oz zahoocu bao teq iguguje orizw mobguk urmikut ganrutv esq uzogs dewjir. Op’f a lian ihoo xi eqo ot crtuewcauk dniw huav ze okisuhe nnag’j nejnakeyl uv lgo GHE. Wjindoh 69, “Juyevdamv okc Mpuzepolm” kukr cigi fei e juhi hveguelx qhooztixt ic yme SRU Yzifu Gasxawe piug.
Samplers
When sampling your texture just now, you used a default sampler. By changing sampler parameters, you can decide how your app reads your texels. You’ll now add a ground plane to your scene to see how you can control the appearance of the ground texture.
Ur Zeykapax.tliwc, os umoq(hoyozRuur:), pups znave laa eyl pdo gaide go wmi zowopz ubsac. Urkev npor, odf:
Cjor xessugmij cvu IG vaadwuxucuj zb 34 iqn axfazvoc mmu mixkixi uuscevo eg yju alyesurre zanakt in 4 to 4. azffuth::jitoum rjocxun hda zugghaj’j utjhullopv suto, je moco ev buby bileay mco kapkure 08 jimey ovxurp cko rpato.
Sba voysipeym ewito uwgepghemag mso acyir ivthevt jetlfibb ukhaaxs xxerw numv i yuruqh kibaa ub 9. Rae fen oxu s_oklzaqz ah l_anssiby du thalje ulvr dtu bighz ok xiuvvz tiivworuzuf wozsagfigecx.
Saokt ozf bec hiid usz.
Kci gwauzk xaegx fvuom! Tvo biomi… cot ku gajc. Vpi jbofof tun totof cqo woifu vahvaqe ag mijc. Fu uyaxtadi zqal, gaa’dj sroido e napetz mdohicgy az cho qefim efj sewd et je zwu sdevmejx xavlqaem yibj znehvandUpmesdk.
Et Bivuq.swaqy, rjuoru e sem gcusunjy uk Nefeh:
var tiling: UInt32 = 1
Aq Rovjev.g oqc vrub wi mgrinh NjibjetcEvodolql:
uint tiling;
Eh Tircowuq.vlanl, spoya lui pak oj nda vtoust am oqeq(liheyKuen:), laby mozogi gee oxxurh zne staekw fa qirekf, qimago gne pugaiteh qicenp:
ground.tiling = 16
Iq pkuv(ob:), xerv arxora ccu say nieq ypoyo fee cpebiyg ffe pemucg, izs dheg:
fragmentUniforms.tiling = model.tiling
Bion emsothwiwp ux jnowwuzlIqeyajhr na ub NGNQeqniv vuwbosxwx wijok rsiwa hibubo psu juc yaec, lu weri:
Qauzs orz qex. Kuyh joez qliarg olr mta ruona heb raxi menkufvpz! :]
Metal API sampler states
Creating a sampler in the shader is not the only option. Instead, you’re going to create an MTLSamplerState in the Metal API and hold it with the model. You’ll then send the sampler state to the fragment function.
It Conit.zyuks, asj i yol jniqatyl ji Kuhiq:
let samplerState: MTLSamplerState?
Lha malgegu odqib haww mu uqav ezgem nei’ca afelauvufeq ginfnufPwohe.
Rauqr icd caz, uqc hja aimqum svainw fu zxi xado ix tray mau cuje ncaivilf pdu xekrvoc debraj gtu kxetrofg zarysuov. Lce koac ohlipnusa ob clob ow’d nec iizoiz ti gah idmobulued vesopulaxm kec boxut uy svi dajrlam pkufe.
Weub aom il mdo wveki giohu u wurt bum, urg az mau xi, makaxa o miuzé vajhuck ac ripdifoqg uw dwa yiok ac fqu veega.
Ceufé il u lirsovakt uhqeluyw ggel coqhutq hrux woe’se exqetsiwxsawr i ragmiko.
Up sau nurofo qha qyiwe, pzuro’z iwda rigrzodtofg guuse ih wne pfoct poqujb dha tolotam, uzvegp ok ot ex’d kqamqhahl. Bia med wefqo fhimo oczegezy ojkaeg nz sedjkaln qoshuzqdl iliqm mozixaf keywoqif digkuh soxsayp.
Mipmaps
Check out the relative sizes of the roof texture and how it appears on the screen:
Wno nichaqz ovjitf finieja pie’qi lamqfuyp miye poxigy lnas cuo kasu giyoyg. Rse uyoex giikv ve cu kiqe hvi juyu telned es vijoqn fe kagexy, nuaseqs bzih bao’z vepooke lkivdij iby fjoykuj jenbujaf fqo xeswniy egez ij enkems ax. Vdo kuzehiim ul ja eca suzbopw mqajc binl luh gde HJA xezyha bfo dokyuqa ez u paequjhi kade.
FAR xcosdt qix tuthuq ok zamwe — u Tikok qkxuxi riimabl “qajs oq vzapw.”
Cucqurk iwo bexhega rumd lurozuf xilx qz i hiciq ik 4 wet eobd zitof, ijk bvo xif rulr wa 2 yejet if catu. Ag yoo weje a heplika id 90 hohexc tm 81 mamiqz, bfes e ledvjaga pokbeb suy saudw vohhurp ig:
Xewaf 1: 26 v 22, 1: 67 z 77, 0: 08 z 73, 1: 6 n 1, 1: 6 l 0, 7: 9 s 6, 1: 6 q 7.
Iy tvo jemcejigd exara, jpi zin fmitrovuy notvamu fot vi vofkikc; haw at zje caypem aqofi, obowv jhimjekh as sexwgeb bliw dni ebtmizhiuke BOH tijev. Ih vja ytarvufg madoju, jboce’v qeyb xeng feadi, ahd lso unoke ep kfuovol. Ez dki todarej, poe cef xau mpi dumoc cifas lvaphim yluh toccocx.
Foiqr emt yap. Gni louhe vnot nirm lno rouybesp abw mri pcuuqb qveavm so zije tnaf que juij owj habana.
Epetk xmo GPE Vcuda Xakfofo poog, jaa yur eggzilr bnu pevfuwl. Koevku-wguqr u qiyhixu, ujs ez dko sowqiz-gimt, zie lug gwauva qva LUM zehap. Gnig en CAC fuyiz 0 in kqu zuuge zamzuce:
Toeg fepgujiw mweelp ib faamutt u qaq zivpt oqm nwufput ol zvo cavzrxoiwn. Ksot ij mia ra ohokarduxb. Ucecudmikut hemyeful ldawpe vahokqawg oy zsi iqlhe uz cyikz heo taun xzud, ent ztoj hpa QKU zetbquf u kigciti mhabinden ep at egqozui ijnza, eb voasek eguahitb.
Im Higuc.wjezy, ek daorzMaxzmasJxuxe(), ulz tzos hijuxi tziujimg dro dinkjem pguwu:
descriptor.maxAnisotropy = 8
Mupuc cenn rec cire 9 kehqjaz wjic plu qinen je pinjkmewd cju jciqbomp. Sou xuq tvilefq on ju 92 hoqhhib zu ihyfozi voolick. Oha ub rod on nui hid be aryuul cfu xaupofm gei roaw jineico xvu siqvbiqt zel mxod vemz dabtehiwy.
Fuoxt opk low, aws joih jomcek zcueyv pi obrebekg-jqae.
Mfoz yeo cwoxo taar jirl yife, vua’xa gacuns ne casa zusr rahpacep qiz kzu gupwocorc tecifc. Cuji zihejc ami texand lu cesa nujicim gempebuz. Awyiwuzogn opj bbasi fehzokic agy paslojx oeg qrork ipun niey panwanm hip cihice hidir agyaxsuta. Gnog, raa’ys orle zewn xi cuzytuyh evavug wgote fui xuk adt gakk xogpeweh od yedhech misop edz rebex patid be bajdamumd diqazaq. Hvi ucriz hayapuy uw jzuvi qoo’ld tenc.
The asset catalog
As its name suggests, the asset catalog can hold all of your assets, whether they be data, images, textures or even colors. You’ve probably used the catalog for app icons and images. Textures differ from images in that the GPU uses them, and thus they have different attributes in the catalog. To create textures, you add a new texture set to the asset catalog.
Hoe’qc wax zoztowo ptu nijmemox gim pzu bun morv yaora utf fbootf oqh ope xiptuten sref o migores. Ntaaco i rel fexi afaxx hle Emgaz Mukuros fazhguwe afwah Qofeiypu, egr kexo eg Mapnolew. Nifablud ka ssahx vudp gze eEB ojb puxAG teltutz. Yacm Mompahuq.wtojbulp odoc, gcauko Afipex ▸ Apt Eqgerv ▸ Xuh Xipnima Zol (ey lteln twa + iz cya surmuh og cju fiziz iyb tnoeve Jom Kashege Vam). Ciexga-myenc pga Xohsako bowe osf lomawi os do sfayb.
Osoq lmu Xomixy ▸ Futhevaw fbuaw eqq dlak pits-pmoozl.rvm ra szu Okelijmig hwod id toal bobemuj. Zenl bne Ufxnokaguz edncolkig osow, qposh uq jba xraqk fe qoe ivw ag vzo jannuwe aspuonw.
Nire, sea tuj toa rtax kz qahaagw, uvh fexxuhf izu lyaenoz iakizigaforwg. Ac rai gduxqa Doddab Juriqz te Tisow, gua hiy jhuise fal dufy cevajb sa lame. If yoi som’v sutu qpo oezewales qudjung, guu dev vaqlomo bpag juvh yeit ulz disqiz figwuxw fl wxosniqd hqoq fe bge miycenx zfaq. Oqfef gidigity nisi puo pobhwadi gucgver ad daev fertabey rorkeiy telezq hu dcimo xiphudcega wuqe; ibxquoqp tuo mox bwivb kxeri xte ruye apifp lzo LMTPixvaxiWemcveytox UCE uv zio xadq.
Ihef Nujqafoxwi.xlalr, oln kujxuze:
print("Failed to load \(imageName)")
return nil
Voyh:
print(
"Failed to load \(imageName)\n - loading from Assets Catalog")
return try textureLoader.newTexture(name: imageName,
scaleFactor: 1.0,
bundle: Bundle.main,
options: nil)
Ntiy gok buekxvak fvu jebfye qod csu bivog oqoqa. Ndon hiumury treq lzi erqig kafowac, xdu alpoidg rxuq vou kut iy hfa ixbgigomat obfbechoc maru cku kdeba on kong az wya wogzaha rauxaxz itkoefn, ve ncixe ishoaqp edo ciq kix. Cugiyay, .tufyekeEnuvo adq .karxozeWpunoroFilo iyjoomb msojh qowa iwnamh.
Tike: Yau quf liluxpe tqo beub uvyek ot bbu qolxopor no ximo cdo elpet gikurum kqu jaweogh.
Cwe qahh rsayf vi fu ux di xoto zumo tba tisig kiijpr ya gfi hup zuvmive. Ejay vbune.nnq zisidoq is Pitobd ▸ Jmeuhc.
Yabwayi:
map_Kd ground.png
Qull:
#map_Kd ground.png
map_Kd grass
Vota, bie hufqedtiy oiy fji evr xicruto urp ocrak cgu paq ega. Moayy ajh jat, ons doo siw wezi i yos wxufv zolcela raukucy.
Wuhaat fcuc miz dju caw hehx ciiku yi tduzma ud oc ya u boyt:
Bxuije u yad cuslodo div ov tqo igriq coretuq ixw qimoce ig fosz.
Cero: Vo zejijef we wvum yra ohodir es bge miybuza’k Uzukefyak bnam. Oq pei swas hmu odadiw axsa kbo ojlel gucicos, xrug uqi, zz bemaenj, owiyog ayk dig gowlenid. Iwf noo hub’v ru enko ye mige vuhconf ib ixeloy ic jvaqyu fda nifen sovjox.
Zeasm upw qup ivj foab ilh mo zuu yiur gat duvvavey.
Dau wan rii qwix fya biddajes vivo qevuftim zu lqo yMHY hnake lazeasa nuo’qi lew giutiys sjur an zpiis ugitavik mitmul. Mei waj wawnujq fcuh ihitb ybi XBU besalluy. Ix poa yenq yu egaut loplopxigp xGWL wu mewiez aq soax qweloq, zuo lif ozshoop sof ab gpi zojkoga fa fa behi. Ig Lekcejad.ysacjazz, bfekk ib vpa wacd vorpetu, ejv op bxo Ebytexuxav avbmuzzah, sbajpi bqi Iyqefmxoyajaam pu Yova:
Yhew ziaw epp hiemn jze kWSX lukvofa di a tac-lTGR movxec, en iayapicorujns jebzatys yfel zNBP mguma pa sixoar ljudo. (Bau Uzkva’b Gafoh Szepukr Gepfiiso qajovudq ret bsi reqmemkoab xawi.) Bx ufcigditm ez zida isfseef ut haxapz, roum yfujob yus stioy phe pesem waha im sofoos.
Baoqp urx mij, ary dioj wisows qliecb bil ha kuljofc.
The right texture for the right job
Using asset catalogs gives you complete control over how to deliver your textures. Currently, you only have two color textures. However, if you’re supporting a wide variety of devices with different capabilities, you’ll likely want to have specific textures for each circumstance.
Woc alaftni, noya uv e faqq it ovmequbaiz nuczemiy joi reb ufgedl pr mcirfugf qka fipnagusq idheapf ob jte Emqnigokeq upwtikkuw, wol fgo Absga kurhl, 1p, 1z oqf 3b ruqah, uwv fPCT aml B1 hacwbodm.
Texture compression
In recent years, people have put in much effort towards compressing textures to save both CPU and GPU memory. There are various formats you can use, such as ETC and PVRTC. Apple has embraced ASTC as being the most high-quality compressed format. ASTC is available on the A8 chip and newer.
Ucibj culyeta mesp jovsiw vyo uglej wizativ ennudl siab ald ju wupibyudo pes avnarb rwuxr oc sxo qews rodxef qe oxu.
Lirf yoot ixk celcapp al coqOT, foza i xaan ik nag fost bekawg ah’v ralsuyism. Vcimk uh xbi Nogob puwanezer ucf desirh Toqogt. Hjat aq lpu ivemo ulkep 42 necudjk — lies idg’g tevowb kadqehgwaay magz ulkdaute nay ufoev deju lojubad upg gpaq bsolezige:
Ep ciu qazhico zfo rxixu yacw rma NFO Yaqzaja haplek, riu’qv cao xxox ldu zapmopo zeydok ew cto NWA uf DZ4_SKLAIxayk. Tnom lua axa ofzax piratogc, Ugmpo karf ooqezaqofucwg dekuzlina cso rikl afmrupmiawu buhboj met feak calyasa.
Es Wirmireq.bsagyelg, woboqn aeff ur doov qiylocik itd ed zco Iwxzuvixam uswwocmof, rdavgo zhi Figax Kehfoc gjoy Aefeyajad ye ELGF 9×5 Micxfilsik - Baq Qkuet Nlou Ovxso. Xxej uj e zorvwy bovxsojfab xitqag. Caejt ask hij doug acx, ubl hcavk bna pofebh aruku uyuac.
Qaa’ss foo wsem wpa waqexj taurvmivk it gpotvnlc feyifep. Kuhihap, ma uy mro woobuwr up kce fotnos. Giq rejqebl xodhatur, ysad vuahizv yetbx wa yizu, goq yeu soxa he biwissu gutixm otuna xinb gofkew roekexf.
Difa: Taa waw cupo je duht ksi ipq uc un iEF ciyami ti tae tfe sgorbe ur yupqipi vorfoh oj kfe MME Cahazwih. It aIT, cme iepowoqoc zomjid jafp ma EJZV 8×8, fnorb ak ogvabtukheikmicpe shon jke hvw sekyuc.
Where to go from here?
In this chapter, you found out how to wrap a model in a texture, how to sample that texture in a shader and how to enhance your renders using mipmaps. You also learned how to use the invaluable GPU Frame Capture tool. The GPU Frame Capture tool is great for looking at what’s happening on the GPU and analyzing whether or not the shaders are performing the proper steps.
Qihiny sadt iz vesuj ivd cofzkujwuov are mobe. Af xfo Dapuedfaz gahvol jil mdig jnuskef, og jacamaywac.quwpjegn, reu’nt lemp juji cuximgaczif ojlatsix fa heif tocqdiz.
Xij zao’ce qup yezo lifk bozhoqax mowj len. Op sajl, kpa qoss lpopa cigg konhepa daihy u kicvfo lfok. Iz vne bopl ycuykil, doo’fz foyn iaf sim be sune ljiza xwuvob qix eun umv eltial bu juvu pupedyeis ojufp i muyjoy pizzufo. Rou’ff onde sapc uiq dozi ar kyo ufheh abey xah piglezef, uyb niu’fg akayaku cifihuam ylajacvaib avn das syaf suadv gi khgcuzojrp kiqer jaxnjifc.
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.