Monday, 23 November 2015

Enhancing the Scene - Techy Wizardry

With the vast majority of the scene finalized, there were only a few areas left to touch on. This mainly came down to the sandstorm and with zero documentation, it was a giant game of trial and error.

I found a few tutorials for snow which gave me the basic material set-up for an emitter material as you can see below but this was still only a tiny step towards completing the project.


 It creates a basic black and white sphere through the sphere mask but as a sandstorm in not a perfect circle or just one sole gradient, i looked in to the smoke default material in a new project file. Through this and a German Youtube tutorial on creating smoke puffs, i worked out how to use a smoke mask and multiply this with the original sphere to create a more distorted shape.

For the physical sandstorm emitter I played around wit the options until i found something reasonable. Although this entire process took upwards of 7-8 hours due to my entire lack of experience;

Firstly, i set the emitter to "GPU sprites" otherwise it was impossible to render more than a few hundred at a time and then selected the sandstorm material i created. It seemed to be very important not to plug anything in to the base, metallic, specular or roughness channels of the material otherwise it either crashed UE4 or fail to display the particles. With the blend mode set to "Translucent", only plug nodes in to the Emissive colour channel and opacity. This does highly limit your colour variation though.

Secondly, I set the spawn rate to 100,000 as this provided 100% coverage like a real sandstorm. To ensure that the particles lasted long enough to cover a wide area of landscape, i set the minimum lifetime to 10 seconds and the maximum to 14.

The next step was to change the size and velocity. These were both trial and error but thankfully the UE4 particle editor runs fairly smoothly when changing values. All the Max size values for XYZ worked best at 500 whilst changing them all to 200 for the minimum values. The velocity values are a little more varied so i'll show them below;


To add a little more variation between particles, I used a "Initial Rotation" variable, setting the minimum to 0 and maximum to 1 which in turn gives the particles a small spin, helping to make them look more unique.

The final options were "Initial Location" and the "Color over Life" editor. Initial location simply specified the locations that it can spawn/ span across. As a sandstorm covers an entirely valley, this was a very awkward one to set-up and can always be changed on the fly. The options i found best are displayed below;



The colour is chosen in probably one of the weirdest ways imaginable. You have to move points on the colour selection graph until you have a value that you're happy with. I wont even try to explain my choice here as it was all random until i got a nice orange sand.


With all this done, I was left with a fairly nice effect that could span over my entire desert environment. Hopefully Gifs work on blogger;


With this finalized, the last issue would be view distance but after playing with a few blueprint and node graph techniques over summer, i re-found my distance based opacity set-up that i used to well... Just look at the Gifs below. The easiest way to put it is that I learn complex methods best through the weirdest methods;



...and when put in to practise on an object, only using a LERP value for the opacity;



Anyway... With this method, I can simply copy and paste my graph set-up to any material I make and attach them togather with a LERP to control opacity based on distance. Honestly its such a wierd way of doing it when you see the graph that there should be no justification for it to work. We'll just call it the lucky accident.

The graph attached to the preexisting sandstorm material;


View distance has be controlled by either increasing or decreasing the below two values. It'll use the attached alpha mask for the transition so there are a lot of possibilities to play with. Just ensure the two values are kept as polar opposites;







I find that -1500 and 1500 work the best for my scene as you'll see the another Gif below;



The final stage of the sandstorm was to break up the single colour value that just looked far too fake. By duplicating the particle effect and material, i adjusted the colour to be a darker orange, placed this slightly below the original sandstorm emitter and ti created a nice orange contrast to highly the ground below the original sandstorm. This practically completes it. I attempted to use a height map to bring our depth in the tires but I couldn't fire this out without deforming the entire vehicle, lowering the overall quality.

With the sandstorm complete, there was one one more thing that needed to change. The starting point seemed very dull, consisting of a piece of metal with my name. After speaking to my lecturer, we found that it wasn't very necessary nor was it interesting enough to be a focus point for the camera transitions.

Being a Mad Max environment, what would be better than a flaming barrel to break up the monotony? On top of this, i could lean the old corrugated steel name tag against it to add a little more depth.

This is the result I ended up with, following the same Substance Designer seam-free bases, Photoshop masks and then finally. Substance Designer Touch-ups.


Fire seemed like an incredibly complicated effect to create but by taking the original fire emitter from the defaut scene and heavily modifying it, I managed to make a nice barrel flame with both the flame and smoke following the direction of the sandstorm.

