# Quilts

## Overview

Quilts are an image standard that Looking Glass uses to produce 3D experiences. This standard is used to describe both still and moving images (pictures and videos). Here is an example quilt formatted for [**Looking Glass Portrait**](https://lfdocs.lookingglassfactory.com/getting-started/portrait).

![Space Nap by Jane Guan](https://content.gitbook.com/content/PuCaeVAli72TiclYlEG5/blobs/tiYvM3CJqkdKaAk5Ofcy/Jane_Guan_Space_Nap_qs8x6.webp)

The main benefit of the quilt format is that it can work for both images and videos! Quilts allow for an efficient way to store frame by frame data as `.mp4`, `.webm` or other common media formats. They're also compact. for example, the above quilt was compressed to be under 1MB of data!

**Quilts serve a few purposes:**

* to save and retrieve images displayed in a Looking Glass (similar to image & video screenshots for 2D monitors)
* as a compositing step in Looking Glass render pipelines found in our developer tools
* as a format to work against to manually produce light field photos / videos

## Format

Each tile in the quilt is a conventional 2D image of a scene. The bottom-left tile of the quilt (view 0) is the leftmost view of the scene, and the top-right tile is the rightmost, like so:

![Quilt Format](https://content.gitbook.com/content/PuCaeVAli72TiclYlEG5/blobs/zQJbXHNDJkYIdgAXJj5Z/quilt_format.png)

## Quilt Settings by Device

Our different devices have the following quilt settings that are optimal for real-time rendering contexts:

<table><thead><tr><th width="418">Device</th><th width="103" data-type="number">Columns</th><th width="87" data-type="number">Rows</th><th>Resolution</th></tr></thead><tbody><tr><td>Looking Glass Go</td><td>11</td><td>6</td><td>4092 x 4092</td></tr><tr><td>Looking Glass Portrait</td><td>8</td><td>6</td><td>3360 x 3360</td></tr><tr><td>Looking Glass 16" Light Field Display (Landscape)</td><td>7</td><td>7</td><td>5999 x 5999</td></tr><tr><td>Looking Glass 16" Light Field Display (Portrait)</td><td>11</td><td>6</td><td>5995 x 6000</td></tr><tr><td>Looking Glass 27" Light Field Display (Landscape)</td><td>8</td><td>6</td><td>7680 x 4320</td></tr><tr><td>Looking Glass 27" Light Field Display (Portrait)</td><td>12</td><td>4</td><td>7680 x 4320</td></tr><tr><td>Looking Glass 32" Light Field Display (Landscape)</td><td>7</td><td>7</td><td>8190 x 8190</td></tr><tr><td>Looking Glass 32" Light Field Display (Portrait)</td><td>11</td><td>6</td><td>8184 x 8184</td></tr><tr><td>Looking Glass 65" Light Field Display</td><td>8</td><td>9</td><td>8192 x 8192 </td></tr></tbody></table>

This standard may be applied to any conventional image or video file type. The most common are `jpg`, `png`, `gif`, `mp4`, `mov`.

## File Naming Conventions

Most Looking Glass integrations output Quilts with the following naming structure:

### `filename_`<mark style="color:blue;">**`qs`**</mark>*`Columns`*<mark style="color:blue;">**`x`**</mark>*`Rows`*<mark style="color:blue;">**`a`**</mark>*`AspectRatio.mp4`*

A quilt designed for Looking Glass Portrait with 8 columns and 6 rows would look like this:&#x20;

### `filename_qs8x6a0.75.mp4`

This allows our software like Looking Glass Studio to automatically import the quilt with the proper number of columns & rows, along with setting the proper aspect ratio. The Looking Glass Portrait has an aspect ratio of 4:3, which equates to 0.75. Looking Glass 16" & 32" systems have a 16:9 aspect ratio, which equates to a value of 1.777.

## Generating a Quilt from a Set of Images

### Using FFmpeg

If you have a set of images rendered with view shearing, as in our tutorial on [rendering light fields in Maya](https://lfdocs.lookingglassfactory.com/community/capturing-light-fields-in-maya), they can be combined to create a quilt. View shearing is a complex topic if you're unfamiliar with 3D graphics, but you can see our documentation on how to apply view shearing [here](https://lfdocs.lookingglassfactory.com/camera#offset), [here](https://lfdocs.lookingglassfactory.com/community/capturing-light-fields-in-maya#moving-the-camera), and [here](https://lfdocs.lookingglassfactory.com/capturing-a-lightfield#light-field-capture), and a more general description on Wikipedia [here](https://en.wikipedia.org/wiki/Shear_mapping).

{% hint style="warning" %}
If you try to generate a quilt from images without view shearing, you will get an artifact called toe-in, which leads to suboptimal visuals.

See our documentation on how to apply view shearing [here](https://lfdocs.lookingglassfactory.com/camera#offset), [here](https://lfdocs.lookingglassfactory.com/community/capturing-light-fields-in-maya#moving-the-camera), and [here](https://lfdocs.lookingglassfactory.com/capturing-a-lightfield#light-field-capture), and a more general description on Wikipedia [here](https://en.wikipedia.org/wiki/Shear_mapping).
{% endhint %}

If your views are correctly set up, you can generate a quilt from them using the following FFmpeg command:

`ffmpeg -i input_%03d.png -filter_complex "vflip,tile=8x6,vflip" quilt_qs8x6a0.5625.png`

Change the input file name to match your image set naming convention, and change the `tile` value and the quilt naming (`qs` and `a`) to match your actual content.

Note that FFmpeg will throw an error if the resulting quilt is greater than 16K by 16K — in that case, you'll need to resize your images.

The above command applies a filter that first flips the individual images vertically, then tiles them together from top left to bottom right, and then flips the resulting image vertically again. This double vertical flip is required because the `tile` command in FFmpeg goes from the top left to the bottom right, while quilts go from the bottom left to the top right.

### Using Looking Gloves Web App

You can also view light field sets and export them as quilts from a web app made by [**Oscar Tong**](https://blocks.glass/moscartong)**.**&#x20;

{% embed url="<https://lkg.vercel.app/images>" %}

This tool can be used to generate quilts from light fields that have been generated with view shearing or with a linear rail capture method. Select all the images in your light field set and upload them to the tool. You'll can focus and crop the light field, but once you've done that, you'll can export a quilt file.

## Legacy Device Quilt Settings

<table><thead><tr><th>Device</th><th width="103" data-type="number">Columns</th><th width="87" data-type="number">Rows</th><th>Resolution</th></tr></thead><tbody><tr><td>Looking Glass 16"</td><td>5</td><td>9</td><td>4095 x 4095</td></tr><tr><td>Looking Glass 32"</td><td>5</td><td>9</td><td>8190 x 8190</td></tr><tr><td>Looking Glass 8.9"</td><td>4</td><td>8</td><td>2048 x 2048</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lfdocs.lookingglassfactory.com/keyconcepts/quilts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
