Search Unity

Question why sampling in low level cube lod for SSGI fallback ?

Discussion in 'High Definition Render Pipeline' started by kite3h, Aug 8, 2022.

  1. kite3h

    kite3h

    Joined:
    Aug 27, 2012
    Posts:
    197
    if (RAYMARCHINGFALLBACKHIERARCHY_REFLECTION_PROBES & _RayMarchingFallbackHierarchy)
    TraceReflectionProbes(posInput, normalData.normalWS, sampleDir, weight, color);


    Using reflection probes for SSGI fallback would be very common.
    In fact, Unreal 5's lumen's lumen card is almost the same.

    However, the value we want to replace now is the indirect diffuse value, not the specular value.

    if (s_envLightIdx >= v_envLightIdx)
    {
    v_envLightListOffset++;
    if (IsEnvIndexCubemap(envLightData.envIndex) && totalWeight < 1.0)
    {
    float3 R = rayDirection;
    float weight = 1.0f;
    float intersectionDistance = EvaluateLight_EnvIntersection(posInput.positionWS, normalWS, envLightData, envLightData.influenceShapeType, R, weight);

    int index = abs(envLightData.envIndex) - 1;
    float3 probeResult = SAMPLE_TEXTURECUBE_ARRAY_LOD_ABSTRACT(_EnvCubemapTextures, s_trilinear_clamp_sampler, R, _EnvSliceSize * index, 0).rgb * envLightData.rangeCompressionFactorCompensation;
    probeResult = ClampToFloat16Max(probeResult);

    UpdateLightingHierarchyWeights(totalWeight, weight);
    result += weight * probeResult * envLightData.multiplier;
    }
    }

    SAMPLE_TEXTURECUBE_ARRAY_LOD_ABSTRACT

    I don't understand why you set 0 to LOD.

    Shouldn't it be the highest level?
     
  2. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    257
    It uses LOD 0 because LOD 0 is the highest quality. If you go up in LOD level, the resolution will be lower, details will be lost and the result will be inaccurate.