I would have liked to make every single stage of this from nothing but I would be looking at upwards of a week of work for such a tiny task.

And the final point in this post. A little Easter Egg may become common across many of the matinee reals once you hit the marking stage... It's winter, remember to stay Toasty.



Final Painter Touch-ups and Critique

Before I could add extra details to the vehicle, I needed to address the feedback i received in the Alpha presentation and from classmates. It was stated that the vehicle simply looked far too cartoony and not very realistic. Almost as if it was a toy or miniature.

This was mainly caused by my roughness values which could be adjusted either in Photoshop or simply combined with a multiply node. On top of this, the metalness map was displaying only grey or black. This was due to substance designer's rendering method showing no errors in the surface reflection but as I created my main Photoshop document with masks as its backbone, nothing was ever destroyed after adjusting values. I could simply go back, select whole materials that needed adjusting and bring down a levels slider. As this was such a simple process, i added painter details at the same time as playing with roughness values so this next segment is a little out of order but still constitutes as the same stage.

With this all considered, I created three different variations to show class members and to receive feedback;

1).  The original texture with its first sand pass.


2). The Mid ground.


 3). The highest value.



With a monumental amount of feedback I ended up getting horribly mixed advice with a equal number of people going for each version and justifying it as the best. As this wasn't all too helpful, I eventually asked a few lecturers and decided to go on a mid-ground between the two highest values.

When it came to adding on extra details such as scratches, rust and sand, the easiest option was Substance Painter, especially as it was compatible with materials i had already created in Designer. On top of this, it meant i had to learn another software package which may be daunting and become a huge time sync but there was enough time available to do so.

I watched multiple tutorials by Algorithmic (the creators of Substance) until I got the grips of the software although this didn't end up being a monumental task; coming across as a mix between substance design and Photoshop, basically exactly what i was trying to convert Photoshop in to prior with all the masks.

As the exact same process was taken for both the gun asset and the vehicle, I'll only be covering the vehicle.

After importing the vehicle and applying each of the maps on a fill layer, I was given this as a starting point;


With roughness and metalness values fixed, it left me with the overly clean car body. I wanted everything at this stage to be mine so i refused to even touch the pre-made materials and instead, exported my sand texture and basic rust texture from Substance Designer alongside a set of parameters so i could further edit them in Painter.

These two materials made up 90% of the Painter touch-up details and after a lot of experimentation with the brushes, i found that a combination of "Pencil" for straight lines, "Sandpaper" for rougher areas and the multitude of scratch bushes for body detail made for the best combination.

For each new material, i created a fill layer with a black mask. This way i could just draw in white where i wanted a material in the exact same way i had been structuring Photoshop. Alongside this, it meant i could adjust the grey-scale value of the brush at any time to change material opacity.

With the rust detailing layer; 


The whole premise of the rust detailing was to pick every edge in the entire model that would be caught by the sandstorms and other elements, breaking them up slightly and in turn, defining the geometry of the car greatly. As you can see from the comparison shots, the window frames, rims and other large, metal components are a lot more pronounced now. I believe this alone doubles the texturing quality. I went over almost every area of the car with varying scratch brushes where necessary, especially on areas such as the main body to make it look just a lot more battered and lower its gleam when its hit by the desert sun.

With the sand detailing layer;


 Now, this one was a nightmare. It seemed impossible to get the sand location and intensity right so i ended up with upwards of ten different variables. The main problem i faced here is that the sand looked horribly out of place unless it was within the environment. Once i began exporting the textures out and applying them to the physical scene, it made the process much easier. I believe im set on this now after adding some sand spooling but i cannot get the roughness perfectly where i want it.

Final little additions.

As the vehicle rubber looks fairly dull, i wanted to just add a little something to spruce it up. A slight metal contrast did the trick as both the wheels and tracks had metal pieces in the high poly model and normal map, i had just entirely forgot about this.

With the extra little addition;


I feel like this finished off the texture work nicely.

Now a few high-resolution renders from engine just to give you a better feel for the UE4 rendering;





Overall, i'm very happy with how the texturing has gone up to this stage. It was an incredibly awkward path, forcing me to learn multiple software suites and entirely re-evaluate my texturing methodology but i believe the result speaks for itself when you take in to consideration that i made every last texture for the scene out of individual nodes.

Alpha Presentation Review

Alpha Presentation

