AR Preview Implementation for NFT Art in Mobile Applications
An NFT collector purchased 3D animated art. Viewing it in browser in 2D is uninteresting. AR feature in mobile app lets them "hang" NFT on their wall or place 3D sculpture on table—see how it looks in real space. Adds value to NFT as physical collectible.
NFT Content Types and AR Rendering
2D NFT (JPEG/PNG/GIF). Simplest: create virtual frame (SCNPlane with material), load texture from IPFS or HTTP URI from token metadata. Place on vertical surface via ARPlaneDetection.vertical. Animated GIF—decode frame-by-frame via CGImageSourceCreateWithData, update texture per timer.
3D NFT (glTF/GLB). More projects release 3D sculptures. On iOS load via GLTFSceneKit or convert to USDZ on-the-fly via ModelIO → MDLAsset → USDZ export. On Android—SceneView (Filament-based) from Sceneform 2.0 natively supports glTF.
Video NFT (MP4/WebM). SCNMaterialProperty accepts AVPlayerItem as texture content—NFT video plays directly on AR surface in real-time. Loop, sound optional.
Getting Content via NFT Metadata
ERC-721/ERC-1155 metadata standard contains image and optionally animation_url. Steps:
- By
tokenIdandcontractAddressrequesttokenURIvia JSON-RPC (eth_call) or Alchemy/Moralis/OpenSea API - Get metadata JSON with
image,animation_url,properties - If URI starts with
ipfs://—convert via public gateway (https://gateway.pinata.cloud/ipfs/...) or own IPFS node - Load media file, cache locally
IPFS loading can be slow on public gateways. Recommend aggressive caching: on first view write to URLCache with large diskCapacity (500 MB+).
AR Placement for Art Objects
Wall hanging (2D art). Scan vertical surface via ARPlaneDetection.vertical. Problem: ARKit slower detecting vertical planes than horizontal, especially on smooth walls. Add manual placement mode: drag on screen for positioning, pinch for scale, rotation gesture for angle.
3D sculpture on surface. ARPlaneDetection.horizontal + raycast from screen center → place object on detected plane. ARRaycastQuery instead of deprecated hitTest. Snap to plane when moving: track ARPlaneAnchor updates, pin object Y-coordinate to plane.
Photos for social media. Key feature for NFT audience. Snapshot ARView via ARView.snapshot(saveToPhotoLibrary:) (RealityKit) or SCNView.snapshot() (SceneKit). Add UI overlay with NFT name and collection over image before saving—via UIGraphicsImageRenderer.
Rights and Watermark
Some NFT projects restrict commercial use. In AR context important not to violate IP rights when creating derivative content (screenshots with app logo not considered derivative work, but consult lawyer for specific project).
Timeline: AR preview for 2D/3D NFT in existing Web3 app—3–5 weeks. Full AR gallery experience with custom frames, 3D sculptures, sharing—6–10 weeks. Cost calculated individually.







