ARVoxelKit - Lightweight Framework for Voxel graphic using AR + SceneKit

Overview

ARVoxelKit

Lightweight Framework for Voxel graphic using AR + SceneKit

Build Status

Requirements

ARVoxelKit requires iOS 11 and devices, which support ARKit

Usage

  1. Import libraries as follows:
import ARVoxelKit
import ARKit
import SceneKit
  1. Setup your ARSCNView with VKSceneManager manager in you ViewContoller:
var sceneManager: VKSceneManager?

@IBOutlet open var sceneView: ARSCNView! {
    didSet { sceneManager = VKSceneManager(with: sceneView) }
}

override open func viewDidLoad() {
    super.viewDidLoad()
    sceneManager.delegate = self
}

override open func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    sceneManager?.launchSession()
}

override open func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    sceneManager?.pauseSession()
}
  1. Conform your delegate instance to VKSceneManagerDelegate:
public protocol VKSceneManagerDelegate: class {
    var voxelSize: CGFloat { get }
    
    func vkSceneManager(_ manager: VKSceneManager, shouldResetSessionFor state: VKARSessionState) -> Bool
    func vkSceneManager(_ manager: VKSceneManager, didUpdateState state: VKARSessionState)
    func vkSceneManager(_ manager: VKSceneManager, didFocus node: VKDisplayable, face: VKVoxelFace)
    func vkSceneManager(_ manager: VKSceneManager, didDefocus node: VKDisplayable?)
    func vkSceneManager(_ manager: VKSceneManager, countOfVoxelsIn scene: ARSCNView) -> Int
    func vkSceneManager(_ manager: VKSceneManager, voxelFor index: Int) -> VKVoxelNode
}
  1. You can add/remove voxels by calling manager methods:
public func add(new voxel: VKVoxelNode)
public func add(new voxel: VKVoxelNode, to otherVoxel: VKVoxelNode, face: VKVoxelFace)
public func add(new voxel: VKVoxelNode, to tile: VKTileNode)
public func remove(_ voxel: VKVoxelNode)
  1. Edit surfaces, tiles, voxels using paint command:
public enum VKPaintCommand {
    
    case color(content: UIColor)
    case faceColor(content: UIColor, face: VKVoxelFace)
    case colors(contents: [UIColor])
    
    case image(content: UIImage)
    case faceImage(content: UIImage, face: VKVoxelFace)
    case images(contents: [UIImage])
    
    case gradient(contents: [UIColor], start: CGPoint, end: CGPoint)
    case faceGradient(contents: [UIColor], start: CGPoint, end: CGPoint, face: VKVoxelFace)
    
    case transparency(value: CGFloat)
    case faceTransparency(value: CGFloat, face: VKVoxelFace)
}

for example:

voxel.apply([.color(content: VKConstants.defaultFaceColor),
             .transparency(value: 1)], animated: true)
  1. Change default setup by changing VKConstants values

Example

Check our example by running ARVoxelKitExample target

You might also like...
PlacenoteSDK Sample app in native iOS using ARKit, written primarily in Swift

Placenote SDK for iOS Placenote SDK lets you easily build cloud-based Augmented Reality (AR) apps that pin digital content to locations in the real wo

 A library that allows you to generate and update environment maps in real-time using the camera feed and ARKit's tracking capabilities.
A library that allows you to generate and update environment maps in real-time using the camera feed and ARKit's tracking capabilities.

ARKitEnvironmentMapper Example To run the example project, clone the repo, and run pod install from the Example directory first. Installation ARKitEnv

Cut and paste your surroundings using AR

An AR+ML prototype that allows cutting elements from your surroundings and pasting them in an image editing software.

A minimal iOS AR app that displays a wave animation using RealityKit2 Geometry Modifier
A minimal iOS AR app that displays a wave animation using RealityKit2 Geometry Modifier

AR Simple Sea A minimal iOS AR app that displays a wave animation using RealityKit2 Geometry Modifier. Xcode 13.3 Target: iOS / iPadOS 15.0+ SwiftUI,

Smart Online Shopping iOS App with Augmented Reality (AR) and simple Social Media features using SwiftUI and Google Firebase Cloud Services
Smart Online Shopping iOS App with Augmented Reality (AR) and simple Social Media features using SwiftUI and Google Firebase Cloud Services

Table of contents App Demo How to Run Context Content How it's written Inspiration App Demo AR.online.shopping.iOS.demo.mp4 How to Run First make sure

Using ARKit and LiDAR to save depth data and export point cloud, based on WWDC20-10611 sample code
Using ARKit and LiDAR to save depth data and export point cloud, based on WWDC20-10611 sample code

Save iOS ARFrame and Point Cloud This project improves the usability of the sample code from WWDC20 session 10611: Explore ARKit 4. Note that the samp

A minimal iOS app that displays 3d graphic art in AR.
A minimal iOS app that displays 3d graphic art in AR.

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 st

SceneKit-MetalShader-SCNProgram - SceneKit MetalShader SCNProgram
SceneKit-MetalShader-SCNProgram - SceneKit MetalShader SCNProgram

