浏览代码

Finished simple compression algorithm

/main
Antoine Lelievre 7 年前
当前提交
7aa394fc
共有 3 个文件被更改,包括 11 次插入5 次删除
  1. 11
      com.unity.render-pipelines.high-definition/HDRP/Debug/DebugColorPicker.shader
  2. 2
      com.unity.render-pipelines.high-definition/HDRP/Debug/DebugDisplay.hlsl
  3. 3
      com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.hlsl

11
com.unity.render-pipelines.high-definition/HDRP/Debug/DebugColorPicker.shader


float4 result = SAMPLE_TEXTURE2D(_DebugColorPickerTexture, sampler_DebugColorPickerTexture, input.texcoord);
//Decompress value if luxMeter is active
result.rgb = exp2(result.rgb) - 2;
result.rgb = result.rgb * LUXMETER_COMPRESSION_RATIO;
if (_FalseColor)
result.rgb = FasleColorRemap(Luminance(result.rgb), _FalseColorThresholds);

}
float4 mouseResult = SAMPLE_TEXTURE2D(_DebugColorPickerTexture, sampler_DebugColorPickerTexture, mousePixelCoord.zw);
//Decompress value if luxMeter is active
if (_DebugLightingMode == DEBUGLIGHTINGMODE_LUX_METER)
mouseResult = mouseResult * LUXMETER_COMPRESSION_RATIO;
if (_DebugLightingMode == DEBUGLIGHTINGMODE_LUX_METER)
mouseResult = exp2(mouseResult) - 2;
result = DisplayPixelInformationAtMousePosition(input, result, mouseResult, mousePixelCoord);
}

2
com.unity.render-pipelines.high-definition/HDRP/Debug/DebugDisplay.hlsl


float _DebugExposure;
CBUFFER_END
#define LUXMETER_COMPRESSION_RATIO 4
TEXTURE2D(_DebugFont); // Debug font to write string in shader
RWStructuredBuffer<ScreenSpaceTracingDebug> _DebugScreenSpaceTracingData : register(u7); // TODO: Change the register number for PS4

3
com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.hlsl


case DEBUGLIGHTINGMODE_LUX_METER:
diffuseLighting = lighting.direct.diffuse + bakeLightingData.bakeDiffuseLighting;
//Compress lighting values for color picker if enabled
diffuseLighting = log2(diffuseLighting + 2);
diffuseLighting = diffuseLighting / LUXMETER_COMPRESSION_RATIO;
specularLighting = float3(0.0, 0.0, 0.0); // Disable specular lighting
break;

正在加载...
取消
保存