Scripting API

Scripting API

SceneMaterial

Record in Abyss.Core.Scenes, from Abyss.Core.

A surface, in the part of PBR that is numbers.

public record SceneMaterial

Remarks

Written with init properties rather than as a positional record because there are sixteen of them and a call site with sixteen unlabeled arguments is a bug waiting to be introduced by somebody inserting a field. Every default here is Bevy's own default, so a file that says nothing about a property means the same thing as a file written before that property existed.

This is the whole of what the engine can say about a surface — see MaterialSpec for what it deliberately cannot.

Properties

Red

public float Red { get; init; }

Linear red, 0 to 1.

Green

public float Green { get; init; }

Linear green, 0 to 1.

Blue

public float Blue { get; init; }

Linear blue, 0 to 1.

Alpha

public float Alpha { get; init; }

Opacity, 0 to 1.

EmissiveRed

public float EmissiveRed { get; init; }

Linear red the surface emits regardless of lighting.

EmissiveGreen

public float EmissiveGreen { get; init; }

Linear green the surface emits regardless of lighting.

EmissiveBlue

public float EmissiveBlue { get; init; }

Linear blue the surface emits regardless of lighting.

EmissiveAlpha

public float EmissiveAlpha { get; init; }

Emissive alpha, which Bevy carries and does not blend with.

Metallic

public float Metallic { get; init; }

0 for a dielectric, 1 for a metal.

Roughness

public float Roughness { get; init; }

0 for a mirror, 1 for chalk.

Reflectance

public float Reflectance { get; init; }

How much light a non-metal reflects head on.

AlphaCutoff

public float AlphaCutoff { get; init; }

The threshold AlphaKind.Mask compares against.

Unlit

public bool Unlit { get; init; }

Whether to ignore lighting entirely.

DoubleSided

public bool DoubleSided { get; init; }

Whether both faces of every triangle are drawn.

FlipNormalMapY

public bool FlipNormalMapY { get; init; }

Whether the normal map's green channel points the other way.

Transparency

public AlphaKind Transparency { get; init; }

Which transparency rule the surface is drawn under.

Texture

public string? Texture { get; init; }

The key of the image asset to tint by, or null for an untextured surface.

A key rather than a path, so that two materials sharing a texture share one load. The same is true of every other slot below.

EmissiveTexture

public string? EmissiveTexture { get; init; }

The key of the image asset whose colors are emitted.

MetallicRoughnessTexture

public string? MetallicRoughnessTexture { get; init; }

The key of the image asset holding roughness and metalness.

NormalMapTexture

public string? NormalMapTexture { get; init; }

The key of the image asset holding tangent-space normals.

OcclusionTexture

public string? OcclusionTexture { get; init; }

The key of the image asset whose red channel darkens ambient light.