AugmentedFaceNode

  • AugmentedFaceNode renders visual effects on a face detected by ARCore, using a face mesh for 2D images and a face regions renderable for 3D objects.

  • Visual effects are achieved by mapping 2D images onto the face mesh and attaching 3D objects to tracked face regions using a rigged model.

  • The node's position is automatically synchronized with the tracked face's pose, and effects are disabled when tracking is lost.

  • Developers can customize the appearance of the face mesh by overriding its material or applying a texture, while 3D object rendering is controlled through a separate ModelRenderable .

  • AugmentedFaceNode provides methods to manage the associated AugmentedFace , control visual effect components, and respond to lifecycle events.

public class AugmentedFaceNode

Node used to render visual effects on a face with ARCore's AugmentedFace feature.

The visual effects can consist of up to two components: The face mesh and the face regions renderable.

The face mesh is used for visualizing 2d images mapped to the surface of someone's face. The face regions renderable is used for visualizing 3d objects (e.g. fox nose and ears) that will move with the regions of the face that are tracked by ARCore.

When creating a face regions Renderable, the regions are mapped to bones in the model. Use the provided sample .fbx file to export a face regions renderable in the correct format.

This node is positioned to match the pose from getCenterPose() .

The visual effects will be disabled when the AugmentedFace isn't tracking or the AugmentedFace is set to null.

Public Constructors

*
AugmentedFaceNode ()
Create an AugmentedFaceNode with no AugmentedFace.
*
AugmentedFaceNode ( AugmentedFace augmentedFace)
Create an AugmentedFaceNode with the given AugmentedFace.

Public Methods

AugmentedFace
getAugmentedFace ()
Returns the AugmentedFace that this Node is applying visual effects to.
Material
getFaceMeshMaterialOverride ()
Returns the material currently overriding how the face mesh is rendered.
Texture
getFaceMeshTexture ()
Returns the texture rendered on the face mesh.
ModelRenderable
getFaceRegionsRenderable ()
Returns the Renderable that is mapped to the regions o the face.
void
onActivate ()
Handles when this node becomes active.
void
onUpdate ( FrameTime frameTime)
Handles when this node is updated.
void
setAugmentedFace ( AugmentedFace face)
Sets the AugmentedFace that this node is applying visual effects to.
void
setFaceMeshMaterialOverride ( Material material)
Sets the material used to render the face mesh.
void
setFaceMeshTexture ( Texture texture)
Sets the texture rendered on the face mesh.
void
setFaceRegionsRenderable ( ModelRenderable renderable)
Sets the Renderable that is mapped to the regions of the face.

Inherited Methods

Public Constructors

public AugmentedFaceNode ()

Create an AugmentedFaceNode with no AugmentedFace.

public AugmentedFaceNode ( AugmentedFace augmentedFace)

Create an AugmentedFaceNode with the given AugmentedFace.

Parameters
augmentedFace

Public Methods

public AugmentedFace getAugmentedFace ()

Returns the AugmentedFace that this Node is applying visual effects to.

public Material getFaceMeshMaterialOverride ()

Returns the material currently overriding how the face mesh is rendered. Defaults to null.

public Texture getFaceMeshTexture ()

Returns the texture rendered on the face mesh. Defaults to null.

Note: This is only used if the face mesh material hasn't been overridden.

public ModelRenderable getFaceRegionsRenderable ()

Returns the Renderable that is mapped to the regions o the face. It must be rigged with bones that match the face regions. Use the provided sample .fbx file to export a face regions renderable in the correct format.

public void onActivate ()

Handles when this node becomes active. A Node is active if it's enabled, part of a scene, and its parent is active.

Override to perform any setup that needs to occur when the node is activated.

public void onUpdate ( FrameTime frameTime)

Handles when this node is updated. A node is updated before rendering each frame. This is only called when the node is active.

Override to perform any updates that need to occur each frame.

Parameters
frameTime
provides time information for the current frame

public void setAugmentedFace ( AugmentedFace face)

Sets the AugmentedFace that this node is applying visual effects to.

Parameters
face

public void setFaceMeshMaterialOverride ( Material material)

Sets the material used to render the face mesh. The overriding material will not use getFaceMeshTexture() . Set back to null to revert to the default material.

Parameters
material

public void setFaceMeshTexture ( Texture texture)

Sets the texture rendered on the face mesh.

Note: This is only used if the face mesh material hasn't been overridden.

Parameters
texture

public void setFaceRegionsRenderable ( ModelRenderable renderable)

Sets the Renderable that is mapped to the regions of the face. It must be rigged with bones that match the face regions. Use the provided sample .fbx file to export a face regions renderable in the correct format.

Parameters
renderable
Design a Mobile Site
View Site in Mobile | Classic
Share by: