Shaders and materials

Wikis > Game engine manual > Shaders and materials

Nebula’s shaders

Shaders which you can assign to models in the Content Browser do several things. For one thing, they are pixel shaders and define the model’s material properties and how it will be rendered. They are also vertex shaders and can affect the model’s geometry, such as allowing it to deform to a skeleton’s animation, or applying procedural deformations, or tessellating the geometry at run-time to allow for displacement maps. Certain shaders require extra input, such as the Multilayered shader which needs there to be vertex color information imported with the model. The Shader drop-down selection list is sensitive to the content of a model, and will not show inapplicable shaders – if there is no vertex color information in a model, the Multilayered shader will not appear as an option.


The basic shader in Nebula is the Static shader, which serves as a foundation for most of the others in terms of material properties. For the technically-minded, it uses a Cook-Torrance BRDF with Schlick’s Fresnel approximation in a Blinn-Phong shading model.

More importantly for the user, Nebula’s rendering is physically based – which means the Static shader’s material inputs need to be authored with some things in mind. Materials are based on physical properties and should be created accordingly: there is documentation elsewhere on appropriate values to use depending on the material. Further, Nebula does all its rendering in linear space, expecting linearised texture input. To render reflections properly, one should always use environment (and irradiance) maps. There’s plenty of information out there on how all this works, but here are some pointers for the implementation in Nebula and the Static shader:

  • As the rendering expects all textures to be linear, but it can be beneficial to store albedo and reflectivity values (especially for dark and insulator materials) in sRGB space, it is important to remember to check the “Linearise sRGB” box when importing those textures.
  • Reflectivity is – if you dig deep enough – based on the material’s IOR. There are quite a few charts out there with examples, but as a general guide insulators’ specular value (in sRGB space) should be around 50 (of 255) and colorless, while metals should have values over 180, and colored.
  • Nebula uses a reflectivity map workflow, not a metalness map-based one. So: for reflective materials like metal, the albedo texture should be black and the information be put in the reflectivity map instead. Reflectivity should otherwise not contain that much information, except – potentially – a cavity map multiplied onto it for fine-detail specular occlusion.
  • In order to render metals and other reflective materials properly, it follows that you always should use environment- and irradiance maps to complement your direct lighting information.
  • Roughness controls how blurred a specular reflection should be based on a cosine power function which – while the content you author is in the 0-1 values – is scaled 2-8192 in the engine. (While not exactly right, you can think of it as the Specular Power attribute in a Phong shader in Maya.) Further, when it comes to environment maps, the way roughness controls how blurry a reflection to use is to actually – based on the roughness value – select which mipmap of the environment map to use. When creating prefiltered environment maps with ModifiedCubeMapGen, then, you should set the CosinePower to 8192 to match the blurring of direct lighting in the engine. (Irradiance maps are a part of tthe diffuse lighting and don’t need mipmaps.)
  • There will always be a Fresnel reflection effect on objects, even if you set specularity to 0. This is part of an energy-conserving PBR workflow – increase the roughness to avoid mirror-like reflections on otherwise unreflective materials.


Shaders and attributes

Static shader (default)

The Static shader is the default shader in Maya and most other shaders are based on its core attributes. It should be your go-to shader for most environment assets and the like. The Static shader’s material properties should be familiar: apart from Emissive, which is added in for artistic control, the main four are all part of a basic PBR workflow. Information for how to author these maps is readily available elsewhere – for a starting point, see Marmoset’s excellent PBR Theory and Practice articles.


  • Diffuse (albedo)
  • Specular (reflectivity)
  • Roughness (microsurface)
  • Normal
  • (Emissive)

Two additional maps are also included, used to determine the lighting. For now, these are assigned inside a model’s material, but should soon be moved to a separate light probe node. While we mention them here, they are discussed more in-depth in the Light and Post Effects section of the manual.

  • Environment map
  • Irradiance map


The only options in the Static shader, apart from the texture inputs, are scalar controls to multiply with those texture inputs. This can be used to quickly tune your material to where you want it.



Alpha shader (transparency)

