.bema files
Look up the fields of a .bema material or variant file, the values they accept, and the resources that baking one produces.
A .bema file declares a material or a material variant in JSON5. A material
names the BEMX graph that computes its surface, a render
domain, and named parameters. A variant names a parent material and supplies a
value for each of its parameters. .bema is a
declaration format, not runtime data: at runtime, applications use the
processed Material, Variant, Shader, and Image resources. To write one,
follow Author assets.
Material files
A root material is a file without parent. The handler reads these fields and
ignores any other, such as a material-level type:
| Field | Value |
|---|---|
domain | Required. The render domain, such as World. It's recorded in the material and not read by shader generation. |
graph | Required. The asset ID of the .bemx file that describes the material's surface. |
variables | Required. The material's parameters, in order. Each is an object with name, data_type, value, and optionally type. The graph's parameter and image nodes read them by name. |
A variable's type says how its value reaches the shader:
type | Meaning |
|---|---|
Static, or no field | The value is compiled into the shader. |
Dynamic | value is the default, and applications can change the value at runtime; see Change a parameter at runtime. Only float, vec3f, and vec4f variables can be dynamic. |
Any other type, or a dynamic Texture2D, fails the bake.
Variant files
| Field | Value |
|---|---|
parent | Required. The asset ID of the material this variant specializes. |
variables | Required. One object with name and value for parameters of the parent material. A static parent parameter without a value fails the bake; a dynamic one keeps the parent's default. Each value resolves with the parent parameter's data_type, and keeps the parent's type. |
transparency | "Blend" or true selects blended transparency. Any other value, or no field, selects opaque. |
Values
data_type selects how value resolves:
data_type | value |
|---|---|
vec4f | An array of four numbers, or a named color: Red, Green, Blue, Purple, White, or Black. Any other name resolves to the magenta placeholder (1, 0, 1, 1). |
vec3f | An array of three numbers, or a named color, as for vec4f, without the alpha component. |
float | A number. |
Texture2D | The asset ID of an image, which bakes as a dependency and is stored as a reference. |
Any other data_type, or a value of the wrong form, fails the bake.
What baking produces
- A
Materialresource for a root material file, referring to its generated shader and resolved parameters. - A
Variantresource for a variant file, referring to its parent material and resolved values. - A
Shaderresource generated from the graph for the active render pipeline, with the material's ID and a#shaderfragment. A graph that reads a parameter the material doesn't declare with a matching type fails the bake. - A dependent
Imageresource for each image aTexture2Dparameter names.