Originally, I had planned to develop an app that collected magnetic field data from an external sensor to be sent via Bluetooth to a phone to be plotted in Augmented Reality. I've worked on similar projects in the past, but I had never dealt with Bluetooth communication from a microcontroller before. I had banged my head against this problem until 12am on Sunday when I realized that even if I cracked the code of Bluetooth, I wouldn't have time to finish the project before the deadline, and as such, I pivoted. After some quick thought, I realized that I could use the work I had already done with the Augmented Reality architecture to make a drawing app. Everything you see here was effectively made by me, alone, in 5 hours in a mad dash to submit in time for the deadline.
What it does
AR Paint is an app similar to TiltBrush but for Augmented Reality as opposed to Virtual Reality. A user can utilize a Sunhacks sticker as an AR target to serve as a brush to paint beautiful pictures and create fantastical sculptures in 3D space! The user can also change the size of the brush as well as the colour of the 3D objects created!
How I built it
This application was made using the ARFoundation framework in Unity. ARFoundation is a powerful framework that allows for tracking of ambient planes as well as specified image markers to maintain extended placement of Augmented Reality objects in physical space.
Challenges we ran into
As I said in the beginning, For the first 28 hours of Sunhacks, I was building something completely different and unrelated to this, the roadblocks along that path led me to pivot my project completely during the last morning of Sunhacks. I started working on AR Paint at 1 am on Sunday with only 4 lines of code from the project I had been working on all weekend to be usable in the new project.
Accomplishments that we're proud of
Firstly I'm proud of how quickly I was able to throw something so genuinely fun and entertaining together, secondly, I'm proud of the 3D line plotting code I made that I am very likely to use in my future Unity projects. Unity had a 2D line renderer feature that works great in any application in which the player's view is unlikely to move and see the lines from unique angles and up close. Since I was working in augmented reality, wherein users are extremely likely to explore around the rendered lines. I had to program my own tool to take an array of Vector points and create cylinders to plot a line between them all to serve as the main drawing effect for AR Paint. This is a very ubiquitous tool that I will probably be releasing as a Unity plugin after some further development. Also, I am proud that I was able to figure out a way to use a Sunhacks sticker as the augmented reality target for the app! I hope that many people will get the chance to demo AR Paint because of this accessibility feature.
What we learned
I learned that magical things can come out of desperation. Also, while Sunhacks is a great place to learn new frameworks, devices, languages, etc. I was able to create AR Paint so quickly because I am very comfortable with Unity. For the next Sunhacks, I plan to use frameworks that I am familiar with because I want to see what I can create if I'm able to spend the entire hackathon working without worrying about delving too deep into foreign documentation.
What's next for AR Paint
I plan on making a system to export drawings and maybe display all saved drawings on the user's phone in an AR gallery of sorts. That would be amazing!
Note for Judges and Anyone Performing a Code Review
Upon viewing my source, you will find a lot of extraneous and old code here. Unity was acting strangely this weekend and it wouldn't let me create a new ARFoundation project, I believe there was a dependency issue with the new version. Because of this, I built this app in the same Unity folder as my submission to Sunhacks last year. All of the code for that project is included in the Github for this project (I didn't have time to delete it all, due to the aforementioned mad dash I've been in for the past 6 hours). However, while all the old code is sitting unused in this project, I can assure you that all the code being utilized was created during the Sunhacks 2021 hacking period.