The alpha shader enables the use of transparency through maps stored in the albedo texture’s alpha channel. Depending on the DXT compression used on that texture, the transparency’s gradient will be harder or softer.


  • Transparency mask (in albedo’s alpha channel)


With the alpha sensitivity slider, all values below the set value in the map will be discarded as black/transparent.

Alpha blend factor is a multiplier for the entire object’s transparency.



Skinned shader (deformations)

The Skinned shader simply allows a model skinned to a skeleton to be actually deformed. It needs to be applied to all animated models.


  • A mesh skin-weighted to a skeletal system



Tessellated shader (displacements)

The Tessellated shader tessellates geometry in rendertime and allows you to use a displacement map to alter the shape of model. Modern graphics cards and Nebula is quite capable of rendering millions of polygons, however, having all those polygons as vertices stored in a file puts a great strain on the system. This way, the detail can be recreated at rendertime. Still, to optimize things, one can LOD the amount of tessallation with the shader’s controls.


  • A displacement map (details? mid-value? baking? subdivision-based or not?)


HeightScale: scales the values in the height map to be able to reach outside the range

MinDistance: the minimal distance, at which tessellation should start. Tessellation will be applied between this value and MaxDistance

MaxDistance: the maximal distance, at which tessellation should stop. Tessellation will be applied between this value and MinDistance

TessellationFactor: maximum level of tessellation, spawns X more triangles per triangle



Foliage shader (geometry deformation)

The vegetation shader is used to add a subtle wind-like deformation to geometry. It is based on a simple movement cycling back and forth. This works well for vegetation assets consisting of simple geometry, but care should be taken to build assets so as not to get glaring intersections.


  • A model with vertex colors (alpha is used to mask the wind deformation effect. This should and will be changed, but this is the current implementation.)


WindDirection: sets the direction of the wind in XYZ directions

WindWaveSize: with this set to a lower value, edges of the mesh will start moving first in the wind, leaving the centre lagging behind. Set to a sufficiently high level, the entire mesh will move without any internal deformations

WindSpeed: sets how quickly the mesh will go through the wind cycles

WindForce: sets how far the wind will push the mesh



Multilayered shader

The multilayered shader allows you to combine up to three different materials based on a model’s vertex colors. For each vertex RGB channel, a separate set of diffuse, normal, spec, and roughness textures can be masked. The textures can also be tiled further. This is useful for covering large terrains with tiling textures without having to create enormous texture maps.


  • A mesh with vertex colors
  • 3 sets of material textures
  • (Offline: a ramp texture, meant to scale transitions)


MunX/YTiles: number of tiles in X and Y of all textures used.



Skin shader (/ Organic?) (subsurface)

The Skin shader allows for real-time subsurface effects, such as for skin or translucent leaves.


  • Absorption map (description?)
  • Scatter map (description?)


Subsurface strength: the strength of the subsurface approximation, the higher, the blurrier

Subsurface width: the radius of the subsurface approximation

Subsurface correction: performs corrections to some extent, tune it to your need



Animated shader (UV animation – WIP)

The Animated shader animates the way textures are mapped onto the model. It gives basic controls for animating a texture’s speed in U and V, as well as rotation and (currently offline) sprite animation by dividing the texture into tiles.


Tiles – for sprite textures, how many tiles in U and V to divide the texture into

Animation linear speed – a multiplier with the AnimationDirection settings

AnimationAngle – rotates the texture.



Unlit shader

The Unlit shader ignores all lighting, but is affected by certain post processes such as tone mapping.


  • Color map


Brightness: a multiplier of the color map.



Lightmapped shader

The Lightmap shader ignores lighting and instead use lightmaps as lighting information. The Lightmapped shader requires the use of a second UV set, which these lightmaps use. The Lightmap shader can also work based off of a model’s vertex color information instead of a light map texture.


  • A model with a secondary UV set
  • A Lightmap texture baked to that UV set
  • Or: vertex color information


LightMap Intensity: multiplier for the light map.



(Water shader – currently offline)

Was used to create realistic water surfaces.

Skip to toolbar