Hemisphere Approximate SkyLight

More efficient and smoother lighting than cubemap.

  1. SkyLight.h > enum class Modes
    (after CustomTexture = 1,)
    add
    HemisphereApproximate = 2,

  2. Config.h > ShaderLightData
    (after float RadiusInv;)
    change
    float Dummy0;
    to
    uint32 Flags;

  3. RenderList.cpp > RenderSkyLightData::SetShaderData
    (after data.RadiusInv = 1.0f / Radius;)
    add
    uint32 flags = 0;
    if (nullptr==Image) flags |= 1; //Hemisphere Approximate
    data.Flags = flags;

  4. LightingCommon.hlsl > struct LightData
    (after float RadiusInv;)
    change
    float Dummy0;
    to
    uint Flags;

  5. Lighting.hlsl > GetSkyLightLighting
    change
    float3 diffuseLookup = ibl.SampleLevel(SamplerLinearClamp, uvw, mip).rgb * lightData.Color.rgb;
    to

    float3 diffuseLookup;

    BRANCH
    if ((lightData.Flags & 0x1) != 0) //Hemisphere Approximate
    diffuseLookup = lightData.Color.rgb * saturate(gBuffer.Normal.y * 0.7 + 0.3);
    else
    diffuseLookup = ibl.SampleLevel(SamplerLinearClamp, uvw, mip).rgb * lightData.Color.rgb;

// saturate(gBuffer.Normal.y * 0.7 + 0.3) map [-1,1] to [0,1]
// Coefficients( 0.7, 0.3 ) can be modified to adjust the lighting curve.