Use this file to discover all available pages before exploring further.
Materials bridge your geometry and the GPU: every MeshRenderer holds a reference to a Material, which in turn holds a reference to a Shader asset plus all the per-instance property values (textures, floats, vectors, colors) that customize how that shader looks on that particular object. Prowl’s material system separates shader-level keyword variants from per-draw property data, making it straightforward to share a single shader across thousands of objects while still giving each object a unique appearance.
A Material is a first-class EngineObject (saveable as a .mat asset). Its two core internal pieces are PropertyState (property values) and KeywordState (keyword overrides), both layered on top of a Shader reference.
// Load a shader asset and create a material from it at runtimeShader standardShader = Application.AssetProvider.LoadAsset<Shader>("Defaults/Standard.shader");Material myMaterial = new Material(standardShader);// Assign basic PBR propertiesmyMaterial.SetColor("_MainColor", new Color(0.8f, 0.2f, 0.2f, 1f)); // Red tintmyMaterial.SetFloat("_AlphaClip", 0.1f);
// Minimal — only a shader is requiredMaterial mat = new Material(shaderRef);// Full control — supply pre-built PropertyState and KeywordStateMaterial mat = new Material(shaderRef, myPropertyState, myKeywordState);
Passing a null shader reference throws ArgumentNullException immediately. Always ensure the shader asset is loaded before constructing a material.
PropertyState is the dictionary of named GPU-uniform values stored in a material. Call the convenience methods on Material directly — they forward to the internal _properties block:
Material mat = new Material(Application.AssetProvider.LoadAsset<Shader>("Defaults/Standard.shader"));// TexturesTexture2D albedoTex = Application.AssetProvider.LoadAsset<Texture2D>("Textures/Rock_Albedo.png");mat.SetTexture("_AlbedoTex", albedoTex);Texture2D normalTex = Application.AssetProvider.LoadAsset<Texture2D>("Textures/Rock_Normal.png");mat.SetTexture("_NormalTex", normalTex);// Surface properties (metallic R, roughness G, ambient occlusion B)Texture2D surfaceTex = Application.AssetProvider.LoadAsset<Texture2D>("Textures/Rock_Surface.png");mat.SetTexture("_SurfaceTex", surfaceTex);// Scalars and colorsmat.SetColor("_MainColor", Color.white);mat.SetFloat("_AlphaClip", 0.5f);// Vectorsmat.SetVector("_Tiling", new System.Numerics.Vector2(2f, 2f));// Matrices (e.g. custom UV transforms)mat.SetMatrix("_UVMatrix", System.Numerics.Matrix4x4.Identity);
Global properties are set once and visible to every material and every shader in the current frame. The render pipeline uses them for built-in uniforms like prowl_MatVP, _WorldSpaceCameraPos, and fog parameters. You can add your own:
// Visible to all shaders this frame — useful for time-based effects or global fog overridesMaterial.SetGlobalFloat("_GlobalTime", (float)Time.time);Material.SetGlobalColor("prowl_FogColor", new Color(0.5f, 0.6f, 0.7f, 1f));Material.SetGlobalTexture("_NoiseTex", noiseTexture);
Global property state is cleared at the end of every frame by the render pipeline (PropertyState.ClearGlobalData()). Re-apply global values each frame from Update() or a MonoBehaviour hook like OnPreRender.
Keywords select between compiled shader variants. Toggle features (e.g., normal mapping, vertex colors, alpha clipping) without creating separate shader assets:
// Enable a keyword variantmat.SetKeyword("_NORMALMAP", "1");// Disable a keyword variant (clear the value)mat.SetKeyword("_NORMALMAP", "0");// Check the default Standard shader — it uses tag-based pass selection rather// than keywords, but custom shaders can declare any keyword they needmat.SetKeyword("_ALPHATEST_ON", "1");
Keywords are per-material (_localKeywords) so enabling a keyword on one material instance does not affect other materials sharing the same shader asset.
The MeshRenderer component drives visible geometry in the scene. It holds a Mesh asset reference, a Material asset reference, and a local PropertyState for per-instance overrides that don’t require a separate material.
[RequireComponent(typeof(MeshRenderer))]public class PropSetup : MonoBehaviour{ public override void Awake() { MeshRenderer renderer = GetComponent<MeshRenderer>(); // Assign mesh and material assets renderer.Mesh = Application.AssetProvider.LoadAsset<Mesh>("Models/Barrel.obj"); renderer.Material = Application.AssetProvider.LoadAsset<Material>("Materials/Barrel.mat"); // Per-instance property override — no new Material asset needed renderer.Properties ??= new PropertyState(); renderer.Properties.SetColor("_MainColor", new Color(0.9f, 0.7f, 0.3f, 1f)); }}
MeshRenderer.GetLayer() returns GameObject.layerIndex, which the camera’s CullingMask uses to include or exclude the object from rendering.
The Standard.shader bundled with Prowl is a full PBR (Physically Based Rendering) shader using the Cook-Torrance BRDF with PCSS soft shadows. It renders in the Opaque render order pass and supports all built-in lights.
Material pbrMat = new Material( Application.AssetProvider.LoadAsset<Shader>("Defaults/Standard.shader"));pbrMat.SetTexture("_AlbedoTex", albedo);pbrMat.SetTexture("_NormalTex", normalMap);pbrMat.SetTexture("_SurfaceTex", surfaceMap);pbrMat.SetColor("_MainColor", Color.white);pbrMat.SetFloat("_AlphaClip", 0.5f);
The surface texture packs three channels: R = metallic, G = roughness, B = ambient occlusion. Export your maps in this packed format, or use Prowl’s built-in default_surface.png which provides metallic = 0, roughness = 0.5, AO = 1.
StandardUnlit.shader is a minimal unlit pass — it samples _AlbedoTex and multiplies by _MainColor, with no lighting calculations. Use it for skybox planes, UI meshes rendered in world space, or emissive decals.
Material unlitMat = new Material( Application.AssetProvider.LoadAsset<Shader>("Defaults/StandardUnlit.shader"));unlitMat.SetTexture("_AlbedoTex", iconTexture);unlitMat.SetColor("_MainColor", new Color(1f, 1f, 0f, 1f)); // Yellow tint
prowl_FogColor, prowl_FogParams — scene fog parameters
ShaderPass and ShaderVariant
Shader.GetPass(int passIndex) and Shader.GetPass(string passName) retrieve a specific pass by index or name. Shader.GetPassWithTag(string tag, string? value) returns the first pass matching a tag key–value pair. These are used internally by the render pipeline but are available for custom pipeline implementations.
When no material is assigned to a renderer, Prowl falls back to Material.GetDefaultMaterial() — a standard PBR material with a solid white color and no textures:
// Shorthand to get (or lazily create) the shared default materialMaterial fallback = Material.GetDefaultMaterial();// Create a fresh default-shader material without cachingMaterial fresh = Material.CreateDefaultMaterial();fresh.SetColor("_MainColor", Color.cyan);