Post tutorial RSS For Modders: Overview of Ship Shader (v1.00+)

An explanation of the new texture format required for the Sins: Remastered ship shader and explanation of some PBR mechanics.

Posted by on - Intermediate Textures

The Sins: Remastered shaders use a standard PBR metalness & roughness workflow. Textures for normal and ambient occlusion maps are also supported. They also retain the teamcolor, emissive and bloom maps from the original Sins of a Solar Empire ship shader.

MarmosetPBRSpecularCreation 2

Metalness & Roughness workflow


Texture Configuration

Textures for the Sins: Remastered ship shader should be assembled as follows:

DiffuseTextureFileName (-cl, DXT5 format)

  • RBG – Basecolor (with +2.2 gamma offset. See below).
  • A – Teamcolor.

NormalTextureFileName (-nm, DXT5 format)

  • R – Subsurface Scattering (v0.91b and later).
  • G – Normal Y information (the default G channel in a standard normal map).
  • B – Ambient occlusion (fill with white if none).
  • A – Normal X information (the default R channel in a standard normal map).

SelfIlluminationTextureFileName (-da, DXT5 format)

  • R – Metalness.
  • G – Emissive.
  • B – Bloom.
  • A – Roughness.

TeamColorTextureFileName (-il, recommended 32bit uncompressed at ¼ size)

  • RGB – Full color baked self-illumination (v0.95b and later).
  • A – Height (v0.95b and later).

Variables

  • Diffuse – Team color override.
  • Ambient - Parallax height and occlusion controls.
  • Specular - Iridescence controls.
  • Emissive - Unused.
  • Glossiness - Unused.


Texture Mechanics

Those who have worked with the original Sins shaders will already be familiar with the basic concepts of textures but may not be with some of the new ones supported in the Sins: Remastered shader. What follows is a brief explanation of how they work.

Basecolor

The basecolor texture is also commonly referred to as the albedo texture. It represents the color of the surface of an asset at the corresponding point in the UV map. It differs from a traditional diffuse map in that it should not include elements of normal or ambient occlusion influence. In other words, where an old diffuse map was something of a picture of an object, the basecolor is more just the flat coloring under all the details of that diffuse map.

If you are converting an existing non-PBR asset to the new PBR format, the existing diffuse map can work but ideally any baked in shadows from ambient occlusion should be lessened or removed.

For the Sins: Remastered ship shader, an adjustment of +2.2 gamma should be applied to the final texture for game use. This offset is required on the input due to internal processing in the shader as linear color. If you are using an authoring app (such as Substance Painter, Bitmap2Material, Substance Player, Quixel Suite, etc), this should be done after you are finished processing and exporting the basecolor texture. If you are using an already compressed source texture, then you may find that using +25% lightness and +25% saturation is a workable approximation that does not exacerbate compression artifacts already in the texture.

Metalness

The metalness texture defines the nature of the surface material as being either metallic (conductive) or di-electric (non-conductive). It is represented as a grayscale where 0 (black) is completely di-electric and 1 (white) is maximum metallic. The behavior of a metallic surface is that it tends to take on the hues of the ambient light affecting it (IE, the skybox in Sins) but retains its defined colors under direct light (IE, the star in Sins). By contrast, a non-metallic surface will retain more of its natural color under ambient light but may appear more dull and flat.

Traditionally, metalness is often represented in a somewhat binary manner, with values at one extreme or the other. While most pure metals do fall near the 1.0 range, alloys can range from 0.7 – 1.0. The full range is available for use and it can be helpful when working on a macro level (IE, 1 pixel equals several feet or meters on a ship) to use an intermediate value to represent an aggregate for a surface with mixed properties (partially dirty or dusty, for example).

Roughness

The roughness map defines the finish on a surface and how it interacts with light. It determines if the material is smooth and mirror-like or very coarse. It is represented as a grayscale where 0 (black) is perfectly smooth and 1 (white) is maximum roughness. A low roughness surface will have sharper, more focused reflections whereas a high roughness surface will scatter light and have a wider, hazier reflection.

Roughness can have a dramatic effect on the look of an object in dark environments like space in Sins when using a darker skybox. A mirror-like orb object in a dark room with a single point light will appear mostly black with just one sharp bright point of the reflected light. A rough orb would have that reflection spread out over most of the surface visible to the light though and appear much lighter. Neither is incorrect when setting up your ship textures but keep in mind that objects using both low roughness and high metalness may be harder to see in low light conditions.

MetallnessVsRoughness

Metalness & Roughness cumulative interaction


The above image illustrates the effects of metalness & roughness interacting over a range of values and the end results within the given ambient environment. Note that color remains consistent but reflections come into focus as roughness decreases in the vertical columns while the hue changes and becomes increasingly influence by the ambient environment as metalness increases in the horizontal rows.

Ambient Occlusion

The ambient occlusion texture (AO for short) is akin to a shadow map of your object. It defines areas of the texture where light is partially or entirely blocked due to the shape of the object. It is represented as a grayscale where 0 (black) is completely dark and 1 (white) is fully unobscured and lit. It can be useful for helping to draw out visual depth on an object. An object level AO map is usually generated by raytracing in some sort of 3D app but micro AO (texture level) can also be generated from a normal map.

AOExample

An example of ambient occlusion on a simple crate


In the above image you can see how the object is shaded along the edges of the inset areas, where light is partially blocked by outer surface. If you do not have an ambient occlusion map for your ship, you should fill the texture channel with white.

Subsurface Scattering

Subsurface scattering, also known as subsurface light transport, is a mechanism of light transport in which light penetrates the surface of a translucent object, is scattered by interacting with the material, and exits the surface at a different point. It is useful in textures for marble, skin and other organic materials. It is represented as a grayscale where 0 (black) is none and 1 (white) is maximum.

