Sceneform asset file reference

The Sceneform Asset Definition (*.sfa) file is a human-readable description of the Sceneform Binary asset (*.sfb). It points to the models, material definitions, and textures in your source asset and also provides material parameters for Sceneform’s physically-based materials.

This file is automatically generated on first import by the Sceneform Android Studio plugin, but you can tweak the parameters to change the look of your asset. This reference describes attributes that you can configure to modify the look of your asset.

Syntax

{
   materials: [
      {
         name: "<name>",
         parameters: [
            {
               <parameterName>: <parameterDefaultValue>,
            },
            ...
         ],
         source: "path/to/source_material.sfm",
      },
      ...
   ],
   model: {
      attributes: [
         "Position",
         "TexCoord",
         "Orientation",
      ],
      file: "path/to/source_asset.ext",
      name: "<Name>",
     [scale: 1.0,]
     [recenter: false,]
   },
   samplers: [
      {
         file: "path/to/source_texture.ext",
         name: "<name>",
         params: {
            usage_type: "Color",
           [mag_filter: "Linear",]
           [min_filter: "NearestMipmapLinear",]
           [wrap_s: "Repeat",]
           [wrap_t: "Repeat",]
         },
         pipeline_name: "<pipeline_name>",
      },
      ...
   ]
}

Attributes

materials[].parameters

The contents of this block depend on the material definition specified by the source attribute. For default materials (*.sfm), see the list of supported parameters:

For custom materials (*.mat), the list of supported parameters is specified in the (*.mat) file. For more information, see the Custom Material Reference reference.

materials[].source
Specifies the material definition file, either a default material definition (*.sfm) or a Custom Material definition (*.mat).
model.attributes
Defines the set of exported vertex streams computed during import of the source model.
model.scale
Optional attribute controlling the scale of the exported model vs. the source asset contents. A scale of 2.0 will make the asset twice as big
model.recenter

Optional attribute, defaults to `false. Controls the positioning of the exported geometry. Possible values are:

Value Description
false The geometry will be exported as authored with no transformation.
true The center of the geometry will be placed at the origin.
"root" The geometry will be exported so it is horizontally centered over the origin, and vertically shifted so its lowest vertices are level with the origin. This can be used to ensure that an exported model positioned on an anchor or plane will be standing above this anchor point.
{x:float, y:float, z:float} The geometry will be exported such that the origin is placed according to the point indicated, where {x:0, y:0, z:0} corresponds to the minimum of the axis-aligned bounding box of the geometry, and {x:1, y:1, z:1} corresponds to the maximum of the axis-aligned bounding box of the geometry.
samplers[].params.usage_type
Defines how the runtime interprets the encoded image data. Setting this to "Color" for sRGB image textures. A value of "Data" or "Normal" tells the runtime to treat the contents of the image as if they are in linear space.
samplers[].params.mag_filter

Defines the minification filter used when the sampled mipmap is larger than the pixel size of the geometry sampling it. Possible values are:

Value Description
"Nearest" Corresponds to GL_NEAREST. Returns the value of the texture element that is nearest (in Manhattan distance) to the center of the pixel being textured.
"Linear" Corresponds to GL_LINEAR. Returns the weighted average of the four texture elements that are closest to the center of the pixel being textured. These can include border texture elements, depending on the values of texture wrap_s and texture wrap_t, and on the exact mapping.
samplers[].params.min_filter

Defines the minification filter used when the sampled mipmap is larger than the pixel size of the geometry sampling it. Possible values are:

Value Description
"Nearest" Corresponds to GL_NEAREST. Returns the value of the texture element that is nearest (in Manhattan distance) to the center of the pixel being textured.
"Linear" Corresponds to GL_LINEAR. Returns the weighted average of the four texture elements that are closest to the center of the pixel being textured. These can include border texture elements, depending on the values of texture wrap_s and texture wrap_t, and on the exact mapping.
"NearestMipmapNearest" Corresponds to GL_NEAREST_MIPMAP_NEAREST. Chooses the mipmap that most closely matches the size of the pixel being textured and uses the "Nearest" criterion (the texture element nearest to the center of the pixel) to produce a texture value.
"LinearMipmapNearest" Corresponds to GL_NEAREST_MIPMAP_LINEAR. Chooses the two mipmaps that most closely match the size of the pixel being textured and uses the "Nearest" criterion (the texture element nearest to the center of the pixel) to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.
"LinearMipmapLinear" Corresponds to GL_LINEAR_MIPMAP_LINEAR. Chooses the two mipmaps that most closely match the size of the pixel being textured and uses the "Linear" criterion (a weighted average of the four texture elements that are closest to the center of the pixel) to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.
samplers[].params.wraps

Optional attribute, defaults to "Repeat". Controls the horizontal wrapping behavior.

Value Description
"ClampToBorder" Corresponds to GL_CLAMP_TO_BORDER.
"ClampToEdge" Corresponds to GL_CLAMP_TO_BORDER.
"MirroredRepeat" Corresponds to GL_MIRRORED_REPEAT.
"MirrorClampToEdge" Corresponds to GL_MIRROR_CLAMP_TO_EDGE.
"Repeat" Corresponds to GL_REPEAT.
samplers[].params.wrapt

Optional attribute, defaults to "Repeat". Controls the vertical wrapping behavior.

Value Description
"ClampToBorder" Corresponds to GL_CLAMP_TO_BORDER.
"ClampToEdge" Corresponds to GL_CLAMP_TO_BORDER.
"MirroredRepeat" Corresponds to GL_MIRRORED_REPEAT.
"MirrorClampToEdge" Corresponds to GL_MIRROR_CLAMP_TO_EDGE.
"Repeat" Corresponds to GL_REPEAT.

Parameters for default materials

Sceneform provides three default material definitions: one for OBJ assets, one for FBX assets, and one for GLTF assets.

This section lists the material parameters supported by each default material definition.

obj_material

Parameter Description
baseColor <sampler_name>: Compute baseColor as the value from the sampler times the interpolated color

null: Compute baseColor as the interpolated color (or white if no interpolated color is present)

baseColorTint vec4: Applies a tint to the computed baseColor value. Color specified as [r, b, g, a]
metallic float: Controls the metallicity of the material. Use 0 for non-metallic materials, 1 for metallic materials
roughness `float: controls the roughness of the material. Use low roughness for shiny materials, high roughness for diffuse materials
opacity null: opaque

