The Strange Graphics Of LETHAL COMPANY

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone lethal company is a game praised by many for its horror comedy oh oh oh man and of course its unique visual style surely a game that looks this interesting must have lots of proprietary Shader tricks involved but no nearly all the Shader effects you see come prepackaged with the unity engine so today let's figure out how you could make the graphics of lethal company let's start with a simple visual study of a Leal company screenshot to get some idea of what's going on you might hear a lot of words you're not familiar with but don't worry everything will be explained in detail later the first thing you might notice is the dense fog everything a short distance from the camera begins to fade into a more homogeneous color obscuring details we know this isn't fake fog because of these God rays in the shadow of the piping making this legitimate volumetric lighting and not just fake distance fog it's even more obvious if we look at these spotlights without the volumetric light simulation then we wouldn't see these cones of light the next most obvious thing is that something strange is going on with the light surface interactions a point appears to be either fully lit or fully in Shadow with no gradient or anything in between this could be a lot of different techniques but no matter what some quantization is being used here to reduce the amount of values used to color objects we also have some Edge detection going on here but it seems to be that edges are only visible close to the camera you can see the edge here on the cliff but no edges on the rocks in the distance then there's this blurry helmet obscuring parts of the screen this could potentially be a simple post-processing effect but that is to be determined next we have the low resolution of the entire image it's clearly being upscaled from a lower resolution because everything is kind of low quality lastly we have every Gamer's favorite effect Bloom most obviously on the Rocks here because the bloom bleeds onto the Shadows here's another example of the bloom blobs that's about everything we can also assume the usual color Corrections like exposure and Gamma but it's hard to say how exactly those are being used without more information but a Rolla what about about those clouds up there oh that's just like a Skybox yoinked from Google street view or something I don't know anyways we can Theory craft about these Shader effects all day if we want thinking about what order they are used in or whatever or we could just use this handy dandy program to frame capture the game so that we can see all the details that go into how it was rendered the same method I used to get info about the Counterstrike 2 smoke grenades but first something a little different this video is sponsored by skillshare skillshare is the largest online learning Community for creatives with thousands of classes led by actual industry professionals across all disciplines like programming illustration business music culinary and many more skillshare is the perfect platform to get started with learning pretty much anything and they recently made it even easier with learning paths which are curated classes meant to be taken in order to give you the proper path from beginner to intermediate to Advanced On Any Given topic skillshare isn't just for beginners though the learning path I found most interesting was for helping Freelancers with price negotiations as well as building their personal brand which is something many of my independent professional colleagues tend to neglect be sure to try out everything skillshare has to offer by following the link on screen or in the description the first 500 people to use my link will also get a free 1-month trial thanks so much to skillshare for sponsoring this video now back to lethal company if you're unfamiliar with what a frame capture is essentially this program captures all the graphics API calls that were made by the game for instance when the GPU is told to draw an object then the program will capture that and then we can completely reconstruct the frame by executing those same exact API calls in order again this particular capture needs 16,000 API calls to draw the frame and we can see the details of each and every one in addition Nvidia Insight does a full GPU memory dump so that we can use all the same assets like 3D models textures and decompiled shaders this is how I know lethal company is made with unity because the names of the shaders in each pass follow un's Shader lab naming convention where the editor will sort the Shader into categories based on the slashes for instance this Shader is in the hidden category so it won't show up in the unity editor and it's part of the hdrp shaders this means lethal company is using unity's highdef rendering pipeline the same rendering backend used by the recently controversial City skylines 2 if you aren't chronically online City skylines 2 released with terrible performance issues even 40 series cards were struggling to get real time from frame rates a big reason why the performance is so bad is because hdrp isn't really meant to have good performance its Shader effects are extremely expensive and meant to give the best visuals possible hence the name lethal company runs very fast though on my mid-range PC it's clearing 100 FPS without any issues so why is it so much faster than City skylines 2 well the reasons for that are endless but a big one is that lethal company is actually rendered at a very small resolution if we take a look at the view details in the profiler it's 860 x 520 not 1920 x 1080 like it should be if it were rendering at my full native resolution 860 x 520 is a really strange number normally if a game is rendering at a lower Target resolution then it's some sort of factor of the Native resolution for instance I'm at 1080p I would render it some smaller 16x9 resolution so that it cleanly upscales into my native resolution lethal company doesn't do this it renders at a fixed 860 by 520 regardless of the Native resolution you're playing at meaning that the image gets warped depending on the monitor you play with in our case the image is going to be warped horizontally to fill the space this is one of the main reasons why lethal company looks a bit strange it's also why the game is so pixelated and low quality if you play at 1440p or 4K then this lowquality aesthetic is going to be significantly more pronounced but this strikes one mystery off the list the game looks low quality because it's actually low quality it's not faked with a Shader effect this has the added benefit of making the entire game extremely cheap lowering the target resolution of expensive hdrp shaders makes them way less expensive anyways let's take a look at this Frame from the beginning the frame starts with drawing all the objects in view annoyingly Unity renders games upside down for whatever reason so I'll be turning it right side up for your viewing convenience you can thank me over on patreon as usual a huge thank you to all my current patrons without your support I wouldn't be able to take the time to rotate the the video 180° you might be wondering why the objects have such strange colors instead of being drawn fully lit and colored like you're used to real-time rendering has two main Tech trees forward and deferred forward rendering is how you would intuitively think a game is rendered when we draw an object then we do all the lighting and coloring calculations immediately and write the output to the back buffer deferred rendering is a bit different instead when we draw an object we write all sorts of information about it to something called the g-buffer you might think that stands for graphics buffer but no it stands for geometry buffer obviously this info we write is stuff like the normal vector or anything else we could possibly want for later then during postprocessing we do all of our lighting calculations based on what was written in the g-buffer mostly everything in the Game Dev world has used deferred although in reality it's some unethical Frankenstein monster of the two lethal company does not stray from the pack and also makes use of deferred rendering which is why we are seeing the data that is being written into the G buffer here I would skip to the lighting pass so we can see the proper colors but there's one very important draw call that we don't want to miss event 794 draws the helmet we see in the screenshot if we check out the model data in the frame debugger then we can confirm this is in fact the visor of the helmet the player model wears and it's not faked with a Shader as a postprocess which answers one of our earlier questions and now we can move on before we can do lighting Unity needs to do all of its shadow mapping in hdrp Fancy expensive lighting pre-calculations this takes about 8,000 API calls which means about half the frame time is spent on the fancy volumetric lighting we see in our screenshots I'm not going to explain how the volumetric light works if you're interested though the logic is very similar to the techniques presented in my Counterstrike 2 smoke video If you recall from that video this stuff is very expensive but this expense is clearly worth it as lethal company makes heavy use of volumetrics as a gameplay mechanic mainly for obscuring vision both in in the dungeon and on the surface after Unity has finished pre-calculating the lighting then the Deferred lighting pass executes all of the objects in frame have their lighting drawn then Unity draws the Sky Box in and then composits the frame with the volumetric fog this lighting Shader isn't anything proprietary either it is just hdp's default physically based lit Shader so it ends up not being too different from a simple lambers diffuse that I've discussed in previous videos the frame at this point is pretty interesting this is what lethal company would look like without any it stylistic effects this is surprisingly very useful information we know that the entire scene is drawn with realistic lighting first and then it gets stylized meaning that at this point everything is post-processing which is my specialty how convenient this independent stylization is the first and only proprietary aspect of lethal company's rendering which means the developer made it themselves and I have to figure out how it works great the name of this Shader is posterization filter and it was made with Shader graph unity's node-based Shader editor the name gives us a pretty big hint of what's going on like I said earlier there is some obvious quantization going on and posterization is kind of just another word for that if we take a look at a before and after though there's clearly more than just posterization we've got the edges in this past as well and if we take a look at the Shader assembly there's a lot going on so we've got to figure out at least two things ourselves what's being posterized and how are edges being detected for the posterization it's going to be easier if we swap to a different frame capture somehow even though we're not outside anymore this capture takes nearly 20,000 events to fully draw which is interesting this is because a ton of time is wasted drawing things that aren't even in view which should probably be fixed but that's not really the point of this video so let's move on it took me a little bit to figure out what's going on here because lethal company is pulling a dastardly trick normally when you posterize something you posterize the colors reducing the amount of allowed colors to a much smaller amount the smaller amount of allowed values the more prominent the compression artifacts become resulting in these Blobs of color because there aren't enough colors to close the gradients for some more info on why this is really useful and not bad actually you can check out these two videos of mine we see similar artifacts in our lethal company frame so you might assume it's color data being quantized as usual but no if you take a closer look you can actually see color gradients so colors are not being compressed instead lethal company is quantizing the volum El lighting data and applying it again that's right lethal company is making the most of its expensive Shader Effects by doubling up on their results first in a realistic way and then in a stylized way that's why the floor here is noisy the volumetric light data is noisy so when it's quantized the noise gets exaggerated but a Rolla what about those weird squiggly lines on the wall that kind of looks like posterization I thought that too but it's actually a second Edge detection when we take a peak and at the dreaded Shader assembly we can see that the Shader is doing two neighborhood samples one of the depth buffer and one of the color buffer the simplest method of edge detection is by calculating the local maximum contrast of a pixel that is the largest difference between neighboring pixels if this contrast value exceeds an arbitrary threshold then an edge exists there the contrast value is usually calculated with depth or normals which lethal company is doing for one of the edge detections but it could technically be done with anything like color data the problem with that though is colors are three component vectors so we need to reduce it to a single value either by only comparing one of the three components or calculating some value like luminance or saturation the answer to which method lethal company is using is somewhere in the Shader assembly but I don't get paid nearly enough to interpret that for you beyond a basic level I'm just going to assume it's the luminance of the color because that's what I would do beyond the light posterization and double edge detection there's not much else to the main stylistic path of lethal company but the effect that comes next might surprise you a bit in case you forgot the black shapes on the border of the frame is the visor of the player character's helmet normally something this close to the camera or even your real life eye would be out of focus but since our game camera is not a real camera or eyeball it's instead fully sharp like everything else in view what is a Shader effect we could use to simulate camera or eyeball Focus that's right depth of field lethal company makes use of unities of absurdly expensive depth of field Shader to blur the helmet visor which is funny because this Shader effect is one of many things that could be entirely responsible for city skylines 2 running so terribly the depth of field is calculated right after the posterization pass giving us the Blurred helmet visor and will also slightly blur held items I think it's really funny that something so expensive is being used for something so easily faked but again lethal company gets away with it because of the very small render resolution after depth of field we we have the onew combo of Shader effects all Gamers love to complain about bloom bloom is fairly straightforward you separate the bright pixels blur them and then add it back to the original image but we don't only have Bloom here Unity is doing the right thing and condensing a whole lot of final tweaks into one Mega final pass called Uber post most of the time we'd be out of luck with this pass like we were earlier with the posterization pass and would have to figure out what's going on ourselves but thankfully Unity actually has the Shader code for all their shaders on GitHub which is an insanely valuable resource the Uber post compute Shader does a whole lot of effects in one big pass these being lens Distortion chromatic aberration Bloom application vignetting color grading post exposure and Gamma correction lethal company is pretty clearly only using the bloom post exposure and maybe the color grading to make it more saturated after this pass the UI is drawn and Gamma correction is applied before the frame is presented to the screen and we have success Yul drawn one frame of the game with all that finished let's do a quick recap first all the objects in the scene are drawn and realistically liveit unity's atmospheric scattering simulation is composited with the image to create a realistic fog the developer's custom posterization Shader is applied next drawing edges based on depth and some mystery color difference and then applying a second layer of volumetric light but thresholded to create a posterization effect the helmet visor is blurred with unity's hdrp depth of field Shader and the frame finishes with Bloom as well as some final color Corrections before being upscaled to fit the screen from its low fixed resolution giving it the pixelated aesthetic despite being an ultimately simple stylized rendering pipeline lethal company's visuals are compelling and I hope it can serve as a point of inspiration for people that think these realistic effects can only be used for realistic Graphics or that they have to know Shader programming to make an interesting looking game as usual thanks for watching I hope you have a great rest of your day and I'll see you next time
Info
Channel: Acerola
Views: 636,217
Rating: undefined out of 5
Keywords: Programming, Creative Coding, Educational, Computer Science, Algorithms, Essay, Video Essay, Acerola, Learning, Tutoring, Art, Generative Art, Technical Art, Physics, Simulation, How I Made, Shader, Shader Programming, Shader Code, HLSL, Game Development, Unity, Lethal Company
Id: Z_-am00EXIc
Channel Id: undefined
Length: 15min 59sec (959 seconds)
Published: Fri Jan 19 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.