[i]In this article a number of words are linked to Wikipedia’s [url=https://en.wikipedia.org/wiki/Glossary_of_computer_graphics][b]glossary of computer graphics[/b][/url] so that you can follow along without too much interruption.[/i] [img]https://clan.cloudflare.steamstatic.com/images//5915980/a9763c3e1f85543607bbd0857bcc7ca396022673.png[/img] [h2]👨‍🏫[b]A BRIEF LESSON IN COMPUTER GRAPHICS[/b][/h2] Often we get feedback from players who wish the camera in Brigador could be moved to see different angles of the various models of the vehicles or buildings seen in the environment. We don't wish to disappoint those players but within the game engine this isn't possible because what you are seeing rendered in the game is [i]not[/i] a [b][url=https://en.wikipedia.org/wiki/3D_modeling]3D model[/url][/b] that can be rotated along any axis. Instead, what you are seeing are [b][url=https://en.wikipedia.org/wiki/Sprite_(computer_graphics)]sprites[/url][/b] (more specifically, you are looking at 2D quadrilateral shapes, and what you are [i]also[/i] looking at right now is a flat, two-dimensional screen upon which is a moving image that can create the illusion of [b][url=https://en.wikipedia.org/wiki/Z-buffering]depth[/url][/b] through particular techniques). Ironically, how we even make these sprites is initially by creating 3D models, typically through the process of [b][url=https://en.wikipedia.org/wiki/Kitbashing]kitbashing[/url][/b] (this part of the process we won't go into, and we'll ignore [b][url=https://en.wikipedia.org/wiki/Skeletal_animation]animation rigging[/url][/b] too, but feel free to check out this [url=https://www.youtube.com/watch?v=QAv-md73LHs][b]timelapse video for the Pantry Boy vehicle[/b][/url] from several years ago that you may not have seen before) usually in [b]3DS Max[/b]. The part we're concerned with comes after a 3D model has been decimated, which is a process that reduces the size of the [b][url=https://en.wikipedia.org/wiki/Polygon_mesh]polygon mesh[/url][/b]. Once this happens, we can give the mesh a [b][url=https://en.wikipedia.org/wiki/Texture_mapping#Texture_maps]texture map[/url][/b], which is the point where the model starts to more closely resemble the final product. Before we do that we'll need [b][url=https://en.wikipedia.org/wiki/UV_mapping#UV_unwrapping]UV maps[/url][/b] first. A quick way to explain UV mapping is to imagine an animal that has been skinned: our 3D model is the animal and the skin that has been removed from it and can be laid flat is our UV map. Or if you refer to the cube below. [img]https://i.imgur.com/YRacTZq.png[/img] The program we'll use to do this to our 3D model is called [b]Houdini[/b]. To give our UV maps texture information what we then do is take them from Houdini along with the 3D model that was made in 3DS Max into another powerful program called [b]Substance Painter[/b] that allows us to detail the [b][url=https://en.wikipedia.org/wiki/3D_computer_graphics#Materials_and_textures]materials[/url][/b] of the model (for example, how rough a stone looks or how glossy a metallic surface is). We don't have footage of us working on Substance Painter but you can get a good idea of what it's capable of just by looking at this short official video that touches on a lot of what we've just written.[previewyoutube=hZlNwrw-EOo;full][/previewyoutube]At this point we have crafted the shape of our model, peeled off its skin, given it materials to make it resemble the final object, and now we have to take it into a fourth program: [b]Blender[/b]. Why we take the textured model into Blender is to do three things. The first is [b][url=https://en.wikipedia.org/wiki/Computer_graphics_lighting]lighting[/url][/b], which we only do a little of. Blender allows us to influence the [b][url=https://en.wikipedia.org/wiki/Computer_graphics_lighting#Lighting_interactions]light-matter interaction[/url][/b], or how 3D models are illuminated – a process that is often referred to as [b][url=https://en.wikipedia.org/wiki/Texture_mapping#Baking]baking[/url][/b]. The second thing we do in addition to this is framing the 3D model from an angle of our choosing – in other words we recreate the same [b][url=https://en.wikipedia.org/wiki/Hidden-surface_determination#Viewing-frustum_culling]view frustrum[/url][/b] that the player will see when playing Brigador. The third and final major thing in the Blender step is we also get [b][url=https://en.wikipedia.org/wiki/Z-buffering]depth buffer[/url][/b] information, which tells us how far away the model is with respect to the camera's perspective. [h2][b]🔀FROM MODELS TO SPRITES[/b][/h2] We said at the top that in the game you were technically looking at sprites, not 3D models. The basic reason for that is because the game engine is told to display sprites, which in turn spoofs the appearance of 3D models in an apparent isometric perspective. How we get from 3D models to sprites is via open source software – a version of which comes included with the [url=https://store.steampowered.com/app/468270/Brigador_Modkit__Map_Editor/][b]Brigador Modkit & Map Editor[/b][/url] called [b]SJSpritePacker[/b]. What this does is takes the original 3D model and (depending on the model's level of detail) captures up to 64 rotations of all that model's positions and animations at a particular [b][url=https://en.wikipedia.org/wiki/Color_depth]resolution[/url][/b] and creates not one but [i]two[/i] sheets of sprites along with the XML data for the sheets. Below you will see the sprite sheets for the loyalist infantry NPC (AKA loy_foot_01 AKA “Dave”), which if you own a copy of the game you can find in the folder Brigador\assets\units\loyalists\foot. [img]https://i.imgur.com/LclOOTl.png[/img][img]https://i.imgur.com/2SoKA5m.png[/img] [i]This[/i] is where things start to get complicated. In addition, the purpose of the second sprite sheet is it provides [b][url=https://en.wikipedia.org/wiki/Z-buffering]z-depth[/url][/b] information. The XML data that's outputted for [i]both[/i] of these sprite sheets by SJSpritePacker is "pointer data" - this is information that tells the sprites to face the correct direction but before it can do so, it's fed into a .json file, which is the file type the game engine reads for the majority of the game's data. Let’s use another example of how we both use pointer data [i]and[/i] slip in an optimization while we’re at it. Here’s a gif of the Arlo agrav from Brigador at twice the usual zoom seemingly turning 360 degrees on the spot. Every single angle of this shot is its own individual sprite, but it is *not* a 3D model rotating in space despite appearances. [img]https://i.imgur.com/wz0g8dZ.gif[/img] Within the game’s own data you’ll find rotations of the Arlo, aka spc_agrav_05. However, the sprites below [b]only point to the right[/b]. Why? Because we mirror the left-hand side to save on those frames. [img]https://i.imgur.com/8f3mPxu.png[/img] [img]https://i.imgur.com/L2WpQrS.png[/img] Meanwhile what the XML data itself looks like is a list of coordinates that tell which parts of the images above point to where. [img]https://i.imgur.com/Okx7LYP.gif[/img] Fun fact: at one point early on in development all of this data had to be manually inputted. Fortunately, our artists nowadays have scripts that export the required rotation data automatically. [h2]🤔[b]WAIT, WHY DOES IT LOOK 3D THEN?[/b][/h2] Careful readers might be asking why did we go to all the trouble of putting together 3D models, give them detailed materials for their textures, bake in some lighting and [i]not just use those models in the game[/i] instead? This question was asked many years ago and was finally answered around the winter of 2012. While Brigador does have a 3D [i]look[/i], it is [i]not[/i] 3D. Games that are true 3D are extremely complicated because once you go 3D, now you really are in a situation where the player can view a model from every conceivable angle in a game's environment. Creating such a thing is a considerable undertaking for any studio's engineers and technical artists to deal with, who essentially have to figure out a way for models that are exported in a particular format to be understood by their game engine and also be optimal (i.e. not grind to a crawl and run at single digit FPS). In other words, everything we've talked about so far took five different programs alone: 3DS Max > Houdini > Substance Painter > Blender > SJSpritePacker – and that was only for 2D sprites. So, knowing this, and with respect to the amount of time, people, money and energy it would take to make a true 3D Brigador game, hopefully it's clearer now what some of the reasoning was for Brigador's look. So Brigador's not true 3D and yet visually the game still looks impressive - so what else is going on? Recall the sprite sheets from before that look black and white. Let's look at another one that's only ever seen at one rotation - the orbital cannon (AKA battery_01 in the game data). [img]https://i.imgur.com/id14lYU.png[/img] [img]https://i.imgur.com/bbGbD6f.png[/img] The first variant of the orbital cannon you can think of as the [b][url=https://en.wikipedia.org/wiki/Computer_graphics_lighting#Diffuse]diffuse[/url][/b] version, while the second is the [b][url=https://en.wikipedia.org/wiki/Z-buffering]z-depth[/url][/b] information visualized as a grayscale image (where the brightness can be considered as an indication of how close the model is to the camera). The purpose of the latter is to inform the [b][url=https://en.wikipedia.org/wiki/Computer_graphics_lighting]lighting[/url][/b] of the Brigador engine against the sprite, which you can see in the final version of the game itself. [img]https://i.imgur.com/bveJwv1.png[/img] Or in motion... [img]https://i.imgur.com/poSYUl0.gif[/img] What should be apparent from the above image and the gif is there is additional lighting being displayed on the sprite itself. As it turns out, the Brigador engine is doing two specific things: [b][url=https://en.wikipedia.org/wiki/Deferred_shading]deferred shading[/url][/b] and with it [b][url=https://en.wikipedia.org/wiki/Deferred_shading#Deferred_lighting]dynamic lighting[/url][/b] and this is what we've been building up to this whole time. We encourage you to read up a little on both topics, because it's a rabbit hole of its own, though we will point out here how even for the mid-2010s, applying deferred shading and dynamic lighting to 3D models was a very expensive thing to do in terms of hardware... except we are not using 3D models in the engine! Remember: the sprites are fundamentally just two-dimensional quadrilateral shapes – they are not polygons where every facet would have to be lit properly and because we are able to decouple a scene's geometry from its lighting. Also, because we have the depth information from the z-depth sprite sheet in the XML data, this allows us to put in a bunch of lights into the levels without causing major performance hits and allows the engine to apply dynamic lighting to those sprites. Or, in other words, we can do things like this such as when the effects of an EMP wear off... [img]https://i.imgur.com/kH6jIcM.gif[/img] Or dynamically light up the player when they fire a railgun shot with the Zeus... [img]https://i.imgur.com/wrsiE7d.gif[/img] [b]*This*[/b] is where the payoff is and why so many people have asked over the years “[i]is this 3D?[/i]”. This might also prompt the question of why other developers [i]don’t[/i] do this nowadays if it’s so visually effective. The main culprit is the games industry’s pursuit of graphical fidelity in the early 2000s, which meant most people moved on from sprites in favor of full 3D. So, in summary: [list] [*][b]Nothing is 3D[/b] in Brigador – we make spritesheets out of 3D models instead [*]Brigador's custom game engine [b]draws 2D quadrilaterals on screen[/b] which are inexpensive to light [*]Sprite [b]z-depth information informs the lighting[/b] and helps spoof a sense of 3D despite the fixed isometric view [/list] [h2][b]💭WHERE DO YOU GO FROM HERE?[/b][/h2] What you've read so far is an abridged version of what goes into what you actually see on your screen when you play Brigador and why it looks the way it does. For our next game, [b][url=https://store.steampowered.com/app/903930/Brigador_Killers/]Brigador Killers[/url][/b], what we are changing about the visuals is we are [b]doubling the output resolution of all sprites[/b] from their 3D models. In the next two images you will see the first game's masthead Touro Loyalist mech. The first image is from Brigador with the camera set to a 3x zoom... [img]https://i.imgur.com/r7ByHSm.png[/img] While this is an image of the Touro at the doubled output resolution at 1x zoom. [img]https://i.imgur.com/1otvpnm.png[/img] ...And together in the same scene within an early dev build of Brigador Killers. [img]https://i.imgur.com/Mfyjv3K.png[/img] We realize that this article may not end requests from people asking for different camera angles, but we hope players will be able to better enjoy a new level of detail that goes into each art asset in both our sequel and our current game. Speaking of which, Brigador is currently on sale. https://store.steampowered.com/app/274500/ Thanks for reading. [img]https://clan.cloudflare.steamstatic.com/images//5915980/4fd9e804fa50da6118470627366a885dc2eee180.png[/img] [N.B. [i]This article is based on a previous newsletter from [b][url=https://stellarjockeys.com/wp-content/uploads/2021/10/September-2021-archive.pdf]September 2021[/url][/b] and a Twitter thread on the same topic from [b][url=https://twitter.com/StellarJockeys/status/1542453109137580035 ]June 2022[/url][/b][/i].]