Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)

Enlighten SDK 4.03 Documentation
Results will update as you type.
  • Welcome to Enlighten
  • How Enlighten works
  • Artist workflow
  • Install Enlighten
  • Libraries
  • Implementation guide
  • Technical reference
    • Output formats
    • Albedo handling
    • Lightmap lighting models
    • Light probe evaluation
    • Local IBL reflections
    • Light visibility data
    • Custom direct lights
    • Low level precompute API
    • Debugging the precompute
    • The low level runtime
    • Baked lighting
    • Performance tuning
    • Technical troubleshooting
    • Terrain LOD
    • Lightmap LOD
  • Advanced techniques
  • Tools
  • White papers
  • Release notes
  • Third-party licences
    Calendars

You‘re viewing this with anonymous access, so some content might be blocked.
/
Output formats

    This is the documentation for Enlighten.

    Output formats

    Oct 31, 2024


    Enlighten supports encoding irradiance output for lightmaps and cubemaps in several different formats. Most of these formats are supported natively on the GPU and are well suited to the task of representing the irradiance output texture in a compressed format. Output formats are represented by members of the Enlighten::eOutputFormat enumeration.

    The output format for lightmap irradiance textures and cube maps is set using the m_IrradianceOutputFormat and m_CubemapOutputFormat fields of the UpdateManagerProperties, for example:

    Enlighten::UpdateManagerProperties properties;
    properties.m_IrradianceOutputFormat = Enlighten::OUTPUT_FORMAT_R11G11B10;
    properties.m_CubemapOutputFormat = Enlighten::OUTPUT_FORMAT_R11G11B10;
    

    Output formats

    Enlighten supports the following output formats:

    Output format

    Description

    Equivalent DXGI format

    OUTPUT_FORMAT_FP16

    16-bits-per-pixel-per-channel floating point (8 byte per pixel)

    DXGI_FORMAT_R16G16B16A16_FLOAT

    OUTPUT_FORMAT_LRB

    16 bit fixed point luminance; 8 bit red and blue (4 byte per pixel). See below for details.

    DXGI_FORMAT_R8G8B8A8_UNORM

    OUTPUT_FORMAT_R11G11B10

    Floating point, 11 bits per channel R and G, with 10 bit B.

    DXGI_FORMAT_R11G11B10_FLOAT

    OUTPUT_FORMAT_R9G9B9E5

    Floating point, 9 bits per channel mantissa with shared 5 bit exponent.

    DXGI_FORMAT_R9G9B9E5_SHAREDEXP

    OUTPUT_FORMAT_RGBM

    8 bit fixed point red, green and blue, with an 8 bit multiplier. See #RGBM later in this section.

    DXGI_FORMAT_R8G8B8A8_UNORM

    As long as the GPU texture is created with a format that matches the selected OUTPUT_FORMAT enumeration, there is no special shader code required; just sample the texture to retrieve the irradiance value. In the case of the LRB and RGBM formats some extra decoding code is required; see #LRB and #RGBM respectively.

    If your target platform supports it, the R11G11B10 irradiance encoding provides a good balance between cost and quality for HDR lighting.

    LRB

    In the LRB format (Luminance, Red, Blue), luminance (brightness) is stored using 16 bits, and normalised Red and Blue use 8 bits each. Because this is a fixed-point format, you need to choose which range to encode. The solver itself encodes luminance values in [0,1]. You will probably wish to represent a bigger range than this (with less fidelity); therefore you need to tell the solver to apply a factor to scale the radiosity down and then apply the inverse scale in the shader. When you use this output format in GeoRadiosity, choose the range [0,16] for luminance to ensure you have some headroom for HDR rendering.

    radIrradianceTask.m_OutputFormat = Enlighten::OUTPUT_FORMAT_LRB; // output values in LRB format
    
    radIrradianceTask.m_OutputScale = 1.0f / 16.0f; // choose to encode luminance values in [0,16] (scaled down to [0,1])
    

    First, compute Luminance L = R + G + B, then compute scaled Red R' = R/L and scaled Blue B' = B/L. These must lie in [0,1] to ensure that no extra scaling is required. The LRB data is stored in 8-bit RGBA unsigned integer format. 

    • Alpha component: The low 8 bits of the 16-bit luminance value.
    • Red component: The high 8 bits of the 16-bit luminance value.
    • Green component: Scaled Red.
    • Blue component: Scaled Blue.

    Therefore, the required decoding in the shader is as follows:

    float4 rawValue = tex2D(g_IrradianceSampler, uv);
    
    // decode the LRB value
    float3 colour     = float3(rawValue.g, 1.0f - rawValue.g - rawValue.b, rawValsue.b);
    float intensity   = (rawValue.r + rawValue.a / 256.0f) * 16.0f; // using our GeoRadiosity range choice of [0,16]
    float3 irradiance = colour * intensity;
    

    RGBM

    The OUTPUT_FORMAT_RGBM format sets the alpha channel of the output to the maximum of R, G and B, and stores the output R, G and B as fractions of this maximum. This can be simply decoded in the shader as follows:

    float4 rgbmEncoded = tex2d(sampler, uv);
    float3 decoded = float3(rgbmEncoded.xyz * rgbmEncoded.a);
    

    Similarly to the LRB encoding detailed earlier, the solver encodes values in [0,1]. If you wish to represent a bigger range, supply a downscaling factor in radIrradianceTask.m_OutputScale and perform the inverse scaling in the shader.


    , multiple selections available,
    {"serverDuration": 10, "requestCorrelationId": "e9d1f53fd1a54fcfa02ebcd8bcea37db"}