SceneKit-MetalShader-SCNProgram Tech SceneKit (SCNProgram - SCNGeometry or SCNM

Swift framework for loading various 3d models in SceneKit

AssetImportKit AssetImportKit is a cross platform library (macOS, iOS) that coverts the files supported by Assimp to SceneKit scenes. Features AssetIm

Swift framework for loading various 3d models in SceneKit

AssetImportKit AssetImportKit is a cross platform library (macOS, iOS) that coverts the files supported by Assimp to SceneKit scenes. Features AssetIm

BioViewer - Protein (.pdb, .cif and .fasta) viewer for iPhone, iPad and Mac, using SwiftUI + SceneKit
BioViewer - Protein (.pdb, .cif and .fasta) viewer for iPhone, iPad and Mac, using SwiftUI + SceneKit

BioViewer - Protein (.pdb, .cif and .fasta) viewer for iPhone, iPad and Mac, using SwiftUI + SceneKit

Simple 360 Video player for iOS using SceneKit
Simple 360 Video player for iOS using SceneKit

simple360player_iOS Simple 360 Video player for iOS using SceneKit. VR ready. Stereoscopic Ready. We generate a simple scene in which we add a sphere

ARDicee - Simple augmented reality app using SceneKit and ARKit
ARDicee - Simple augmented reality app using SceneKit and ARKit

ARDicee Simple augmented reality app using SceneKit and ARKit Requirements Xcode

AR Ruler - A simple iOS app made using ARKit and SceneKit
AR Ruler - A simple iOS app made using ARKit and SceneKit

A simple iOS app made using ARKit and SceneKit.Which can try to simplify little things in your life such as measuring stuff.

Basic STL loader for SceneKit

HxSTLParser HxSTLParser is a basic STL parser capable of loading STL files into an SCNNode. Installing Via Carthage Just add it to your Cartfile githu

SpriteKit 2D Breakout Game on rotating 3D SceneKit cube almost no code
SpriteKit 2D Breakout Game on rotating 3D SceneKit cube almost no code

2D Breakout game playable as texture on a rotating cube An Xcode12 project for iOS that implements a simple 2D SpriteKit "Break Out" style game. The S

360 video player for iOS written in swift - a subset of SceneKit that works
360 video player for iOS written in swift - a subset of SceneKit that works

DDDKit An open source library to support 360 videos and pictures. It's designed as a generic 3D library that you can use for much more! Example of use

SwiftUI & Scenekit hit testing example.

HitTestApp SwiftUI & Scenekit hit testing example. This example application is written for macOS, though with minor changes it should be able to be ch

DroneShopSwiftUI - Drone Shop App made with SwiftUI and Scenekit
DroneShopSwiftUI - Drone Shop App made with SwiftUI and Scenekit

DroneShopSwiftUI Drone Shop App made with SwiftUI and Scenekit.

Comments
  • Conversion to swift 5 and getting the app to compile again

    Conversion to swift 5 and getting the app to compile again

    Hi!

    I'm really excited to work with ARVoxelKit! It's exactly what I've been looking for.

    I'm very new to XCode, Swift, and iOS development in general (but have been a full-stack web dev for about 6 years), so am stumbling a bit trying to get this repo to compile on the newest release of XCode and Swift. I'd really love to help build up and maintain this library, as the general concepts within are a core part of some personal projects I want to work on.

    I'm wondering if you have any plans to update this library so that it can compile and run again. I'd love to help too and would be thrilled if you are able to pair on the task over zoom.

    Regards, Alex

    opened by alexevanczuk 0
Owner
null
Swift framework for loading various 3d models in SceneKit

AssetImportKit AssetImportKit is a cross platform library (macOS, iOS) that coverts the files supported by Assimp to SceneKit scenes. Features AssetIm

eugene 74 Nov 30, 2022
ARDicee - Simple augmented reality app using SceneKit and ARKit

ARDicee Simple augmented reality app using SceneKit and ARKit Requirements Xcode

donggyu 3 Feb 4, 2022
AR Ruler - A simple iOS app made using ARKit and SceneKit

A simple iOS app made using ARKit and SceneKit.Which can try to simplify little things in your life such as measuring stuff.

Dishant Nagpal 5 Aug 31, 2022
ARID - Augmented Reality app using Apple’s ARKit framework which can recognise faces of famous scientists

ARID Augmented Reality app using Apple’s ARKit framework which can recognise fac

Hemanth 0 Jan 12, 2022
An iOS Framework Capture & record ARKit videos 📹, photos 🌄, Live Photos 🎇, and GIFs 🎆.

An iOS Framework that enables developers to capture videos ?? , photos ?? , Live Photos ?? , and GIFs ?? with ARKit content.

Ahmed Bekhit 1.5k Dec 24, 2022
SwiftAR is a declerative framework to build AR experiences, with a SwiftUI inspired design.

SwiftAR is a declerative framework to build AR experiences, with a SwiftUI inspired design. It builds on the base types Experience, Anchor and

Jan Luca Siewert 49 Jun 10, 2022
A sample collection of basic functions of Apple's AR framework for iOS.

RealityKit-Sampler RealityKitSampler is a sample collection of basic functions of RealityKit, Apple's AR framework for iOS. How to build 1, Download o

MLBoy 74 Dec 21, 2022
IOS example app to generate point clouds in ARKit using scenedepth

Visualizing a Point Cloud Using Scene Depth Place points in the real-world using the scene's depth data to visualize the shape of the physical environ

Isak Diaz 20 Oct 31, 2022
It is a music and podcast creation system that enables users to create multiple tracks using AR(Augmented Reality).

AR-Studio It is a music creation system enables users to create multiple tracks using AR(Augmented Reality). Introduction AR Studio turns your iPad, a

Ayush Singh 5 Dec 3, 2022
A library that allows you to generate and update environment maps in real-time using the camera feed and ARKit's tracking capabilities.

ARKitEnvironmentMapper Example To run the example project, clone the repo, and run pod install from the Example directory first. Installation ARKitEnv

SV Hawks 91 Dec 4, 2022