AR face masks and filters implementation

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
AR face masks and filters implementation
Complex
~3-5 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1054
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Implementing AR Face Masks and Filters

Masks and filters are the most common face AR scenario. Snapchat, Instagram Reels, TikTok have conditioned users to a certain quality level. If mask "slides" when head turns or doesn't react to facial expression — user deletes app. Technically task is solved well by ARKit/RealityKit, but there are nuances with occlusion, animation, and video recording.

Types of Masks and Their Technical Implementation

Geometric mask — 3D mesh stretched over face following its deformations. Most realistic variant. In RealityKit: ModelEntity with skinned mesh, joints of which are tied to ARKit blendShapes:

// Face Anchor as root
let faceAnchor = AnchorEntity(.face)

// Load USDZ with morph targets matching ARKit blendShapes
let maskEntity = try! ModelEntity.load(named: "zombie_face.usdz")
faceAnchor.addChild(maskEntity)
arView.scene.addAnchor(faceAnchor)

// In update loop — apply blendShapes to mask morph targets
func session(_ session: ARSession, didUpdate anchors: [ARAnchor]) {
    guard let faceAnchor = anchors.first as? ARFaceAnchor else { return }
    // BlendShape mapping: ARKit jawOpen → mask jaw morph target
}

Flat sticker/overlay — 2D image or video tied to face anchor. Simpler to implement, fewer deformations. Good for frames, "hats", fake mustaches.

Particle effects — particles tied to face points (sparks from eyes, smoke from mouth when jawOpen > 0.3). In RealityKit — Entity with custom particle system via Reality Composer Pro.

Face Occluder: Mask Occludes Real Objects

Main technical nuance — virtual mask elements (horns, crown, glasses) must be occluded by real face where physically correct. Crown goes behind head — back of head occludes it. Glasses "sit" on nose — nose on top of frames.

In ARKit/RealityKit — occluder mesh: copy of face geometry with .occlusion material. Mesh invisible to user but writes depth to depth buffer. Elements "behind" face are properly occluded:

// Occluder entity — invisible copy of face
var occluderMaterial = OcclusionMaterial()
let occluderEntity = ModelEntity(
    mesh: .init(arFaceGeometry: faceAnchor.geometry),
    materials: [occluderMaterial]
)
faceAnchor.addChild(occluderEntity)

Without occluder horns stick through head from any angle — looks cheap.

Animation by Facial Expression

52 blendShapes ARKit → mapping to 3D mask morph targets. Standard scenario: zombie mask opens mouth on jawOpen, squints eyes on eyeBlinkLeft/Right. Mesh mask should have corresponding morph targets with same names or via mapping table.

Reality Composer Pro lets you set BlendShapeWeightsMapping directly in USDZ without code. For complex animations — custom update in ARSessionDelegate:

// Pass blendShapes to mask shader parameter
maskEntity.model?.materials[0].setParameter(
    name: "jawOpen",
    value: .float(faceAnchor.blendShapes[.jawOpen]?.floatValue ?? 0)
)

Recording Video with AR Mask

RPScreenRecorder (ReplayKit) — records entire screen including AR view. Simple, but low quality (records what's on screen, including UI elements). For clean AR camera recording — ARView.session + custom CVPixelBuffer render via Metal:

// Composite: camera frame + AR overlay → CVPixelBuffer
// → AVAssetWriter → .mp4

More complex, but gives clean recording without UI overlay and with choice of resolution.

Lens Studio / Spark AR as Alternative

If goal is viral filter for Snap/Instagram/TikTok, not own app: Lens Studio (Snap) and Meta Spark (Instagram) provide effect development environments without native code writing. Effects published on platform and available to users in native apps.

For custom mobile app with own camera — only native implementation or Banuba Face AR SDK.

Timeline

Basic mask (static 3D mesh, no blendShape animation) — 4–6 days. Animated mask with face occluder and 3–5 blendShape reactions — 2–3 weeks. Video recording + mask gallery with cloud upload — another 2–3 weeks. Cost calculated individually.