On 6/4/2012 6:48 AM, Miles Fidelman wrote:
BGB wrote:

and, recently devised a hack for creating "component layered JPEG images", or, basically, a hack to allow creating JPEGs which also contained alpha-blending, normal maps, specular maps, and luma maps (as an essentially 16-component JPEG image composed of multiple component layers, with individual JPEG images placed end-to-end with marker tags between them to mark each layer).


dunno if anyone would find any of this all that interesting though.

well, I'd certainly be interested in seeing that hack!

Mile Fidelman


from a comment in my JPEG code:
<--
BGB Extensions:
APP11: BGBTech Tag
    ASCIZ TagName
    Tag-specific data until next marker.

    "AlphaColor":
        AlphaColor
        RGBA as string ("red green blue alpha").

    APP11 markers may indicate component layer:
        FF,APP11,"CompLayer\0", <layername:ASCIZ>
            "RGB": Base RGB
            "XYZ": Normal XYZ (XZY ordering)
            "SpRGB": Specular RGB
            "DASe": Depth, Alpha, Specular-Exponent
            "LuRGB": Luma RGB
            "Alpha": Mono alpha layer

    Component Layouts:
        3 component: (no marker, RGB)
        4 component: RGB+Alpha
        7 component: RGB+Alpha+LuRGB
        8 component: RGB+XYZ+DASe
        12 component: RGB+XYZ+SpRGB+DASe
        16 component: RGB+XYZ+SpRGB+DASe+LuRGB
-->

"AlphaColor" was an prior extension, basically for in-image chroma-keys.
the RGB color specifies the color to be matched, and A specifies how "strongly" the color is matched (IIRC, it is the "distance" to Alpha=128 or so).

it was imagined that this could be calculated dynamically per-image, but doing so is costly, so typically a fixed color is specified during encoding (such as cyan or magenta).


"CompLayer" is the component layers.
currently, this tag precedes the SOI tages.

example:
FF,APP11, "CompLayer\0", "RGB\0"
FF,SOI
...
FF,EOI
FF,APP11, "CompLayer\0", "XYZ\0"
FF,SOI
...
FF,EOI
...


basically:
most component-layers are generic 4:2:0 RGB/YUV layers (except the mono alpha layer, which is monochrome).

the layers may share the same Huffman and Quantization tables (by having only the first layer encode them).

the RGB layer always comes first, so a decoder that doesn't know of the extension, will just see the basic RGB components. also all layers are the same resolution.


this is hardly an "ideal" design, but was intended more to allow a simple encoder/decoder tweak to handle it (currently, it is encoded/decoded by a function which may accept 4 RGBA buffers, and may shuffle things around slightly to encode them into the layers).

the in-program layers are:
RGBA;
XYZD ('D' may be used for parallax mapping, and represents the relative depth of the pixel); Specular (RGBe), this basically gives the reflection color and shininess of surface pixels;
Luma (RGBA).


so, yes, it is all a bit of a hack...


there was also a little fudging to the my AVI code to allow these videos to be used for surface video-mapping (basically, the video is streamed into all 4 layers at the same time).

example use-cases of something like this would likely be things like making animated textures which resemble moving parts (such as metal gears and blinking lights), or alternatively as a partial alternative to using 3D modeled character faces (the face moving is really the texture and animation frames, rather than 3D geometry), however presently this is likely a better fit for animated textures than for video-maps.

_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc

Reply via email to