Monday, August 14, 2017

Galactic Metal Update: Aug/17

So, Galactic Metal is nearing Alpha release - woooooo!!!
The next few weeks will concentrate on getting some art assets into the game to make it feel a bit more than just a prototype :)

Here are some images from the first enemy ship known as the A-Minor.

Concept Art


High Poly Render

Final Render

Art Direction

The aesthetic for the game is for a rounded comical 50's style ships. The art will be very simple, almost cartoony so I decided to use vertex colours rather than a texture map.
The technical art decisions for the enemy ships are as follows...
  • 2000 - 5000 poly budget
  • Vertex colours
  • Emission map 
  • Normal map
  • Specular/Gloss map
  • Metallic map

Custom Gloss/Metallic/Emission Texture

My requirements had 3 input greyscale textures; Gloss, Metal and Emission. To optimize the shader, I decided to create a single texture which combined all this data into each of the RGB channels.
I created what I call the GME (Gloss, Metallic, Emission) texture which helps me remember what the channels are for :) 

To do this, in photoshop I have each channel separated into their own folders. Then for each section which needs some value, for example the cockpit window with emission, I create a solid white layer and mask out just the section I require. I then assign a Opacity value for how much emission I wish this part to have.  In this case, I wanted the cockpit window to emit, however I also wanted the other parts to have a HDR boost, so I lowered the opacity for the window to allow this.
Then, the Emission folder is told to fill only the blue channel (GME -> RGB).
The end result certainly looks 'interesting' and at first glance you would not consider this as any meaningful art asset!

However, the shader knows what to do with this ;) 



While this ship was very flat in terms of it's gloss maps, here is another example from a different ship which looks a whole lot more interesting due to the way the different channels are layered.

Shading

Due to the vertex colours, I wrote a custom shader to do the shading, simply using the vertex colours while applying a gloss, metallic and emission value from the custom texture mentioned above.

Here's the shader which does all the magic...

Shader "Galactic Metal/Enemy Standard" {
    Properties {        
        _RimColor ("Rim Color", Color) = (1,1,1,1)
        _RimPower("Rim Power", Range(0, 10.0)) = 3
        _GMEmap ("Gloss/Metallic/Emission Map", 2D) = "white" {}    
        _Normal ("Normal Map", 2D) = "bump" {}    
        _NormalMultiplier("Normal Multiplier", Range(0.1,5))    = 1
        _Glossiness ("Gloss", Range(0,1)) = 0.5
        _Metallic ("Metallic", Range(0,1)) = 0.0
        _EmissionAmount("Emission Amount", Range(0,20)) = 1
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        LOD 200
        
        CGPROGRAM
        // Physically based Standard lighting model, and enable shadows on all light types
        #pragma surface surf Standard fullforwardshadows

        // Use shader model 3.0 target, to get nicer looking lighting
        #pragma target 3.0
        
        // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
        // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
        #pragma instancing_options assumeuniformscaling
        UNITY_INSTANCING_CBUFFER_START(Props)
            // put more per-instance properties here
            //UNITY_DEFINE_INSTANCED_PROP(type,var)
            
            
        UNITY_INSTANCING_CBUFFER_END
        sampler2D _GMEmap;
        half _EmissionAmount;
        sampler2D _Normal;
        half _NormalMultiplier;
        float4 _RimColor;
        half _RimPower;
        half _Glossiness;
        half _Metallic;

        struct Input {
            float2 uv_GMEmap;    
            float2 uv_Normal;        
            float3 color : COLOR;
            float3 viewDir;            
        };

        void surf (Input IN, inout SurfaceOutputStandard o) {                                    
            float3 gme = tex2D(_GMEmap, IN.uv_GMEmap);
            o.Normal = UnpackNormal(tex2D(_Normal, IN.uv_Normal));
            o.Normal.z = o.Normal.z / _NormalMultiplier;
            o.Normal = normalize(o.Normal);
            
            half rim = 1-saturate(dot (normalize(IN.viewDir), o.Normal));        
            
            o.Metallic = gme.g * _Metallic;
            o.Smoothness = gme.r * _Glossiness;
            
            o.Emission = ( IN.color * (gme.b * _EmissionAmount) )  +  (_RimColor * pow(rim, _RimPower));
            o.Albedo = IN.color;
        }
        ENDCG
    }
    FallBack "Diffuse"
}



Which nets this cool result here, notice the gloss map has a high specular highlight on the cockpit window and the body of the ship, this ship also has more of a metallic shine while the blue jets have a mat finish, no gloss.

InGame With Shader

 

Conclusion

Everything is in the right direction, now it's just a matter of pumping out some art assets and polishing the UI for the alpha test :) 
I'll post some more artwork as they come.