Saturday, October 31, 2015

Our Pando ephermoral messaging app is private!

SnapChat has gotten a lot of bad press for its privacy policy lately.   It is likely overblown, but our Pando app (download links here) not only has a great privacy policy, we can't see your photos if we wanted to (we don't have the keys).

Here's they key bit of our policy:

Thursday, October 22, 2015

Seeking minimal sample program for head coupled motion

I am seeking your help!

I am working on a fishtank VR demo.   I have been looking at various engines and APIs and so far none of them have a very general camera model.   Most give me the ability to hardwire the viewing matrices, but I figure that if I do that maybe I should just use GLUT-- I don't want the disadvantages of a high level framework unless I also avoid low-level programming.

Here is a nice discussion of this for game engines.   Note it may be out of date but a really nice paper.   Since I am doing mono fishtank VR, this paper calls that "head couple motion" which I think is a term I will adopt-- it's very descriptive.    What I need in the camera is the ability to shear off the center of the screen (perhaps a lot), e.g.:

This is straightforward (if easy to mess up) to do with projection and other matrices.   Three.js does allow this functionality but only indirectly using a tile of screens analogy.

So what I want is one of two things:
  1. A simple GL or similar sample program that does this for some cool model or even just an environment map
  2. A high level toolkit that supports this naturally
If it has tracking from a camera bonus, but not essential.

Tuesday, October 20, 2015

Fishtank VR viewing in Three.js

I am working on a "Fishtank VR" prototype and asked around and a lot of people told me Three.js is the easiest API for 3D prototyping.   So last night I dug into learn it (and found and watched some of this cool udacity course from Eric Haines on graphics using Three.js as a vehicle for much of it).   I just started using it and dealing with the camera API is where I need to invest some classic graphics API wrangling.   Whenever you want to do something "weird" with a camera, that is where some pain will lie.

Here is the camera API for Three.js.

What I want for fishtank VR is ideally an API that allows me to specify viewpoint in some physical units (like meters), and the location of the physical rectangle of the screen is real physical units (like the position of one corner and the vectors of bottom and side).   Most camera APIs do not have this directly, so the question is can you get at them indirectly, or do you have to make your own from scratch.

The most general camera in Three.js is the perspective camera.   This method is what I will need to use if this is to work:

This appears to be when you have a wall of tiled screens.  But happily the API designer made it a little more general.      All I need to do is manage the relative position of the eye and the "portal",   So I think this can be made to work.

Friday, October 16, 2015

Final post on the Prismatic color model

This is the last in a series of posts on the Prismatic color space Dave Hart and I produced for the Subjective iPhone photo editing app.   I have written previously on the "Zorn" palette.   Here I will show doing color grading to it by projecting to its hue boundaries which gives a good idea of how one might use the barycentric hue space.

If we assume red, yellow, and neutral as our primaries this means we want to restrict our hues to this triangle:

 There are lots of ways to project hues to that triangle, with this one being better at projecting greens to yellows which is less disruptive in practice:

The Zorn palette is usually used when there is no blue (like a sky) but let's do it out of its comfort zone for fun:

Thursday, October 15, 2015

Adjusting color temperture in prismatic color model

Another post on the prismatic color space Dave Hart and I have developed for the Subjective iPhone photo editing app.   This post is about changing color temperature (white point) in that model.  

Suppose you want to move a color C to white.   In the prismatic space you do this in the hue cross section.   The most direct way is just to add the barycenric of white and subtract the barycentric of C.   That works, but will make some hues move out of the triangle.   For that the simplest method is to clamp and renormalize.   I searched for "tungsten" at flickr and found a yellow photo.  This one is clearly on purpose, but still a good example.

Now we can apply a shift to all hues:
The code for this shift/clamp/renormalize (with a vec3 C++ class) is:
The (22,18,10) was just one tenth of the 8 bit RGB color of the back wall.   The one tenth is to allow me to do arithmetic in my head.

Wednesday, October 14, 2015

Saturation in prismatic color model

In my last post I described the prismatic color space Dave Hart and I have developed for the Subjective iPhone photo editing app.   This post is about changing saturation in that model.   

An hue C is on some line between a neutral hue N and the most saturated (pure) one P on the triangle boundary.   The saturation is the fraction of the distance along the line (0 for neutral, 1 on the boundary, about 0.25 for the example below):
The lines of constant saturation are just inscribed triangles:
These are also just isolines of the smallest barycentric coordinate, which will always vary from 1/3 at N to 0 on the boundary.  This suggests the saturation s is:

s = 1 - 3*min(rho, beta, gamma)

The pure color P is just at s = 1, and the color C can be expressed:

C = N + s(P-N)


P = N + (C - N)/s

Now that we know P, we can change s to a new value s' and apply the formula

C = N + s'(P-N)

Let's apply that.   Here's a picture from flikr:

And if we compute s at every pixel and replace it with pow(s, 0.7) keeping it in [0,1] but making it bigger we get a slightly more saturated version:

Prismatic color model

Note: this model has taken over all of my code.  We decided we should share it.   I love it!  Try it!

In our Subjective photo processing iPhone app (please buy it and rate it!), we have to manipulate color in all the classic ways (and a few others).   For example, increase saturation.   I was very dissatisfied with all the color models commonly used in graphics.

One candidate was some general space like the CIE diagram.   But like many applications we have an RGB space that starts and ends in RGB, so a simple gamut is good.    The classic one is a cylinder of some kind such as HSV :

The two most common cone RGB spaces (from an excellent wikipedia article)

The practical problems with these spaces for my purposes are 1) intermediate colors such as yellow are not along a line from two colors that make them (red and green), and 2) computationally getting to and from the RGB cube is not that simple.

I hired Dave Hart as a consultant (who with Grue DeBry has founded a cool company Limnu developing collaborative white boards) to help my find the right space.   Dave really liked this barycentic space for the hue part.    Turns out this hue space is often used in computer vision because it factors out illumination and is good for getting a crude albedo transform.   Here's a figure with that space on the right from a paper draft Dave and I may submit someday:
The barycentric Maxwell space has the nice linearity properties of the also barycentric CIE space.   The good news is barycentrics are something graphics people are comfortable with.    They coordinates map nicely to the intuition of RGB mixing:
Here neutral is (1/3, 1/3, 1/3).   Red is (1, 0, 0).    The greek letters we use for the barycentrics are (rho, gamma, beta).   A basic issue is what do we use for the lightness channel.   For example, HSL and HSV above have different ideas.   We go with the HSV approach so that pure colors have a lightness of 1.0.   There are endless debates on this, and we like the pure colors are "light" approach because the computation and intuition are nice, and because lightness is a hard concept anyway once things get colorful as I discuss in a previous post.

The computation for getting to and from this space is awesomely simple (and KISS is good!!!):

I will post some of the ways I use it in a later post.

Monday, October 12, 2015

New iPhone app up

We've just updated our main iPhone photo editing app, Subjective, to include reworks of our most successful filters.   It uses a new color space we've developed that I will post more on later this week.

We'll be updating the UI to our new design, but the basic flow and the filters we provide will stay the same.

Please go buy or update the app for $2.99 and RATE IT.   I'll buy you a beer when show me the app on any phone :)   This  is what I am up against, so I need your help.