This project is is a demo of generating julia sets via visual recursion; an implementation of (this paper)[https://drive.google.com/file/d/1I1l62-SOnXvjGTQOm2Tiap3jKGBIOB34/view?usp=share_link]; it takes a video feed from your webcam and transforms every frame before rendering it to the screen. By pointing the camera that produces this transformed video feed at its own output, you can generate fractals in real time.
- Open application (double click). You will be warned that this application is unsafe.
- Go to Apple Menu > System Settings > Privacy & Security > Scroll down to "Security" section and click button to allow the application to run.
- Open the application (double click) again.
- You should see a video feed on your screen with a warped image from your default webcam.
- To generate the fractals, you'll have to pick a camera that you can point at the screen. This can be achieved in several ways. For the best effect, use the highest resolution camera and highest resolution screen you can.
- Use your iPhone as a Handoff/ContinutyCamera; if you have set this up, it should show up by default in the camera picker on the top left of the window. Select it, and point the camera at screen.
- Use a different external webcam, select it, point at screen.
- Move the window to an external monitor (whether connected via cable or wirelessly via AirPlay) and point the camera on your laptop at the external monitor. This is usually the most awkward.
- The fractal should morph and change as you move the camera, or move items in/out of the field of view of the camera. Play around! Adjust the settings to see how they impact fractal generation.
# Build distributable .app bundle
make app
# Launch the app
open .build/arm64-apple-macosx/release/JuliaSetCamera.app
# Install to /Applications
make installFor developers (CLI):
# Quick testing during development
swift run CameraDemo
# Build release binary
swift build -c release
.build/arm64-apple-macosx/release/CameraDemothe app will request camera access on first launch. grant permission when prompted.
# Compile Metal shaders (after editing .metal files)
make metallib
# Build .app bundle
make app
# Install to /Applications
make install
# Clean app bundle artifacts
make clean-app
# Run tests (headless, no camera needed)
swift testyou can use your iphone as a wireless webcam via continuity camera:
- ensure both your mac and iphone are signed into the same apple id
- enable wi-fi and bluetooth on both devices
- on your iphone, go to settings > general > airplay & handoff and enable "continuity camera"
- launch the app - your iphone should appear in the camera picker dropdown
- select your iphone from the list
requirements:
- macOS 13+ and iOS 16+
- both devices on the same wi-fi network
- iphone must be nearby and locked (or with the camera app closed)