picture home | art | events | music | rack extensions | downloads | pixel blog | qt_tools

omino pixel blog

pixels, motion, and scripting
david van brink // Wed 2015.03.4 17:03 // {dome}

Note on om_sphere2dome

As introduced in yesterday’s post, you can download my Mac command line tools, om_sphere2dome to help convert Modo spherical projection images to fulldome domemaster images.

For reference, I’ll here post the tool’s help info, so you can see its feature set more easily.

poly@omino-8999 domework: om_sphere2dome --help

om_sphere2dome

This command line tool transforms a spherically-projected
image file to a Domemaster image file (180 degree fisheye).
The source image is a 2:1 aspect ratio equirectangular
projection, as produced by Modo's spherical camera. The
center square is extracted and transformed.

See http://omino.com/pixelblog/2015/03/03/modo-for-fulldome-
part-2/

--help
Optional. Show help.

--infile=<file name>
Required. A source .png or .jpg image, 2:1 aspect ratio,
spherically projected.

--outfile=<file name>
Required. The output .png or .jpg image to write, square,
Domemaster projection.

--vflip=<yes or no>
Optional. Vertically flip the image.

--size=<number>
Optional. Size of output image.

--azimuth=<number>
Optional. Shifts view negative-left or positive-right
in degrees.

Written by david.van.brink@gmail.com, 2015. Uses Lode Vandevenne's
excellent lodepng library from http://lodev.org/lodepng/. Uses Rich
Geldreich's wonderful single-file jpeg library from https://code.google.com/
p/jpeg-compressor/. 8x8 font created by John Hall, http://overcode.yak.net/
12, no longer with us.
oh, i dont know. what do you think?


david van brink // Tue 2015.03.3 19:26 // {dome}

Modo for Fulldome, Part 2.

This post will describe a means of creating fulldome domemaster images using Modo.

What is a Domemaster?

The interchange format for digital planetarium movies is a Domemaster (or Dome Master). Since planetaria require extremely high resolution (4k at least, some are using 8k), these are often delivered as a hard disk full of individual, numbered PNG files.

The format of each image is a disk, where the center of the image is projected to the top of the planetarium dome. Here’s a calibration image I found somewhere…

DomeCalibration1k
This is an “equal-azimuthal projection”; radius from the center corresponds directly to latitude. A nice attribute of this projection is that it looks quite natural even when it is flat. In this image, the audience would be facing South.

What Modo Provides

Modo’s camera has several projection modes, including “Spherical”. This renders a full sphere of imagery from a single camera point. It draws this into a projection known as “equirectangular”. You have probably seen a world map like this:

EquirectangularWorld

I grew up with one in the hallway. It fascinated me how Antarctica was smeared across the entire bottom edge. In this projection, latitude goes vertically from -90° South to +90° North, and longitude goes horizontally from -180° East to +180° West. To make the gridlines square, the width is generally twice the height.

I did some experiments with Modo’s spherical camera. The model is a closed sphere, with the axes labeled. Modo’s standard axes are Y-up, X-right, and Z-towards-you.

DomeModoModel

And here is Modo’s rendering, using Modo’s Spherical Projection Mode.

DomeCamera90Up

Things to notice:

  1. The center of the render is from exactly behind the camera.
  2. We only need the center square for our dome master (half the spherical scene).
  3. The image is inverted (the “y” is backwards).

To address the first two, in Modo we point the camera exactly away from our center of interest, and we use the Frame Properties’ Render Region, to skip rendering parts of the scene we won’t need. The saved files will still be twice as wide needed, though.

DomeModoModelCamDown

And here is what what gets rendered!

DomeCamera90Down

Making the Domemaster

That’s better, but still inverted, and not a dome master. I wrote a command-line tool, which reads in a JPG or PNG spherical-projection file as Modo produces, and writes out a domemaster JPG or PNG file. You use it like so, from a terminal session:

poly@omino-8999 domework: om_sphere2dome --infile=sphereImage1.jpg --outfile=dome.jpg
infile: sphereImage1.jpg (1024 x 512)
outfile: dome.jpg (512 x 512)
writing dome.jpg...
write result: ok
poly@omino-8999 domework:

Running it on the last render, we get (“ta da!”):

DomeCamera90DownDomemaster

This is a correctly formatted domemaster image. (Excepting that it’s only 512 pixels across, which will be singularly disappointing on a 75 foot dome screen. But you get the idea.)