For the most part, I believe the alpha presentation went really well. I gave a full breakdown of every stage, problems faced, the roadmap, what was left, etc... Basically ensuring that every area of the criteria was met. To make this segment easier, I re-recorded the Alpha presentation at home so it can be re-watched in hopefully the same quality as I presented it.

https://www.youtube.com/watch?v=alZcs8Eba2Y

I'll still provide a basic breakdown of each slide but that link is always available if you want to save some time.
 

1).


To make this presentation almost a continuation of the prior one, i used the first starting slide as it was familiar and reminded anyone watching what the original idea was before i even began to speak.

 2).

  
Same premise of the first slide, this worked as a good re-cap of past ideas so I could explain what the original plan was before moving on to a full breakdown of what went good,bad and how this issues were overcome.

3).


The final re-cap slide, explaining that the high poly model was completed for the last presentation and that the low poly model was underway. This then paved the way to the full breakdown.

4).



 This slide is covered in great detail in the video I linked at the start and took up a large chunk of presentation time but on its own managed to cover a large amount of the total presentation criteria as a fail-safe if I were to get cut-off at the five minute mark.

5).



 
Simply covering the prior slide in slightly less detail, this was a breakdown of areas i stuck with in blue and areas that i struggled with in red such as having to entirely develop an new texturing methodology.  

6).

This was the actual matinee sequence with some heavy Sony Vegas video editing. Probably the easiest way to access this would be to load up the original video I linked as it also comes with full narration/ commentary. Whilst physically giving the presentation, the projector changed the resolution of my MP4 to 4:3, ruining it to quite an extent and made the video lag terribly. I had no control over this was it was down to luck of the draw with the presentation computer if it decided to play the videos correctly or not.

7 & 8).



 These were quite literally quick, high detail shots of the scene to make up for the matinee's lower resolution.

9 & 10 & 11).




 

 These slides let me do a quick overview of how i brought the low poly to the partially finalized vehicle with normal map.

12). 


 
This slide was rather awkward to explain in limited time as it was the driving force behind my texture work and the seamless substance designer texture generation.

13).


 To ensure nothing was left out, I even showed snippets of each of the maps used in the texturing process just so absolutely every last stage was covered. It may have been overkill but the whole premise was the get as many people asking questions as possible. 

14).



 This covers the final area of the presentation criteria, going through the final month and what would be accomplished with set time frames. As i had already covered software suites extensively in past slides, not all too much detail went in to this but with the 5 minute cut-off period, it seems in retrospect, a terrible idea to put this right at the end.

Overall i received a lot of useful feedback. I really wish i had more from the class as no one exactly seemed all to talkative.
 

The Scene

With a huge focus on the vehicle, I wanted to make the scene as minimalist as possible so not to distract from the vehicle but as I chose the Mad Max style, it made it a far easier task. With Mad Max being set in a baron, desert wasteland, there would really be no reason to have a populated scene. The original idea was to display the vehicle on a desert road, in between a mountain side, between a highway sign and old highway barriers. This would concentrate the viewer on the vehicle's immediate location but I would still have issues with the landscape looking incredibly bland.  

The Assets;

Highway Sign

This was a wonderfully simple task with many pieces of geometry easily being duplicated from one area to another for easy construction. After working on the car, this was great. At a 1,348 tri count and split in to three 512 textures, it's not all too efficient either. Texture wise, I re-purposed a few of the substance graphs i created for the car and projected the turn sign text using a deferred decal. At this stage, i had enough substance material variations to re-create my scene with very few issues.    


Side Barriers and Connectors 

I made the barriers as individual components as it allows me to add a lot more variations when placing within the scene. The modelling process was fairly simple as with the highway sign and texture wise, i adjusted the mask and noise levels of one of my prior substance metal materials before applying these, giving me a few steel variations and a nicely contrasting copper. The grand total tri count for all three is 601, making them fairly inefficient for what they are but with only a few copies within the scene, I cant see it ever becoming overwhelming or adversely affecting performance.


 Sand and Concrete

These were the only assets that really required entirely new substance graphs as I hadn't attempted to make such materials prior. Starting with the sand, I followed multiple tutorials and made a lot of it up on the spot but eventually ended up with this texture alongside a fairly nice height map;


 To create this, you have this frightening graph;


The main issue with this was trying to create the sand overlap although it displays better in EU4.

Now for the concrete texture. In the process of crashing Substance Designer on a daily basis, i managed to get this;


 This didn't require a tutorial, just a lot of luck and trial and error trying to create a nice end result. I would show the substance graph but im having issues locating it.