SSSHandExample

Subsurface scattering applied to a hand


In the example image above, the effect of subsurface scattering is notable in a couple ways. First is the obvious effect of light "glowing" through the hand when it is between the light source and the viewer. The second is more subtle but the look of skin when under direct light on the left is altered and more realistic as well.


Tip: If you are using Substance Painter, a good way to generate a subsurface scatter map is export your thickness map, apply an inverted metalness map as a mask or multiply and then adjust as needed.


Subsurface Scattering is available in v0.91b and later.

Baked Self-Illumination

Basic emissive data does not “throw” light in Sins. IE, while it glows it does not illuminate any surfaces nearby as you would expect from a real light source. In the past, it was possible to fake the effect by baking (pre-rendering a static version) into the diffuse (for color) and emissive maps. The problem with this method is that it is essentially making the illuminated surfaces glow as well and the emissive map changes the properties of the surface the mask applies to and results are not ideal.

In Remastered v0.95b a 4th texture channel was enabled and allows for proper colored light that can be applied to a material surface without affecting the base specularity and roughness of the surface. Without ray-tracing and the limits of the Sins engine, we cannot do proper angle based light reflection so reflection intensity is instead calculated as peak on the normal/perpendicular to the surface. While not entirely idea, the resultant effects are a much more convincing illuminated effect overall.

Baked Self-Ilumination support is available in v0.95b and later.

Height Map

Similar to a normal map, a height map is used to create displacement on a material surface. Normal maps are generally intended for small surface level bumps in a material using multiple light vectors. A height map is a raw displacement value up or down from the neutral surface level. It is a grayscale mask where 0.5 or 127,127,127 is the neutral/0 displacement position. Values above 0.5 are displaced outwards and those below are displaced inwards.

Because of the relative sensitivity of this map and the significant visual impact it can have, it is recommended that you use an uncompressed 32bit DDS format at one power down in resolution (so if your textures are 2048x2048 on the other files, use 1024x1024 uncompressed for this texture file). This will avoid compression artifacts and accuracy of the value is more important that resolution for both the height map and the baked self-illumination map.

Height maps support is available in v0.95b and later.

Bloom, Emissive & Team Color

The effects textures from the original Sins shader remain intact and unchanged, although their channel assignments may have change. The emissive texture remains a grayscale texture and still draws it’s color from the corresponding basecolor texture.

Mesh Preparation

There have been no fundamental changes to the existing Sins mesh format. Existing meshes can be used without any modification provided they correctly reference the relevant PBR textures.

Object smoothing is now controlled by object normal. Tangents are no longer required. When preparing your asset in XSI, you are no longer required to set up or prepare any tangents in any way. If you are importing your assets from creation in another 3D app, so long as you export your model with relevant smoothing, sharp edge, etc information then it should be ready to go once passed through XSI.

Support for a secondary set of UVs to be used solely for Ambient Occlusion and Baked Self-Illumination has been added. This allows for duplicate geometry that is asymmetrical or trim sheet style texturing to have unique AO or baked light per face despite being mirrored. Secondary UVs are only detected and used by the shader if they reside in the negative X coordinate space.

NegativeUVSpace
Positive vs Negative UV space


Hard points are still required and their preparation in XSI is unchanged.

Mesh variables have been repurposed to control specific additional effects. Note that mesh variables are in hexadecimal ARGB format and will be referenced as value pairs.

ARGBPairs

Hexadecimal ARGB Pairs


Team Color Override

The team color override features allows you to use the Diffuse mesh variable to replace the standard team color values for the ship and use specific settings of your own. The feature is enabled when any A value below “ff” is specified and behaves as an alpha value for “00” to
“fe” (this range is recalculated to full 0-255 range so “fe” is 100% solid and “00” is totally transparent or effectively disabled). The RGB values represent the specific color that will be used instead. Please note that values of 00 cannot be used so the ranges are 1 to 255 and pure black is not possible.

The team color mask from the alpha channel in the diffuse texture remains unchanged. It still defines which areas team color is applied to and the intensity of the grayscale still functions as a blending/alpha value as well.


Iridescence

Iridescence (also known as goniochromism) is the phenomenon of certain surfaces that appear to gradually change color as the angle of view or the angle of illumination changes. Examples of iridescence include soap bubbles, feathers, butterfly wings and seashell nacre, as well as certain minerals. It is often created by structural coloration (microstructures that interfere with light).

IridescenceMetallic

Metallic Iridescence


Virtually all metals that spend time exposed in space show some level of iridescence. Adding a little could be considered more realistic for a ship that spends most of it's time out of atmosphere.

The Specular variable controls the iridescence effect. It is masked by the metalness map and the effect can be tuned using the channel pairs of the ARGB variable

Specular Variable

  • A is alpha for the effect on metallics. The value is inverted so the default ff value for most meshes is none (completely transparent/off) and 00 is full opacity or maximum.
  • R is the multiplier of average basecolor as refinement.
  • G is the offset from the basecolor.
  • B is alpha for the effect on non-metallics. Inverted in the same way as the A variable.

Iridescence is available in v0.95b and later.

Height & Parallax Occlusion

The Ambient ARGB variable controls how the height map interacts with the object.

Ambient Variable

  • A = 00 is parallax height enabled
  • R = 00 is parallax shadows enabled
  • G is the intensity of the displacement effect (10 - 30 works well)
  • B is unused.

A variable value of 000018ff generally works well for most ships and should be a reliable default value to start with.

Parallax height and shadow support is available in v0.95b and later.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.