GCAP 2018: Optimising Graphics for Mobile Devices in Unity

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
good morning and welcome to my talk on optimizing graphics for mobile devices E&T my name is Brian and I'm part of the knot Doppler team so I went a bit slide crazy today so we might play a little game called deal 100 slides in 50 minutes but they're they're pretty short each but I might ramble so maybe someone should just throw something at me so today's focus will be on our game crash a car so it was our first in-house game and it's had more than 25 million downloads I'm pretty sure right there so I think it's a pretty good case study because it's been on so many different devices so before we start I'm just gonna play a short trailer everyone likes that wake you up a bit hopefully there's audio I don't know it might be a silent trailer I think it is so maybe I talk over it since there's no audio says the multiplayer cart battle game she worked on it for about a year pretty small team and only started off with one artist and one programmer now where I think we have five programmers on now so if you have time please download it on Android or iOS and just give us your opinion and feedback you'll probably see some guys walking around the crash of cars t-shirts so talk with them please so quickly about me I'm from the States if you can probably tell by my accent but now I live in Sydney and I've been programming for about ten years on a bunch of different platforms and I was the first person on the Chrysler cars team since its inception and kind of like a self-taught graphics programmer so enough about me so what are you gonna cover today so we are going to cover really script-based things like garbage collection or analyzing spikes and profilers I'm just gonna kind of focus on more like GPU related stuff like reducing vertex Cao and Phil right so those are kind of your two enemies on mobile devices so yep let's get into it use the obligatory contents which I'll just read directly absolution terrain shading how he shaded to get the game's levels how we did shadows and something called immediate drawing which is a technique we use for two things called blob shadows and reducing some you GUI overdraw and vertices and another quick UI producing a new UI feel right bit on car shaders and profiling Xcode there's one more section where it's a bunch of experiments I did if we have time we'll go into that but I don't know if people have questions I might just skip over okay that was in transition and first faith let's go Kirsti no presentation so the Train shader is very very minimal right it's a CG shader which and it's not a surface shader and lighting as you know it's mostly done in vertex shader we only support one directional light plus a shadow map and only four types of terrain textures types as I mean like grass rock sand and stuff so this is pretty much how all terrain shaders work basic ones so we just cut everything down to a bare minimum so just if you don't know exactly how it works this is kind of the breakdown we have a splat map spotting that basically tells where texture goes depending on what color is like red is grass green is rocks and alpha channel is kind of bricks then we have a shadow map so this is a bit different from a light map so Mountain some of you might think oh we just make a light map but it's actually the shadow map isn't UV map it's actually projected down onto the terrain so it's a little bit different from a light map so we combine those two and we get that kind of result right there yes so kind of going into UV mappings I think UV mapping is probably the trickiest thing to do on terrains so often what people use is something called a tri planar shading so tri planar shading is basically kind of box mapping if if your artists so you're taking one texture and sampling it three times for each plane that X ed YX and y is that plane then you combine all those three samples by the normal of the surface so you can see on a sphere right there all those colors represent one plane like that so it's a really good technique maybe pick on the console or PC but it requires three texture samples for every kind of unique texture so I think that was a bit too much for our game because we have four different types of terrain textures and if we did try plan our shading that would be 12 that's including excluding things like the splat mat and the shadow map so you're doing 14 texture samples which are assuming is not good and also we'll also get into a bit later but it's not only the complexity of a shader but how much it covers the screen so we kind of thought our gains primarily a 2.5 D game in a sense that it is 3d but height isn't that important in our game so the most I guess dominant plane or the important texture plane is the XZ plane right so we just took a single plane it's a nice gift animation and so we're just taking one texture sample we're just taking the XZ plane but of course this has it like a bit of a disadvantage because what's going to happen is you're gonna have stretching on kind of the y axes or any kind of steep slopes or walls so we did the simplest thing we just covered it out with geometry like that so I don't know if you can see exactly but you can see kind of the stretching right there it might not be that visible on there but it works quite well right it's it's a limitation but you have to understand that you have good artists we have very good artists and you have to leverage that because often they'll come up with creative ideas so give them less at the start and then they don't actually know you can actually do more for them and just let them handle it for a while and you'll see what they come up with basically and this is a result this is quite pretty and you can see primarily the main part of the map is just using that terrain shader and you can see the walls it's just using different types of geometry right there so that was just a quick blurb of how we did the terrain shader so now I'll go into a bit of the shadows okay there you go so shadow types are we have three types of shadow types and so the first one is dynamic dynamic objects and this is as unities built-in shaders so if you want to sample shadows from unity you use a macro called light attenuation and you do a bit of setup in the vertex shader and they'll give you back a shadow then we have static objects which was basically that shadow map we baked in to blender so this is just a quick way to optimize things bake static stuff into the shadow map then dynamic do anything to render the dynamic shadows and a third type I'll talk to you a bit later so if you want them to blend seamlessly all you have to do really is multiply so if you multiply those two values together they'll blend like that so it's really hard to tell you can tell the big shadow Maps of course a bit softer and the real-time shadow Maps they're more crisp like that but most people won't notice like this standard mobile game player no offense to any oh sorry and so we also do a smooth step so smooth step is i think it's a hermite curve or some kind of curve and you use that with a little blend factor you can actually control a slider to make the baked shadows a bit sharp or smoother so if you want to kind of make everything sharp you can use a smooth step function or make it a bit blurry you can use lower factor like that this is just a nice trick so now here comes a bit of what we did with a trick we do with the baked shadows so I mentioned before the shadows are kind of a tought help top-down projection and without actually UV mapped so the terrain has no UV data and inside of our shadow map you only contain shadow unlike a light map which might contain like lighting and bounce light and stuff so we can actually reuse this kind of for dynamic objects so all we have to do for any dynamic object we just get the void space position of it the XZ of it and we just sampled that same shadow map so at first we thought oh this isn't gonna work it'll look like junk but you see it looks pretty well works pretty well like that and just if you don't understand it exactly I'll show you example right here whites I call it 2.5 D shadows so you see the limo cast shadows I would get shadow Bercy shots but when we lift it up it doesn't actually come out of the shadow because it's just a top down projected shadow but most people don't actually know this and another thing we do is well we don't actually use it much but we have a green channel that can mask out that kind of shadow so this is a combined result so if you're just playing the game you won't really notice those kind of artifacts because we have smoothly blended shadows and the hot dog car my favorite car receiving shadows like that so the fast way to do kind of baked shadows and receive and also having hot dog cars receive shadows yeah so another trick I guess for artists is just low shadow poly shadow proxies right here so you can see the car itself doesn't cast any shadows but we use a low polygon model to actually be the shadow caster and unity has made this really easy because you can just talk long shadows only yeah that's about it just tell your artist to do that I'm sure they like making that stuff like LEDs so basically I always just make what you can both into light map and if you can bake some kind of representation of not only the light map but the shadow data then you can optimize performance a lot so even if your game is not 2d you can also do 3d shadow maps by baking and storing the shadow map of the light cast I might go into a bit later but it's kind of the similar similar method and if you use kind of a top-down game just give that a go and see if that projected shado actually works for you yep then something called immediate drying I change the style like three times but I think this is the best one so one of the things like when you render to render texture is you often use like a camera and drag a render texture to it but there's actually a different way to render to ever enter texture using not using a camera or not using graphics up but also not when not waiting for the render loop so I just continent call this immediate drawing so there are two functions you can use in unity that draw immediately one is the GL class and the graphics drama mission now so if your OpenGL programmer GL might be familiar to you it's just basically a way to draw excuse-me vertices and you've ease directly by defining points and UV coordinates and kind of setting render States so it's like a low-level well what says right there low-level graphics library and when you render using GL renders immediately you don't have to wait for unity to go into its render loop and wait for it to render everything and batch everything same with graphics drawing mesh now so if you use graphics draw mesh then graphics drama is now is a bit similar but it renders immediately so what you can do basically to render into a texture all you have to do is you just set your render target to the render texture clear it push your matric your matrix basically means saving your old projection matrix then you load a matrix in this case I use load ortho so I'm loading orthographic matrix but you can load a perspective matrix and they have a special matrix called pixel matrix which is kind of a nice way for one-to-one relationship for a unit to one pixel then inside there you draw all your geo commands or your graphic star mesh and voila you have a way to draw to a regular texture without using cameras and without using game objects so that's why I like this a lot so there's whenever you use a camera there's always a bit of overhead things like culling and I think unity also determines what lights are affecting certain meshes so I think this is a really good efficient you know it's also a compact way to draw these kind of textures so it's not used primarily for rendering meshes but think of it as a way as how you say like a ghetto procedural texture yeah so what can you kind of deal with this so here's one example you can render a sine curve so exact same code before but just what's in the middle so for every single point on the side and curve I just draw four vertices using geo vertex and just loop through how many ever you want and draws that sine curve right there so that's like one kind of procedural texture and so here are some more examples like the sine curve then I also drew a star field like that and it's quite efficient because if you think about you're taking out everything like transform that position and all the game object overhead so this right here I actually rendered sixteen thousand little pixel stars at a frame rate of a hundred forty-seven frames just using that immediate drawing so it's it's a fun thing you can test out and do a lot of cool things with so now I'm gonna go over a few of the use cases for it one is black shadows in our game so this is a third type of blob not the third type of shadow we use so why not use a projector well if you use a projector everything that projects on renders twice so let's say you have a little cube with a blob shadow projector then it hovers over a terrain face and then suddenly you're rendering that entire terrain piece twice so I think you have to be really careful with projectors when you use them especially what matches they go over why not use a shadow cloth well that works but they never really never kind of perfectly aligned to the terrain and you often have to do things like physics raycast to find a normal inline mesh so what we did basically is we just created another regular texture and this maps to the terrain similar or exactly the same as what the projected shadow mat does then for each dynamic object we just pass in the position and we rendered GL quads to it so here's low breakdown so that's the shadow map the baked one then we create another render texture and for each dynamic object we just do GL quads so technically we can render a heap of things like five thousand different little blob shadows all over and I think the performance overhead when to be that bad yeah then what we do we just blend it back with the baked shadow map then voila we have hot dog car with blob shadow so you can see on the bottom right there so we do this for lower end GPUs because we don't want to render native Unity shadows yeah and once again no camera needed no game objects so you have if you have more game objects coming in you don't have to create a new game object save a list of them you know all that pain so now I'm going to talk to you a bit about catching you GUI text so there are cases like usually what we do is we x' text mr. pro but we can't always use in that case so in our game we have little score indicator so you can plate your username right above it and the issue is so we support 14 languages everyone plays our game all over the world right so usually we wanted to use a nice plugin like text mesh because that gives you nice outlines using scientific fields but we can't always because what the requirement of text much pro is that you have to pre generate a faultless before you actually use it so you have to know every single character that's used in your game before you can actually use text message Pro so that's a problem so sometimes you have to resort to using like plain old Unity text because it supports dynamic fonts yeah so fonts don't look too good on you go eat compared to text message Pro so for example let's just get some lorem ipsum right here and we let's put it down and you can see it's not too bad 468 tries and not 936 verts so what's one common effect is just like the outline or the shadow right so what do you think will happen if we just add outline as Shadow so we're at 468 tries and well let's say 500 tries and thousand Birds BAM 4.6 K then we jumped up to thirteen point nine cavers this is a huge job just for adding those outlines so if you can go back here so imagine if you added another outline effect over there then you beep just rendering something like 30,000 Birds for that paragraph of lorem ipsum which you do not want to do so the reason why is what GUI does is just basically right there's the text four times for each outline which is I don't know idea but like that's how it is so it's not only vertex issue it's also a fill rate issue because you're rendering that text which is a transparent quad four or five times so what's the easiest solution okay so user names don't change in the middle of a game no one's gonna stop playing the game we don't want the player to put in their name while they're driving and stuff right so we can just draw directly to it sure so and can we use the same method we did before using that immediate drawing so in order to do that we need the UVs and the vertices so how do we get UVs and vertices from unity text so there's a magical class called text generator I didn't know about this and maybe very happy when I found it so it basically does what I wanted to do so what you can do here in the code this is some sample code I'm not sure if it'll compile so don't try to do it you can grab some source text like that's a standard eat GUI text and you can get something called generation settings so this is all kind of styling of the font then you create a new text generator object and you call populate with whatever text you want along with those settings then what will happen next is you can pass in a list of something called UI vertex and you pass that into text generator get vertices and this will return all the vertices all the UVs everything you need to render the text so now you have a way to get vertices and you v's to render text so we have those then we can just draw it directly again so that's the code right there but all we're doing is just taking all that data from UI vertex and rendering the intro texture so now we have a nice way to render text directly into the texture in case and that made me very happy yeah so that's a result now it's only one single transparent quad so what we also did when we baked it it was we just render it eight times around the center to generate a nice outline like that and another bonus of that is we get to do any kind of texture base and shader effects to it yeah so it's pretty good and we also optimize it by just creating a pool of rendered textures so we just have one function that says render text render text to texture and it returns back one of those render textures to the pool so I think it's a pretty culture so if you yeah your game is very text heavy and you maybe it's like an RPG game and you have stats on the side and stuff you can still probably use it because you will probably only need to update those stats like every 10 seconds or something like that so here's another quick fill weight trick we did so when you look at games kind of like clash of clans and candy crush like they have a lot of these pop ups here and they're basically just a pop up that's a rounded box and stuff so you can kind of break them up into different sections like you have the outline which is always transparent and you have the middle which is an opaque fill you combine those together and you get your rounded box I know there are more different variations but I think a lot of games to see is that so what you can do as a quick trick is just get the built in shaders from Unity pop them open take out 0 and take out blending so your middle part now writes to the Z buffer sorry Zed buffer and so anything that renders behind it will be discarded because it's writing to ziba said box so I did a test iPhone 5s ten full-screen pop-ups and we can see it went from three point three five milliseconds down to 0.9 milliseconds so I think it the results will be actually a lot better on things like iPad 3 so don't be afraid to modify UI default shaders because you don't know what unity is sticking in there because unity usually gives you everything inside of the shader and often features you don't need I think it's a lot better now because the older versions the unity I think masking operations used to be applied to every single shader even though you weren't using a mask so if you are using an older version of unity just pop open that shader version and make sure it's not using a clip mask function everywhere and yep and if you want to test DUI stuff I recommend always doing it on tablets because those will kill your fill rate and use the iPad 3 car shaders I skip the animation that's okay so just quick blur about our shaders 90% of shaders were all custom we didn't use the standard shader and mostly non surface shaders a few times we did and so the breakdown is we just kept it simple like what we did was vertex shader do the specular in vertex then we have ambient gradient in the vertex shader we calculate and finally the albedo so it's you'll probably hear this quite a lot and I think you'll probably hear a lot later on if you go to optimization talks but this is pretty much like the best way to optimize your shaders just put everything into your vertex shader including post effects if you do any kind of UV coordinate calculations if you can do it in the vertex shader do it there so we have these higher tier cars they're calling second-generation cars and they're a bit shinier you can see move so to get this shiny effect we actually use Q max we use the old-school spherical vital environmental maps or matte caps so old-school technique and it's pretty fast and I think one of the good things about it it's easy to author so if you don't know what WYSIWYG is it's what you see is what you get so you only have one texture mapping pretty much tell when you try to draw the texture map how I look on actual surface itself you can see it's um you can create quite different materials like gold silver and a plastic on the side and it works well with normal maps and less storage and cube maps of course cube maps take six images versus these matte caps which is just one so i'm yeah toy artist to try they might like it more than cute maps so another thing you might have heard it before is about shader features so you can see that's our car shader down there and you have a lot of tick boxes there so it's a great way to expose certain features that you can tick on and off to the artists so sometimes to be they might not need per pixel specular they should never need that but ambient light and so on so basically how you do this is you just add a shader feature pragma into your shader then you add a little toggle option to your shader inspector it's all in a unity Docs pretty straightforward so the thing you have to be careful what is that every time you add a shader feature it creates lots of different permutations or variations and things so one shader can increase the number of shaders variations of that shader by twice or three times so you have to be kind of careful it so you need to make sure you check that so how do you check that so click your shader inspector and click that little arrow near compile and show code and the bottom you'll see how many variants are included so this is for the current build platform but you can actually select other platforms and we'll show you how many variants are included so that means for that one shader it's made 48 different types of shaders 4 which is law I think the standard shader has something in the thousands or so so what you want to do is kind of check what is actually being included in there so what you can do is you can hit the show button right here and it will actually build out a list of every single variant use of the shader so there are a lot of things that unity actually includes that you probably don't need like it'll include variants for certain fogs and also include variants for like point like cookies spotlight cookies and directional light cookies so often if you don't use those things you can take them out so use pragmas skip variants so the one below there is what we use in our game so we actually take out a lot when we surface shaders I know I think that's actually repeated a bit but it's it's pretty big them out so be careful when you make a surface shader because the standard surface shader itself when you create a new custom one actually makes 53 different variants and this can add up it 2 megabytes of data and also unity often compiles I think shaders runtime and it could cause some lag and issues so maybe you sometimes when you're playing a game when a prefab instantiates you might get that little jerk that sometimes is actually the shader loading in and use shader features so there are two things shader feature and multi compile the good thing about shader feature is that if there is not a material that uses that feature in your project unity will strip that out so doing stuff at vertex shaders is still good but remember that shader complexity just don't look at the code always consider how much of the screen it's actually taking up so think of as pixels rendered time shader operations so you can actually have something that's only renders one or two pixels that could be a super complex shader but won't really affect your frame rate so just really take that into mind yeah so now we're gonna talk about shader profiling in Xcode so I was thinking about doing a live version of this but you would probably have to wait five minutes for its or ten minutes for it to compile each time so why not use a unity Pro use a unity Pro file well often when you're on Mac when you open it up it just says not supported but I wouldn't blame unity because I think it's actual bug with the actual OS and it doesn't reflect your actual hardware so if you profile GPU stuff inside your game you're profiling the GPU that's on your laptop not the actual device itself and it doesn't give you much detail it's more just about what overheads are happening in the script so you if you will really really want to get down to it you have to use Xcode profiler so basically what you do is open Xcode then you run your game and once it starts going and you want to find a place that's like a hot spot when you're playing you click that little camera icon on the bot on the bottom and it's going to capture the GPU frame so if you're if you're profiling older devices like OpenGL es2 and stuff like that I think the new versions of Xcode don't let you do that so you might have to get older version so OpenGL es2 is like devices like iPhone 5s iPad 3 and things like that so click that icon they get a lot of things so I'll try to go over each of these bits and take you through profiling a shader so on the left side is your kind of command buffer so these are all the things operations that are being sent to your GPU things like draw these vertices set render States clear stencil buffer so just the commands that are being fed into your GPU the the other side is some screen buffers so this actually represents everything from the start to what you currently clicked on and I know show what's rendered up until that point right there nici debug other things like depth buffer and stencil then finally in the middle is what resources are used by the vertex and fragment shader for that current command so it can be what actual position data is there the actual vertex shader so you actually click in there and look at individual points but I guess you wouldn't do that much then the fragment shader what textures are being used actual fragment shader and Southwest Aysen and that stuff so kind of those points of command buffer screen buffer and vertex and fragment shader resources so what you're gonna do is once you open that up you're gonna kind of go to your scroll up to your top left and you'll see something called fps and if you click that it'll give you a really nice view of every single shader that's being used for that current capture and how much how many milliseconds that it's going to be they are using right there so you can see we have two heavy ones hidden lit copy and the terrain shader so we're gonna kind of ignore a bit blit copy because what that is is just a full-screen copy of your screen buffer we use this to record like gifts in the game like replay stuff so there's not much you can do to actually optimize this because any kind of full screen copy especially on Android 2 is going to be expensive so kind of consider if you have a gift recording feature in your game you could actually be dropping the frame rate quite a bit so what we did in crash a car is finally we add just added a toggle so it can see toggle on and off so we'll just kind of look at the terrain shader right here so we can see it's using 26.5% of the GPU resource is right here so what we can do is we can click it open open and we can actually see the commands that are being used by that shader and then we can see if we go to the bottom command number two one one is using 23.3% so it's using most more of that shader than these other commands right here so what we're gonna do is just kind of investigate right and what we can do is go back to that list right there and find 2 1 1 so we kind of want to happen and see what happens also between 210 and 211 it's a good way to kind of visually debug and see what's happening between those two commands and what's actually being drawn so we can actually go back to that screen buffer there we're just going to toggle between 210 and 211 so you see why it's actually doing oh yeah I know it's upside down too and what we're doing actually is drawing that entire terrain piece so remember I mentioned before it's not only shader complexity but how much it covers of your screen so just keep that in mind too so now we click on two-on-one and okay that's why I just explained but so how do we kind of analyze this right let's go back to that resources section again and we're gonna look at the fragment shader so inside your resources under fragment resources there's always something called Excel atm TL main that's going to be your fragment shader and if you double click that that will open up the actual code so this isn't a code you wrote inside of unity this is what unity translated into I think this metal right now but you can still kind of debug it because all shader code is a bit I mean it's not all same but you can if you know cg shaders and surface is you can kind of decipher what it's showing right there so what a handy thing it does you can see in a red box that gives you percentages so actually profiles each of those lines of code so we see our hearts hotspot right here that's using 13-point 13% so what I usually do when I do bug shaders is I just take the line out or I set it to a constant so let's take that line and we just we'll take it out and set it to 1 so what the cool thing about Xcode is once we modify the shader we can actually reload it by hitting that button right there so what it's gonna do is take that modified code and repro file that frame so we just go back and click on the FPS icon again then you'll have two different bars so you have your baseline which is what it was previously and your modified results right there so you can see by taking that line out we've gone from one point nine six milliseconds to one point five five milliseconds the great thing about this is you can keep iterating over and over so if you want to change something elsea go back to that command and you click on the shader and modify another line and stuff so this is great because you don't have to go back into the NT modify the shader wait for five minutes or 10 minutes then run the game again in profile keep doing this over and over and over and I think it will save you a lot of time and it gets you very close to the hardware yeah profiling your heart faster iteration and you know cargo area but you also have to realize that you kind of think that Xcode is not just a way to get your product into IP a file there's lots of tools on it like profiling because I'm lazy like I'll even go in and you can modify the IO to CPP code and actually we run the build so you can do quite a lot in Xcode because all it does is generate C C++ code at it and that C++ code can be modified so that will lead you to faster iteration times and when you're on a tight deadline and you want to recompile everything you can modify the C++ code and build it so it's a lifesaver sometimes so explore Xcode and explore the instrument tools on it so would you rather do questions or experiments who wants to do questions anyone have questions that were okay I'll just go over experiments in dqa after so I talked to you about a bit about K shadows out and I'll talk to you how we can do kind of real-time soft shadows so K shadow map is pretty simple so all light does basically is generate a death buffer from the viewport of the light that we use that render shadows onto objects so a simple optimization is just don't render that depth map over and over save it to a texture and sample it then you don't have to rerender any static stuff so one thing with shadow maps on mobile devices I think metal has some features for this but it's hard to do real-time self shadows so real-time soft shadows can be things like PCF and PC ESS the PCF percentage closed filter is basically a way to simulate soft shadows by sampling a bunch of shadows around a specific point than averaging them similarly is P CSS but it actually gives more of a better penumbra which is that kind of soft outline on your shadows did turn depending on the distance from the object so a basic PCF shadow requires you to sample a shadow map nine times which is quite a lot and it's way too slow for mobile devices so that's that's the issue is that shadow maps are not really color data - depth data you can't blur depth if you have two points that are completely different and you try to blur those two points together what's going to happen is that you're gonna get a point in the middle which makes no sense so there's one solution to it call variants shadow maps so this is pretty old technique and so what we actually do is we store two of those kind of shadow maps one is the depth and the depth squared so you can take those two shadow maps we can actually blur them before we sample them so I said you're not supposed to throw a shadow maps but you can in this case because he uses something called and how pronounce this but chebyshev's inequality so you can look a bit more into it into that link above there but what this basically does is it lets you pre blur a shadow map so the big the big plus of this is usually a shadow map to do PCF you have to sample at nine times after you render the shadow so you're doing that pixel operation on a high resolution screen but in the case of various shadow maps you can blur death maps before in a lower resolution then sample them on your objects so we did a bit of tests on crash your cars you can see that's different blur option clear ratios then we have soft shadows right here should move more yeah so actually looks like the baked shadows we baked in but running out real time so I kind of profile this and it runs actually on devices like iPad choose so look at variance shadow absolutely could be a good option there are some issues with it I won't really go into detail with it but mostly about overlapping geometry but most of the time it works pretty well so unity has something called light probe proxy volumes and they're pretty cold so if you're artists every use light probes in the game that's basically a way baked lighting data into a volume using spherical harmonics and what this basically means is any dynamic object can receive kind of that seen lighting that you baked into your light map so you need to release something called light Pro proxy volume which is a souped up version of that because if you put down light probes usually you'll put down whatever like for each point around the scene you'll put down 23rd year I don't know how many the light probe proxy volumes are a lot more dense it could be in like the thousands and stuff so all dynamic objects can be seen lighting and it was used in big-budget games it's actually conceived when they're making this game called wreak or to do dynamic lighting but shader model for so that that's a big downside often I'll see a new feature in unity but it'll be aimed at something not mobile everything has to be like something shader model three or four things like instancing stuff so we can actually get around with of this by kind of making our own proxy volume so I think the main issue is no 3d texture support and sometimes dodgy floating point textures so what we can do is to get over the 3d texture we can actually map 3d textures to 2d textures pretty simply because it's just taking those and placing them into a grid so the other issue we need to do is how do we interpolate between 3d textures because 3d textures can interpolate between x and y coordinates and z coordinates so we just do a simple trilinear filtering so what we do is take two samples or two of those little grid pieces and if we want to blend that between them we can just do a a filter between the two so that solves a 3d texture issue so I know I skipped over a whole bunch of stuff but basically when we can wrap a 3d texture into a 2d texture that solves that issue so now we have a way to bake that spherical harmonic lighting data to our texture then it'll become a volume that we can place over our scene you can see this is a result of one of my experiments at home you can see particles can receive and cast shadows and all that lighting is baked in there so it's it's a pretty good way to think of using textures creatively and I've done other experience experiments too with 3d textures mapping to 2d textures you can get things like if you played the game a fortnight they something in their callsign distance fields to calculate shadows it basically gives you the cheap way to Ray cast into the scene and compute soft shadows that's actually possible on older devices like this using the same trip just wrapping a 3d texture into a 2d space of course it's going to use a lot of memory but any kind of volumetric texture takes heaps of space so it ran on Nexus 7 2012 that kind of stuff so is it's pretty good and the overhead basically the overhead for calculating lighting using spherical hallmarks is just pretty much a dot product for each color channel so we're closely with your team give them what they need but don't give them everything that makes them creative and don't black box things make a lot of tools and you'll be kind of surprised what artists can do when you give in certain shaders and stuff then they do some pretty creative stuff yeah was that everything so that was a hundred slides in thanks for listening I know I've lasted through everything so yeah come up to me and talk to me if you had any other questions I like talking about graphics and stuff these are just a bit of like a bag of tricks you can use while you're making a game so anyone have any questions yep sighing distance field shadows yes yes and yet the questions yes I think I'll upload them somewhere I'm not sure where I'm supposed to yet but yeah sorry oh yeah I'll post a lot of Twitter stuff yeah good idea yeah anything else okay thank you for coming to my presentation I hope I didn't ramble too much yeah [Applause]
Info
Channel: GCAP
Views: 27,089
Rating: undefined out of 5
Keywords: GCAP, GDAA, GCAP18, Games Connect Asia Pacific, Game Developers’ Association of Australia, Games, Technology, Programming
Id: aUtpCO0gCjI
Channel Id: undefined
Length: 49min 24sec (2964 seconds)
Published: Wed Nov 14 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.