AR Art Attractors
A minimal iOS AR(Augumented Reality) app that displays 3D graphic arts in AR. It uses attractor systems.
An attractor is a set of states toward which a dynamic system tends to evolve, for a wide variety of starting conditions and parameters of the system.
The project includes four attractors and default parameters. Using the UI, users can change the parameters and find chaotic strange solutions. And also, they can modify the number of points ,animation speed, and colors, as they like.
- Clifford attractor
- de Jong attractor
- Hopalong attractor
- Lorenz attractor
The project:
- Xcode 13.4, Swift 5.5 (Swift Concurrency)
- Target: iOS / iPadOS 15.0 and later, macOS 12.0 and later on Apple Silicon
- Frameworks: SwiftUI, ARKit, RealityKit2, Metal
It shows:
- Procedural geometry generation with RealityKit2
- Custom Material generation with RealityKit2 and Metal
- Concurrent calculation with SwiftUI and Swift Concurrency
One small triangular pyramid is generated for each point in an equation. The pyramid consists of four vertices and four triangles as the face. For example, when creating 300,000 points, 1200K vertices and 1200K triangles are generated. ARKit and RealityKit display these 3d geometries in the realtime AR scene.
The project is a minimal implementation. Please modify it and make your own AR app!
The structure:
- Views: HomeView, FigureView, ARContainerView, etc.
- ViewModel: FigureSet, Figure
- AR Scene State Management: ARScene
- 3D Model Management: ModelManager, AttractorModel
- Data Model: Attractor, CliffordAttractor, etc.
- Metal: MetalLibLoader, surfaceShader
References
- Apple Documentation: Article Modifying RealityKit Rendering Using Custom Materials