float: transparency enabled; 1.0 == fully opaque, 0.0 == fully transparent

fbx_material

Parameter Description
baseColor vec4: A tint factor on the result of baseColorMap. Specified as [r, g, b, a].
baseColorMap sampler_name: Result is the value of the baseColorMap sampler.

null: Resolves to White.

normalMap sampler_name: Interprets the sample result as a tangent-space normal, uses in lighting computations.

null: Use a constant [0, 0, 1] as our tangent-space normal.

metallic float: Controls the metallicity of the material. Use 0 for non-metallic materials, 1 for metallic materials. Scales metallicMap.
metallicMap sampler_name: Use the red channel value from the sampler as our metallicMap value.

null: Emit a constant 1.0 to be scaled by metallic.

roughness float: Controls the roughness of the material. Use low roughness for shiny materials, high roughness for diffuse materials. Scales roughnessMap.
roughnessMap sampler_name: Use the red channel value from the sampler as our roughnessMap value.

null: Emit a constant 1.0 to be scaled by roughness.

reflectance float: Controls the reflectance of a material. The default of 0.5 covers almost all possible materials.
opacity null: No explicit opacity control. If an opacity map was specified in the source data, the material will be rendered with transparent blending.

gltf_material

Parameter Description
baseColorFactor vec4: A tint factor on the result of baseColor. Specified as [r, g, b, a].
normal sampler_name: Interprets the sample result as a tangent-space normal, uses in lighting computations.

null: Use a constant [0, 0, 1] as our tangent-space normal.

metallicFactor float: Controls the metallicity of the material. Use 0 for non-metallic materials, 1 for metallic materials. Scales metallicRoughness.
roughnessFactor float: controls the roughness of the material. Use low roughness for shiny materials, high roughness for diffuse materials. Scales metallicRoughness.
metallicRoughness sampler_name: Use the green channel from the sampler for roughness (scaled by roughnessFactor). Use the blue channel from the sampler for metallic (scaled by metallicFactor).

null: Use metallicFactor and roughnessFactor.

occlusion sampler_name: Use the red channel from the sampler for ambient occlusion.

null: If the metallicRoughness texture is present, use the red channel to drive ambient occlusion.

emissiveFactor float: controls the emission of the material. Use 0 for materials which do not generate their own light. Scales emissive.
emissive sampler_name: Use the color from the sampler as our emissive value.

null: No emission.

reflectance float: Controls the reflectance of a material. The default of 0.5 covers almost all possible materials.
opacity null: no explicit opacity control. If alpha cutoff was specified in the source data, the material will be rendered with masked blending. If blending was enabled on the source content, transparency will be enabled.

Send feedback about...