As of today, the tool is in primitive form, and has limited image quality, and only for Mac OS X at the moment. But if you come across this and need it for Linux or Windows or have a feature request, or want the source code, please email me, poly@omino.com. It’s a living work. As it is, it’s just barely sufficient for my needs, and no more.

Also, just to reiterate, this is a command line tool; you’ll need to be comfortable with shell scripting to make full use of it. You might even need to chmod it after downloading. If that hasn’t warned you away…

Download om_sphere2Dome.

For Photoshop — Andrew Hazelden maintains this set of installable actions which can also do this transformation. For converting a whole Modo movie render, you’ll need to do a bit more scripting on top of it, and it will run fairly slowly… but it’s great to have options! His action set has many other tools as well.

oh, i dont know. what do you think?


projection_frame.jpg

This is a rendering simulating an image projected onto a simple 3d scene. There’s nothing too exotic about it, except that the projection was done in 2d, in After Effects.

And… here’s a moving sequence of the same scene. With old family movies.

stage_demo_640_dt-desktop.m4v

click for
http://omino.com/pixelblog/wp-content/uploads/2009/05/stage_demo_640_dt-desktop.m4v

The usual way you’d do this is by rendering a movie, taking it into your 3d program, and projecting it onto a scene through a light source.

For my current project, I needed this effect, but wanted a way to work in After Effects. I did this for workflow reasons: my projection content was all AE authored. But it also turns out to save render time. More than a little.

The trick was to render the scene in 3d as a coordinate-map, in Red and Green. I used Modo, and the projection mode is called “Front Projection”, from a spotlight or camera. I projected a red-green ramp onto the scene.

gradient.png

But we’re going to use the red and green values as a projection function. Changing the shader to use unattenuated (“luminous” @ 1W/steradian in modo) accomplishes this. We’re rendering geometry, not optics.

Then, I wrote a simple Pixel Bender kernel to use the red and green pixel values as coordinates to draw from the source projected image.


// by david van brink / poly@omino.com / 2009
// http://omino.com/pixelblog/
kernel rg_projection
<  namespace : "omino";    vendor : "omino";    version : 1;    
   description : "uses red/green from one image to map another"; >
{
    input image4 src; // Red-green mapping image
    input image4 ref; // image to project
    output pixel4 dst;

    parameter float imageXSize;
    parameter float imageYSize;
    parameter float imageXOffset;
    parameter float imageYOffset;

    void
    evaluatePixel() {
        pixel4 a = sampleLinear(src,outCoord());
        float r = a.r * imageXSize + imageXOffset;
        float g = a.g * imageYSize + imageYOffset;

        dst = sampleLinear(ref,float2(r,g));
    }
}

To test the Pixel Bender kernel, I ran a reference grid through the red-green ramp.

test_grid_gamma.pngtest_grid_no_gamma.pngtest_grid_no_gamma_better_gradient.png

The first one shows gamma correction on the ramp image in After Effects. Under “Interpret Footage”, be sure to turn on “Preserve RGB”.

The second one reveals that Photoshop’s default ramp is some sort of s-shaped modified linear function. Creating a custom gradient with more stops along the way helped get the third, which is Good Enough. I went back and redid the scene with the improved red-green gradient.

gradient_settings.png

And of course, use 32-bit color throughout. 16-bit works ok, too. 8-bit showed definite Squarifying in the projection, though.

To reintroduce the optical nature of the projection, back in After Effects it’s multiplied by a normally rendered image and, because I still think it’s pretty neat idea, an ambient occlusion pass as well.

stage_ambient_occlusion.jpg

stage_grid_projected.jpg

And there you have it! 3d projections done all in 2d.


Download the AE Project

2 comments
human.bin // Sun 2009.08.16 17:115:11 pm

oh my god man!

do you think this thing would work realtime in flash trough pixelbender?

AndrewYY // Tue 2009.09.1 15:343:34 pm

And to think, Maltaannon is selling this exact thing, just with more parameters.

oh, i dont know. what do you think?


david van brink // Sat 2009.04.18 17:04 // {after effects}

AE: Fake Spotlights

Here’s another variation on additive lighting tricks…

This one is a little experiment using After Effects’ spotlights on still images which have been rendered with similarly-located light sources.

Here’s one of the several still images.

And here’s a short movie showin a little more of the procedure, and some results.

spotlights.mp4

click for
http://omino.com/pixelblog/wp-content/uploads/2009/04/spotlights.mp4

oh, i dont know. what do you think?



0.1412s
(c) 2003-2013 omino.com / contact poly@omino.com