The Third Eye Awakening Snapchat lens in action

Role: Solo Programmer/3D Artist
Tools Used: Snapchat Lens Studio, Blender, Adobe Photoshop, FL Studio
The majority of the effect is driven by three custom shaders: The color-shifting effect, double image effect, and the render material for the Third Eye itself.
Color Shifting
This is using the hue rotation effect, where the screen's RGB colors are converted to HSV space and their hue is rotated by a certain amount. Normally this is done using color matrices to convert, rotate, then convert back. However, doing these matrix conversion calculations can be expensive to do every frame for an effect like this, so I used a more optimized function that uses an approximated constant instead, found on GitHub.

Color shift shader in Lens Studio

This shader has two exposed variables: a cycle rate and an effect amount. The cycle rate is a multiplier for the elapsed time node that is used as the hue in the equation:
(cycle rate * time elapsed) % (2 * pi)
The effect amount is a value clamped between [0, 1], and is used as a slider for the strength of the effect, so the shifting can be turned on/off. After the calculations are done, the original camera’s colors and the shifted colors are fed into a lerp node that determines how strong the color shift will be on the final render.
Double Image

Double image shader in Snapchat Lens Studio

This effect can be broken down into several parts. First, there is a zoom calculation to determine the UVs of the camera’s image after it’s been zoomed in or out. These UVs are then pushed as the input into a distortion effect, where the UVs are pushed either left or right determined by a distortion texture, to make the image look wavy. Lastly, the zoomed + distorted image is mixed with the original camera image to achieve the overlaid double image look.

Zoom sub-graph of distortion effect

The zoom simply scales the screen UVs to make the camera’s image appear larger/smaller. Some calculation is done so that the zoom happens at the center of the screen, UV = (0.5, 0.5). The zoom amount is left as an exposed variable that can be tweaked; values > 1 will zoom in, while values < 1 will zoom out.

Distortion sub-graph

The UVs from the previous zoom effect are then distorted according to the distortion texture. This texture is a seamless & repeating black/white gradient that is panned upwards infinitely. The color values from this map [0, 1] are remapped to be [-1 * distortion strength, distortion strength], and this amount is added to the horizontal value of the zoom UVs. So, the image is pushed to the left when in a black region, and pushed to the right when in a white region. The texture can be swapped out for different distortion effects, but the one shown is what resulted in the smoothed wave distortion seen in the final effect.
Lastly, the UVs from the zoom + distortion are mixed with the raw camera image to result in the wavy double image. The mix ratio is linked to the overall effect driver variable (halved to clamp between [0, 0.5] for the two images to be equally mixed when the effect is fully active).

Distortion texture

Third Eye
The material for the third eye is relatively simple: it uses a texture mask to determine whether it should show the galaxy background or the eye color. The eye is drawn onto the object normally with the eyeball object’s UVs, but the galaxy uses the screen UVs instead, so it will not follow the rotation of the head at all. I specifically chose this to make the eye seem more “otherworldly”, where it may be attached to the person’s head but is still part of something much larger than itself.

Eyeball shader in Snapchat Lens Studio

Background Music
I used an F# Phrygian mode as the scale to compose the music that plays when the effect is active. I picked this scale specifically because Phrygian modes are known for being used in “exotic” and “otherworldly” music, which matches what I was aiming for in this awakening effect. The sitar drives the main melody, as it is a staple of Egyptian/middle-eastern music. I used congas & tambourines to drive the tempo of the sound. Finally, I filled out the lower tones with a deep “ahh” chorus to portray a “godly” presence of the third eye.
This lens is published to Snapchat and is publicly available for anyone to unlock and use in their videos! Simply scan the code below to use the lens (or click here). This lens has been played over 900 times.
Back to Top