Edge
blending (for projectors)
Use
multiple projectors to get a very large racing view. |
|
Edge blending is only available to licensed users of Racer.
Edge blending is used when running Racer in a multiple projector
setup. Most often, you'll use 3 projectors. More expensive projectors support
edge blending in hardware, as do some of the higher-end nVidia Quadro cards.
However, it's not really required (it's easy enough to do it in software with Cg these days). Also,
some tricks may be possible in the future to have edge blending affect only
parts of the center render (for example, not edge-blending dials/dashboards).
Edge blending works by having multiple projections overlap eachother
slightly, which smooths out any misaligned images. To avoid the area of the
overlap becoming too bright, the edge is darkened towards black to make a nice
transition from one projection to the other. This all results in a slow mix
between the two images, much less prone to be noticed by the viewer.
A fabulous page on the internet about edge blending is located here. It described how the blend curve really works (it's not a linear degradation to black).
Edge blending requires multiple computers, rendering in concert. More information on hooking up multiple computers to provide one image can be found at the multiview page.
The image below shows edge blending editing in action, combined with projector distortion (this is all inside Racer; no external tools are needed). A test pattern is overlaid for easier editing of the parameters when aligning the overlap for 2 projectors (both with respect to the overlap being located in the right place and also for adjusting the blend region to correct for gamma, since light doesn't really add up in a nice linear way). Only the left side is edge blended (this would be the projected image on the right of the center projection).
Edge blending characteristics are decided in racer.ini
under the 'renderer' section. Overlapping parameters are defined in the 'multiview'
section though. The available parameters:
- renderer.edge_blend.enable; if 1, turns
on edge blending
- renderer.edge_blend.p; the curvature of
the edge fall-off. 1=linear, 2=curvy, 3=very curvy. Start out with 2.0, which seems to work best (perhaps something with light 'brightness' having a sort of squared relationship to the linear RGB 0..255 values).
- renderer.edge_blend.gamma; the projector
gamma. Start out with 2.0 for a linear projector. At tuning time, you tweak this value to somewhere around 1.8 to 2.2.
- renderer.edge_blend.sides; a bitmask containg
the sides to edge blend. Currently only 1 (left) and 2 (right) are supported.
For example: 3 will blend both sides. This option is obsolete by now; blending is done inside the GPU shaders doing to fullscreen post-processing.
- renderer.edge_blend.test_pattern; if 1,
turns on a test pattern. Use the script command 'edgetest on' and 'edgetest
off' to turn on/off this test image.
- renderer.edge_blend.test_pattern_alpha;
defines the alpha (transparency) value for the test pattern. 0=invisible,
128=50% visible, 255=fully opaque.
- multiview.project_left; used for asymmetric
frustums, this option enables left & right slave projections to overlap
that of the master projection. See below for calculating values. Value ranges
from 0 (full left) to 1 (full right).
- multiview.project_right; also for asymmetric
frustums. Defines the right limit (0..1).
- multiview.aspect_factor; multiplies the
renderer's aspect ratio. See below for an example.
Calculating all these values is relative easy to do if
you follow these steps:
- Calculate the virtual span of the 3 projector's images in
pixels.
- Calculate the right aspect ratio factor as the virtual width
divided by one projector's width (all in pixels).
- Calculate the start and end of each projection, then normalize
to 0 to 1. Use these values for multiview.project_left and
_right.
All this can be easily put into a simple spreadsheet; download
one here. It allows entering resolution, overlap (in pixels) and an optional car camera shift if the driver isn't centered with respect to the middle projector.
Say we have 3 projectors, all doing 1024x768 images. Now assume
you want 25% overlap, meaning 256 pixels. Let's follow the steps:
- The projectors generate 3x1024=3072 pixels in width, but
we have a 256-pixel overlap for the left & right displays. That leaves
us with 3072-2*256 = 2560 virtual width in pixels.
- Next is the aspect ratio; the virtual width is 2560 and 1
projection is 1024 pixels, giving an aspect of 256/1024 = 2.5. Set multiview.aspect_factor
to 2.5 for the slave machines.
- The start/end of each projection can be found by thinking
about the overlaps. The left screen's left start is 0 (multiview.project_left,
full left). The project_right value then; we draw 1024 pixels so
at that point we want to be at 1024/2560 pixels, which is 0.4. Set multiview.project_right
for the left machine to 0.4.
The right screen is similar; we want to be at 2560 pixels minus 1 projection
of 1024, which is 2560-1024 = 1536. For the total virtual width that is 1536/2560
= 0.6. Set multiview.project_left for the right machine to
0.6. The right projection draws upto full right, so set multiview.project_right
to 1 for the right machine.
For some setups, the viewer isn't located at the centerline in front of the projection screen (for example, if you are seated in a car in the left seat). This means the center computer's display must be shifted. Racer has some options to correct for this (note that the driver on the right is less lucky and sees a slightly off picture).
- Modify the car camera (in its car.ini file) by setting camera0.project_left and project_right to something other than 0 and 1 (the defaults). A good starting value for someone sitting on a left seat in a double-seated car is project_left=0.12 and project_right=1.12.
Note that this must be done for every car that is used.
- This also should affect the side screens. Note however, that the multiview computers deal with asymmetric frustums in a slightly different way: they deal with the virtual total screen width. So for example, given the example above with 3 projectors (each 1024 pixels wide), the center screen offset was relative to a 1024 pixel width. The multiview projection values, though, deal with the virtual width of 2560.
Normally you'd get for example project_left=0 and project_right=0.4 for the left view, based on 2560 pixels. To correctly offset the center screen's 0.12 offset, factor the ratio of the two resolutions in: 1024/2560=0.4. So the multiview machines will be offset by 0.4 * 0.12 = 0.048. The projection width (0.4-0.0=0.4) stays the same, so you get: project_left=0.048 and project_right=0.448 for the left machine. Similarly, the right view gets the same 0.048 offset, so project_left becomes 0.648 (instead of 0.6) and project_right becomes 1.048 (instead of 1).
Testing can be done using the renderer.edge_blending.test_pattern
setting. Set this to 1 to get a grid and some colors, which you can use to synchronize
your projectors color balance, keystone, zoom etc. Use the 'edgetest on|off'
script commands to turn the pattern on/off. Turn off the test pattern altogether
in production phase, as it takes memory.
You can also execute the 'distort edit' script command (pressing SPACE will toggle the test pattern, even if set to 0 in racer.ini). You really need a distorting & edge blending Cg shader for that (fs_filter1 in racer.ini). This is explained in more detail in the distortion page.
(last
updated
November 13, 2012
)