I could just apply the sand material to the UE4 landscape but in the process found that it made it impossible to display the height map and this is what gave the sand the vast majority of its character. I believe this is because the landscape is based on a height map by default for its height/ depth. This was a little disappointing but as I could still use it for vertex painting on the road itself, it wasn't a complete loss.

The node graph required to vertex paint the height mapped sand texture on to the concrete road;


 The sand I painted on the concrete road showed all its height mapped glory and has the exact effect I was looking for although this brings another problem that I don't believe is avoidable unless I re-create the immediate landscape as a physical mesh;


As you can see, there is a very obvious border between the landscape sand and the road sand. I can probably avoid this to some extent by focusing the matinee cameras only on the height mapped sand or attempt to use some form of emitter set-up such as a sandstorm to drown out the texture seems in a reasonable fashion.

Third and Final Texturing Attempt - Substance designer and Photoshop

With the last method failing, I watched multiple vehicle/ weapon texturing tutorials on Youtube and it gave me an Idea. Using what i learn't from Substance Designer, I could import base maps i create from designer in to photoshop, assign these to black masks and use the prior made colour map to select areas that require specific textures, switch to the masked base texture and simply fill the space in white. If done correctly, I could texture the entire vehicle by simply painting white on each required material layer, basically using Photoshop as a primitive Substance Designer.


The main goal with this Photoshop set-up was to make the texturing process as automated as possible whilst also keeping it as nondestructive as possible. One down side to this was the huge file sizes but it was a worthwhile trade-off. 




Working with only a single graph at once in designer reduced its RAM usage considerably, making the software far more responsive which in turn solved the key issue. On top of this, I could slightly edit then re-use my old master-graph for most of the texture imports.



Once again, the graph is horribly complex at first glance but i'll happily explain it in lecture time if you're interested. It basically allows me to make any variation of metal, painted metal, rust and rusted metal by simply altering a few values.

I took this a step further though and by using a position map and a world space normal map baked within the software from my low poly model and normal map, i was able to make any texture thrown through it entirely tillable. It has slight issues making odd, pipe like geometry entirely seamless but that seems like its only downfall to date. This was all made possible by the "Tri-Planar" node new in substance designer 5. It is quite literally magic.

There was a major problem from the start though with this process. I found through extensive trial and error that the world space normal and position maps had to be baked as PNGs and you must also manually change their format from 8bit to 16bit otherwise the seamless texture will be displayed as a chalky blur. It may have taken a few weeks of trial and error until I stumbled across a fix but didn't jeopardize the project.

I feel like the discovery of tools and techniques like this are revolutionary for game art. No-longer do you need to cleverly hide seams, you can just outright remove them.


As a test, can you see any seams in the above render? With any other method other than obsession texture off-setting, it would not have been possible to remove them and alongside that, it wouldn't have been possible in the slightest to remove them automatically.

By plugging my texture graphs in to the tri-planar nodes, i could convert any tiling texture in to an entirely seamless texture although this comes with a downfall. As it maps the texture to your geometry position, you cannot re-use the same texture on another model. Once again a very worthy trade off though.

For the vehicle, i exported every texture seamless, leaving me with 11 separate materials to choose between with four maps in each. Of course this made my photoshop document rather awkward to navigate eventually but with naming conventions and a decent folder structure, it never slowed down the texturing process unlike every method I used over the past two years.

The mass of folders;


An example of what it does to the textures that are fed through the tri-planar node;


If you look carefully, you can how the tiling texture swirls round the UVs until it hits the correct edge. On top of this, it scales the texture perfectly across each area for perfect consistency. One downfall is that texture resolution can be lost due to Substance Designer trying to find a mid-ground between texture scale but as substance designer adapts to the resolution of every node and can be changed on the spot, it fixed any possible pixelation before exporting.

These textures were not perfect though but by binding Photoshop effects such as levels and HLS once again to masks, on top of areas that needed changing in the Photoshop document, I could and still can if I want, go back and adjust roughness and colour values on the fly if they don't display correctly in Unreal Engine 4.

Overall, once we take away the endless number of issues and learning experiences, it took almost the same time as texturing methods I was already comfortable with to create what i deam as a much better end result and in the process, taught me the principles of PBR. Re-doing this process, i believe i can cut that time in half whilst improving the quality even further although there are still grey areas within my new texturing methodology that i'll cover in the next update, mainly relating to colour consistency between Substance, UE4 and a major issue with the way Substance Designer processes Metalness maps which confused me considerably.



  

