Table of Contents

Class MaterialStreamView

Namespace
Stride.CommunityToolkit.Rendering
Assembly
Stride.CommunityToolkit.dll

Draws every mesh with one material stream as its colour, the way Game Studio's view modes do: the diffuse, the glossiness, the normals. The quickest way to see why a material looks wrong, since a normal map loaded as sRGB or a glossiness map read from the wrong channel is obvious as a colour and invisible under lighting. Added by game.AddMaterialStreamView().

public sealed class MaterialStreamView : IDisposable
Inheritance
MaterialStreamView
Implements

Remarks

The mechanism is the forward effect's PixelStageSurfaceFilter hook, a permutation the editor fills with the engine's MaterialSurfaceStreamShading shader: it runs the material's surface shading and returns one stream instead of the lit colour. The two shaders come with the engine; the toolkit adds the MaterialStreamRenderFeature that sets the hook.

The value shown is the linear value the stream holds, drawn through the post effects like any colour, so it is tone-mapped the way the lit picture is. The view applies to every mesh the compositor's mesh feature draws; it is not a per-material setting.

Properties

All

Every stream, in the order Next() walks them.

public static IReadOnlyList<MaterialStream> All { get; }

Property Value

IReadOnlyList<MaterialStream>

Name

What the view shows, for an overlay: the stream's name, or "Lit" when none is set.

public string Name { get; }

Property Value

string

Stream

The stream every mesh draws, or null for lit shading. Takes effect on the next frame, after a recompile.

public MaterialStream? Stream { get; set; }

Property Value

MaterialStream?

Methods

DisplayName(MaterialStream)

The name Game Studio's toolbar gives the stream.

public static string DisplayName(MaterialStream stream)

Parameters

stream MaterialStream

Returns

string

Dispose()

Takes the view's feature out of the compositor. Meshes recompile back to lit shading on the next frame.

public void Dispose()

FilterFor(MaterialStream)

The shader the hook is filled with for a stream: MaterialSurfaceStreamShading with the stream's name, the channels to show (rgb for a colour, rrr for a number) and whether to remap a signed value into 0..1; the world normal has a shader of its own.

public static ShaderClassSource FilterFor(MaterialStream stream)

Parameters

stream MaterialStream

Returns

ShaderClassSource

Next()

Steps to the next stream, and after the last back to lit shading.

public void Next()