Using the iOS Ambient Light Sensor in Unity

Our Seer Stone app, available for both iOS and Android, uses the ambient light sensor to trigger certain interactions. Unity provides direct support for the ambient light sensor in Android, but iOS is unfortunately still unsupported at the time of writing. Apple can’t imagine any profitable reason to provide you with access to such a thing and by extension Unity can’t implement it.

Seer Stone works by revealing secrets to the user only when they close out the surrounding light from the physical device. The app instructs users to put their device into something they can look into while closing out the surrounding light. We recommend putting your phone into your top hat, which you surely own. ou could, of course, use anything; a pillow case, your t-shirt pulled up over your head, get under a blanket, etc. Or, if you lack whimsy and color in your life you can just cover the front-facing sensor cluster on your phone with your thumb.

Supporting iOS presents a problem for this concept as any app accessing the ambient light sensor will be rejected from the app store. So how did we get around this limitation to make our app work?

In order to get the brightness of the scene, we access the front facing camera. Apple won’t give you the ambient light, but they will give you an estimation of the scene brightness of the image coming through a device camera. There are some subtle differences between how this method would work vs. ambient light, but it’s more than good enough for out purposes.

Unfortunately you will have to request camera permissions, which sucks if you don’t otherwise need those permissions. In my case, there are other features that use the external cameras so asking for permissions makes more sense.

This maybe seems straightforward for the genius developers out there, but it took my feeble brain a good long while to come up with. Being proud enough of my solution, I decided to release it as an asset on the Unity Asset store. Also, I had to pay another developer to write the swift code to make all this work so I’m wondering if it’s possible to actually recover my investment.

I priced the asset on the asset store at $20. I thought about it like this: how much would I be willing to pay to avoid the number of hours involved in solving this problem? I buy assets all the time if the math makes senes. I could recreate this function myself in 30 hours, or I could just buy an asset for $20. As an indie dev I think the economics make sense.

Our development philosophy is to go for what is maximally unexpected. We want to take all the sensors and information available to create an entirely unique and surprisingly contextual interaction in an unexpected way. There are infinite ways to do a thing and the normal way can be a surprisingly narrow paradigm.


Sam Garfielddevlog, unity, ios
A Better OneNote Web Clipper for iOS, iPadOS, Safari/Firefox/Chrome

The officially supported way of clipping web pages on iOS has some serious limitations - namely, it takes a poorly cropped image of as website, rather than giving you the options of clipping the article or full web page like on the desktop.

In the video below, I will show you how to get the OneNote Web Clipper desktop experience on iOS using a bookmarklet.

Copy and paste the code below.

Sam Garfield
Ridiculous Phone ND Filter
LRG_DSC04717.JPG

Move over RED, who needs a cinema camera and a bunch of dumb expensive lenses when you can shoot Hollywood features on your smartphone? The LG V30 (pictured here) shoots in 10 bit HDR LG Cine-LOG and captures 11 stops of dynamic range. Slap a fat stack of adapter rings onto your full size ND and you’re Roger Deakins!

Okay I’m probably not going to show up to my next job with this, but it is a lot of fun to play with.

Sam Garfield
Rokinon Cine DS 14mm T3.1 Lens Distortion Premiere Preset
rokinon_ds14m_c_ds_14mm_t3_1_cine_1409333903000_1078644.jpg

Rokinon Cine DS 14mm T3.1

Lens Distortion Premiere Preset

Adobe Photoshop, Camera RAW, and Lightroom all have built-in presets to correct the lens distortion of the Rokinon Cine DS 14mm T3.1. Premiere, for some reason, only has presets for GoPros and DJI drones. Unable to find any info online I made my own preset and am making it available here for archival purposes and in case anyone else is looking for it.

Ungraded. Left: Before. Right: After.

Ungraded. Left: Before. Right: After.

This is a fun lens to shoot with and correcting the slight fisheye gives another option on how the final shot can look.

Ungraded. Left: Before. Right: After.

Ungraded. Left: Before. Right: After.

This preset is so simple you don’t even need to download it. It’s probably easier to make. Just add the Lens Distortion (Video Effects > Distort) effect to your clip. In the effects controls set the curvature to -10 or -11. I like -10 but you can play with it and find what you like. Right click on the effect in the Effects Controls window and click “Save Preset…” It’s that easy!

If you’d rather just download a preset that does all this automatically, click here.