Second Texturing Attempt- What we learnt - Substance Designer

As I, at this stage didn't entirely understand the PBR workflow and to some extent still don't, I found that learning substance designer would be a great step forward. Not only is it the future of procedural texturing, it forces me to learn the PBR fundamentals in the most basic way possible in a node based system.

When you really think about it, PBR texturing in Photoshop follows the exact same work methodology as in Designer, it's simply aimed more towards creating maps using many pre-made processes instead of doing each one manually within Photoshop.

It feels like you're visually programming the textures; creating a set of Photoshop commands to be carried out in the desired order to create your textures.

It took multiple weeks to understand but i'll briefly run through the basics, both good and bad, alongside the methodology so this doesn't become a wall of text;

General Methodology  - The basics of what i learn't

- Use a selection of Pre-made masks and link these in to gradient nodes which in turn, maps the chosen colours to the grey scale of the original mask.

-Plugging these in to a blend node allows you to combine multiple base textures. Adding another mask to the Alpha channel allows you to blend the two base textures in relation to this mask's gradient. The blend mode can apply almost any Photoshop blending mode so it makes almost anything possible.

-Levels nodes and "Hue Lightness Saturation" nodes work identically to those found in Photoshop and can be attached/ changed at any stage.

-Transform 2D nodes function the same way as scaling an image in Photoshop.

-Tile generators allow you to tile anything plugged in or allow you to pick from some predefined patterns and allow you to customize this with hundreds of parameters.

-Maps can be converted to normal or height maps with simple "Normal conversion" nodes.

Honestly, once you take these in to consideration, Substance Designer uses the same features as Photoshop, just structured in an entirely different way.

The Benefits I Found

-Unlike Photoshop, all textures are made the tile by default, making it very easy to create a stockpile of tiling textures for any scene/asset.

-Once you have created your node graph, you can very easily change your texture in multiple ways, even to brand new materials by changing the values of a few nodes.

-If structured correctly, you can create one large graph that generates any wide range of textures you could wish for with just the click of a button.

-Texture resolutions can be changed on the fly, making it very flexible.

-Any material you make can be exported in to UE4 or substance painter to be re-used. Set some custom parameters and you have yourself an unlimited variation texture with a tiny file size.

-You can bake any map from your low poly model and normal map/ high poly model in seconds.

-The best thing of all, by using a World Space Normal map and a position map, you can remove 99% of seems from your model but we'll cover this in more detail further on down the line.

What I did, what went wrong

After a lot of practice, I created a master node graph which allows me to transition anywhere from clean metal of any colour and roughness to full body rust, with any value in between. With my vehicle being so battered in concept, this allowed me to make a lot of the primary textures within a single graph.  

One of the failed attempts, just showing the complexity required;


 The node graph i created that does the vast majority of the heavy lifting;


Even fully annotated, the node graph is an absolute nightmare to anyone other than the original author. I found that the easiest way to learn such complex functions was through helping various people in the class. As graphs can be created in any wide number of ways, showing another person how to create their desired texture usually uncovers a multitude of new techniques so you always leave, learning just as much as you've taught.

For example and to show you some of the more simplistic node graphs i created to help classmates;



Honestly it may look complicated with the height map but its just Photoshop fundamentals, displayed in a slightly odd fashion. If you want, i'll quite happy with you a full breakdown in lecture time if you're interested.

Now, for what went horribly wrong and took up multiple weeks of my time.


Instability. I imported the vehicle with each major area assigned to a new material. In practice, this could work fantastically, allowing me to apply different materials to different components on the fly. In reality, it made the software crash endlessly and take upwards of a minute to change between graph and apply a new texture, not to even mention the time it took to physically load the files.

I tried to bare with this for a while but as I couldn't apply enough materials, it became impossible to add the details i wanted. Using a curvature map, i could add a bit of edge wear but the placement was far from perfect.

To continue onward, I had to salvage any process I could before re-evaluating my entire methodology. In the process of learning new software, I gave myself tunnel vision and took it much further than I should have, wasted upwards of 10-15 hours.

Final example for this post;



As you can see, the colours are entirely off and the rust damage has terrible placement. Fixing this in substance designer seems to be near impossible so it made me fully aware that this software package would only serve the purpose of creating the base materials.