Table of Contents

Class ShaderProperties

Namespace
Gamelogic.Fx.PostProcessing
Assembly
Gamelogic.Fx.dll

Defines a serializable set of properties used to configure a specific post-processing shader.

[Serializable]
public abstract class ShaderProperties
Inheritance
ShaderProperties
Derived
Inherited Members

Remarks

A ShaderProperties instance acts as the bridge between inspector-exposed settings and the underlying shader uniforms.

When enabled, this class attempts to load the shader specified by ShaderName and stores a reference to it so the shader is included correctly in builds.

Subclasses typically:
  1. Provide the shader name via ShaderName.
  2. Expose serialized fields that represent shader parameters.
  3. Override SetMaterialProperties(Material) to apply those parameters.

Properties

RequiresDepthTexture

Indicates whether this shader requires access to the camera depth texture.

public virtual bool RequiresDepthTexture { get; }

Property Value

bool

Remarks

Override and return true if the shader samples depth information. This is used by higher-level systems to enable the correct camera flags.

RequiresNormalsTexture

Indicates whether this shader requires access to the camera normals texture.

public virtual bool RequiresNormalsTexture { get; }

Property Value

bool

Remarks

Override and return true if the shader samples scene normals. This is used by higher-level systems to ensure normals are generated when needed.

Shader

Gets the resolved shader instance.

public Shader Shader { get; }

Property Value

Shader

The loaded Shader, or null if it could not be found.

ShaderName

Gets the name of the shader used by this property set.

public abstract string ShaderName { get; }

Property Value

string

Remarks

This name is passed to the internal shader lookup system when the properties are enabled. It should match the full shader path as defined in the shader file.

Methods

OnEnable()

Called when the owning component or asset is enabled.

public virtual void OnEnable()

Remarks

The default implementation resolves the shader using ShaderName. Subclasses overriding this method should normally call base.OnEnable().

OnValidate()

Called when serialized values are changed in the inspector.

public virtual void OnValidate()

Remarks

Override this method to clamp values, enforce invariants, or perform lightweight validation in response to inspector edits.

SetMaterialProperties(Material)

Applies all shader-related properties to the given material.

public virtual void SetMaterialProperties(Material material)

Parameters

material Material

The material created for the post process effect, using the shader defined by ShaderName.

Remarks

Subclasses should override this method and set all relevant shader uniforms (for example, floats, vectors, colors, textures, and keywords).