Post news RSS Fourth Blog: The Polaroid

A mysterious Polaroid camera which can alter reality...

Posted by on

Hey IndieDB,

I've been working hard on a nifty little mechanic I call "the Polaroid", and I wanted to share my progress and explain how it works.

I won't go into as many technical details as the previous blogs, because it's a bit heavier on the math, and would require many more screenshots of blueprints and materials, but if anybody is interested feel free to leave a comment or message me!

So essentially what the Polaroid does is show you an "alternate reality" through its viewfinder. When you take a picture, this alternate reality is "frozen in time" (for what will be a limited time) allowing you to traverse obstacles or collect items.

And here's what it looks like:

So how does it work?

It's basically a material trick 😅

Every object that should "swap realities" is in fact using a Masked material. Each frame, the Polaroid blueprint calculates the vectors that represent its view, and updates the material with this information.

Using the Polaroid's view information and a bunch of math, the material can then determine whether a given pixel is visible through the Polaroid's viewfinder or not.

When a picture is taken, I simply stop updating the material with the Polaroid's view information, which results in objects remaining in the state they were when the picture was taken.

The last step is to then update collisions based on how much of the object is visible when a picture is snapped (which means it won't work as well with large objects - as you can't technically "cut a hole" in an object, the entire object either collides, or it doesn't - but that's a limitation I can work around by stitching smaller objects together, and it greatly optimizes performance).

And there you have it, a mysterious reality-altering Polaroid camera which can be used to reveal hidden items or ways to traverse a level 😄

Have a great week-end everyone!

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.