AI-generated Key Takeaways
-
MaterialFactoryis a utility class used to construct defaultMaterials for rendering in Sceneform. -
It provides methods to create materials with color or texture, and with transparency options.
-
Materials created by
MaterialFactorycan be further customized by adjusting properties like metallic, roughness, and reflectance. -
Constants such as
MATERIAL_COLOR,MATERIAL_METALLIC,MATERIAL_ROUGHNESS, andMATERIAL_TEXTUREare used to access and modify material parameters. -
The class utilizes
CompletableFuturefor asynchronous material creation.
Utility class used to construct default Materials.
Constants
| String | MATERIAL_COLOR | Name of material parameter for controlling the color of makeOpaqueWithColor(Context, Color) and makeTransparentWithColor(Context, Color) materials. |
| String | MATERIAL_METALLIC | Name of material parameter for controlling the metallic property of all MaterialFactory
materials. |
| String | MATERIAL_REFLECTANCE | Name of material parameter for controlling the reflectance property of all MaterialFactory materials. |
| String | MATERIAL_ROUGHNESS | Name of material parameter for controlling the roughness property of all MaterialFactory materials. |
| String | MATERIAL_TEXTURE | Name of material parameter for controlling the texture of makeOpaqueWithTexture(Context, Texture) and makeTransparentWithTexture(Context, Texture) materials. |
Public Constructors
Public Methods
| static CompletableFuture<Material> | |
| static CompletableFuture<Material> | |
| static CompletableFuture<Material> | |
| static CompletableFuture<Material> |
Inherited Methods
Constants
public static final String MATERIAL_COLOR
Name of material parameter for controlling the color of makeOpaqueWithColor(Context, Color) and makeTransparentWithColor(Context, Color) materials.
public static final String MATERIAL_METALLIC
Name of material parameter for controlling the metallic property of all MaterialFactory
materials. The metallic property defines whether the surface is a metallic (conductor) or a
non-metallic (dielectric) surface. This property should be used as a binary value, set to
either 0 or 1. Intermediate values are only truly useful to create transitions between
different types of surfaces when using textures. The default value is 0.
See Also
public static final String MATERIAL_REFLECTANCE
Name of material parameter for controlling the reflectance property of all MaterialFactory materials. The reflectance property only affects non-metallic surfaces. This
property can be used to control the specular intensity. This value is defined between 0 and 1
and represents a remapping of a percentage of reflectance. The default value is 0.5.
See Also
public static final String MATERIAL_ROUGHNESS
Name of material parameter for controlling the roughness property of all MaterialFactory materials. The roughness property controls the perceived smoothness of the
surface. When roughness is set to 0, the surface is perfectly smooth and highly glossy. The
rougher a surface is, the âblurrierâ the reflections are. The default value is 0.4.
See Also
public static final String MATERIAL_TEXTURE
Name of material parameter for controlling the texture of makeOpaqueWithTexture(Context, Texture) and makeTransparentWithTexture(Context, Texture) materials.
See Also
Public Constructors
public MaterialFactory ()
Public Methods
public static CompletableFuture<Material> makeOpaqueWithColor (Context context, Color color)
Creates an opaque Material with the Color passed in. The Color can be
modified by calling setFloat3(String, Color) with MATERIAL_COLOR. The
metallicness, roughness, and reflectance can be modified using setFloat(String, float).
Parameters
| context | a context used for loading the material resource |
|---|---|
| color | the color for the material to render |
Returns
- material that will render the given color
public static CompletableFuture<Material> makeOpaqueWithTexture (Context context, Texture texture)
Creates an opaque Material with the Texture passed in. The Texture can
be modified by calling setTexture(String, Texture) with MATERIAL_TEXTURE. The metallicness, roughness, and reflectance can be modified using setFloat(String, float).
Parameters
| context | a context used for loading the material resource |
|---|---|
| texture | the texture for the material to render |
Returns
- material that will render the given texture
public static CompletableFuture<Material> makeTransparentWithColor (Context context, Color color)
Creates a transparent Material with the Color passed in. The Color can
be modified by calling setFloat4(String, Color) with MATERIAL_COLOR.
The metallicness, roughness, and reflectance can be modified using setFloat(String, float).
Parameters
| context | a context used for loading the material resource |
|---|---|
| color | the color for the material to render |
Returns
- material that will render the given color
public static CompletableFuture<Material> makeTransparentWithTexture (Context context, Texture texture)
Creates a transparent Material with the Texture passed in. The Texture
can be modified by calling setTexture(String, Texture) with MATERIAL_TEXTURE. The metallicness, roughness, and reflectance can be modified using setFloat(String, float).
Parameters
| context | a context used for loading the material resource |
|---|---|
| texture | the texture for the material to render |
Returns
- material that will render the given texture