Skip to content

Procedural metering mask that follows target #723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
Jun 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
68acb9c
some very incomplete stuff...
FrancescoC-unity Apr 22, 2020
ccb3a84
sync point, rough working version
FrancescoC-unity Apr 23, 2020
297f0d4
Mostly working for now, moving onto debug vis and maybe revisit.
FrancescoC-unity Apr 24, 2020
d25ccf9
Commit as I need branch switching - Start debug modes
FrancescoC-unity Apr 27, 2020
64cad47
Add a bunch of debug mode and start of histogram
FrancescoC-unity Apr 29, 2020
f2b71e0
Delimiters indicator with bars
FrancescoC-unity Apr 29, 2020
86be36d
Add another option for percentile exttremes
FrancescoC-unity Apr 29, 2020
db33844
fix warning
FrancescoC-unity Apr 30, 2020
a277a56
Moving debug modes
FrancescoC-unity Apr 30, 2020
c533cfd
Label bar separate (invisible otherwise)
FrancescoC-unity Apr 30, 2020
8cca38f
Push change to bar indicator
FrancescoC-unity Apr 30, 2020
f319156
remove fancy background of histogram frame
FrancescoC-unity Apr 30, 2020
10b7f76
start of procedural mask
FrancescoC-unity May 4, 2020
7fc3237
Small triangle instead of indicator bars
FrancescoC-unity May 4, 2020
2573a9d
Target exposure indicator
FrancescoC-unity May 4, 2020
cda2dce
add some margin
FrancescoC-unity May 4, 2020
f5d1d79
Add an X at center
FrancescoC-unity May 4, 2020
cae8e6e
Metering PiP
FrancescoC-unity May 4, 2020
2d59944
Draw tonemap curve and use tonemapped texture for view
FrancescoC-unity May 5, 2020
7f83e1a
Share some code
FrancescoC-unity May 5, 2020
d002b89
Curve remapping for histogram and fix some warning
FrancescoC-unity May 5, 2020
9187bbb
Some comments fixup
FrancescoC-unity May 5, 2020
beb9b39
Simple comment changes
FrancescoC-unity May 6, 2020
9f7ee5f
Revert debug symbol in shader
FrancescoC-unity May 6, 2020
a544903
Changelog
FrancescoC-unity May 6, 2020
9b2b10d
Merge branch 'HDRP/histogram-exposure' into HDRP/targeting-metering
FrancescoC-unity May 6, 2020
d586734
Some basic version of procedural working
FrancescoC-unity May 6, 2020
6dcc734
need to switch branch
FrancescoC-unity May 6, 2020
4e2782d
Exposure target and threshold.
FrancescoC-unity May 7, 2020
aea7a8a
Merge branch 'HDRP/staging' into HDRP/targeting-metering
FrancescoC-unity Jun 4, 2020
a0b93e5
fix merge mess
FrancescoC-unity Jun 4, 2020
59d9420
Fixes
FrancescoC-unity Jun 4, 2020
4cc139b
Merge branch 'HDRP/staging' into HDRP/targeting-metering
sebastienlagarde Jun 6, 2020
b057fd3
Merge branch 'HDRP/staging' into HDRP/targeting-metering
sebastienlagarde Jun 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added more custom pass API functions, mainly to render objects from another camera.
- Added support for transparent Unlit in path tracing.
- Added a minimal lit used for RTGI in peformance mode.
- Added procedural metering mask that can follow an object

### Fixed
- Fix when rescale probe all direction below zero (1219246)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ sealed class ExposureEditor : VolumeComponentEditor
SerializedDataParameter m_HistogramPercentages;
SerializedDataParameter m_HistogramCurveRemapping;

SerializedDataParameter m_CenterAroundTarget;
SerializedDataParameter m_ProceduralCenter;
SerializedDataParameter m_ProceduralRadii;
SerializedDataParameter m_ProceduralSoftness;
SerializedDataParameter m_ProceduralMinIntensity;
SerializedDataParameter m_ProceduralMaxIntensity;

SerializedDataParameter m_TargetMidGray;

static readonly string[] s_MidGrayNames = { "Grey 12.5%", "Grey 14.0%", "Grey 18.0%" };
Expand Down Expand Up @@ -54,6 +61,14 @@ public override void OnEnable()

m_HistogramPercentages = Unpack(o.Find(x => x.histogramPercentages));
m_HistogramCurveRemapping = Unpack(o.Find(x => x.histogramUseCurveRemapping));

m_CenterAroundTarget = Unpack(o.Find(x => x.centerAroundExposureTarget));
m_ProceduralCenter = Unpack(o.Find(x => x.proceduralCenter));
m_ProceduralRadii = Unpack(o.Find(x => x.proceduralRadii));
m_ProceduralSoftness = Unpack(o.Find(x => x.proceduralSoftness));
m_ProceduralMinIntensity = Unpack(o.Find(x => x.maskMinIntensity));
m_ProceduralMaxIntensity = Unpack(o.Find(x => x.maskMaxIntensity));

m_TargetMidGray = Unpack(o.Find(x => x.targetMidGray));
}

Expand All @@ -79,6 +94,42 @@ public override void OnInspectorGUI()
if(m_MeteringMode.value.intValue == (int)MeteringMode.MaskWeighted)
PropertyField(m_WeightTextureMask);

if (m_MeteringMode.value.intValue == (int) MeteringMode.ProceduralMask)
{
EditorGUILayout.Space();
EditorGUILayout.LabelField("Procedural Mask", EditorStyles.miniLabel);


PropertyField(m_CenterAroundTarget);

var centerLabel = EditorGUIUtility.TrTextContent("Center", "Sets the center of the procedural metering mask ([0,0] being bottom left of the screen and [1,1] top right of the screen)");
var centerValue = m_ProceduralCenter.value.vector2Value;

if (m_CenterAroundTarget.value.boolValue)
{
centerLabel = EditorGUIUtility.TrTextContent("Offset", "Sets an offset to the mask center");
m_ProceduralCenter.value.vector2Value = new Vector2(Mathf.Clamp(centerValue.x, -0.5f, 0.5f), Mathf.Clamp(centerValue.y, -0.5f, 0.5f));
}
else
{
m_ProceduralCenter.value.vector2Value = new Vector2(Mathf.Clamp01(centerValue.x), Mathf.Clamp01(centerValue.y));
}

PropertyField(m_ProceduralCenter, centerLabel);
var radiiValue = m_ProceduralRadii.value.vector2Value;
m_ProceduralRadii.value.vector2Value = new Vector2(Mathf.Clamp01(radiiValue.x), Mathf.Clamp01(radiiValue.y));
PropertyField(m_ProceduralRadii, EditorGUIUtility.TrTextContent("Radii", "Sets the radii of the procedural mask, in terms of fraction of the screen (i.e. 0.5 means a radius that stretch half of the screen)."));
PropertyField(m_ProceduralSoftness, EditorGUIUtility.TrTextContent("Softness", "Sets the softness of the mask, the higher the value the less influence is given to pixels at the edge of the mask"));

if (isInAdvancedMode)
{
PropertyField(m_ProceduralMinIntensity);
PropertyField(m_ProceduralMaxIntensity);
}

EditorGUILayout.Space();
}

// Temporary hiding the field since we don't support anything but color buffer for now.
//PropertyField(m_LuminanceSource);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ static HDCameraUI()
Drawer_FieldVolumeLayerMask,
Drawer_FieldVolumeAnchorOverride,
(p, owner) => EditorGUILayout.PropertyField(p.probeLayerMask, probeLayerMaskContent),
Drawer_FieldOcclusionCulling
Drawer_FieldOcclusionCulling,
Drawer_FieldExposureTarget
),
CED.space,
CED.Group(
Expand Down Expand Up @@ -562,6 +563,11 @@ static void Drawer_FieldRenderTarget(SerializedHDCamera p, Editor owner)
}
}

static void Drawer_FieldExposureTarget(SerializedHDCamera p, Editor owner)
{
EditorGUILayout.PropertyField(p.exposureTarget, exposureTargetContent);
}

static void Drawer_FieldOcclusionCulling(SerializedHDCamera p, Editor owner)
{
EditorGUILayout.PropertyField(p.baseCameraSettings.occlusionCulling, occlusionCullingContent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ static partial class HDCameraUI
static readonly GUIContent volumeAnchorOverrideContent = EditorGUIUtility.TrTextContent("Volume Anchor Override");
static readonly GUIContent occlusionCullingContent = EditorGUIUtility.TrTextContent("Occlusion Culling");

static readonly GUIContent exposureTargetContent = EditorGUIUtility.TrTextContent("Exposure Target", "The object used as a target for centering the Exposure's Procedural Mask metering mode when target object option is set (See Exposure Volume Component).");

static readonly GUIContent projectionContent = EditorGUIUtility.TrTextContent("Projection", "How the Camera renders perspective.\n\nChoose Perspective to render objects with perspective.\n\nChoose Orthographic to render objects uniformly, with no sense of perspective.");
static readonly GUIContent sizeContent = EditorGUIUtility.TrTextContent("Size");
static readonly GUIContent fieldOfViewContent = EditorGUIUtility.TrTextContent("Field of View", "The height of the Camera’s view angle, measured in degrees along the local Y axis.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class SerializedHDCamera
public SerializedProperty curvature;
public SerializedProperty barrelClipping;
public SerializedProperty anamorphism;
public SerializedProperty exposureTarget;

public SerializedProperty antialiasing;
public SerializedProperty SMAAQuality;
Expand Down Expand Up @@ -71,6 +72,8 @@ public SerializedHDCamera(SerializedObject serializedObject)
barrelClipping = serializedAdditionalDataObject.FindProperty("physicalParameters.m_BarrelClipping");
anamorphism = serializedAdditionalDataObject.FindProperty("physicalParameters.m_Anamorphism");

exposureTarget = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.exposureTarget);

antialiasing = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.antialiasing);
SMAAQuality = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.SMAAQuality);
taaSharpenStrength = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.taaSharpenStrength);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,6 @@ Shader "Hidden/HDRP/DebugExposure"
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
float2 uv = input.texcoord.xy;
float3 color = SAMPLE_TEXTURE2D_X_LOD(_DebugFullScreenTexture, s_linear_clamp_sampler, uv, 0.0).xyz;
float weight = WeightSample(input.positionCS.xy, _ScreenSize.xy);

float pipFraction = 0.33f;
uint borderSize = 3;
Expand All @@ -471,7 +470,8 @@ Shader "Hidden/HDRP/DebugExposure"
{
float2 scaledUV = uv / pipFraction;
float3 pipColor = SAMPLE_TEXTURE2D_X_LOD(_SourceTexture, s_linear_clamp_sampler, scaledUV, 0.0).xyz;
float weight = WeightSample(scaledUV.xy * _ScreenSize.xy / _RTHandleScale.xy, _ScreenSize.xy);
float luminance = SampleLuminance(scaledUV);
float weight = WeightSample(scaledUV.xy * _ScreenSize.xy / _RTHandleScale.xy, _ScreenSize.xy, luminance);

return pipColor * weight;
}
Expand Down Expand Up @@ -574,7 +574,6 @@ Shader "Hidden/HDRP/DebugExposure"
float2 uv = input.texcoord.xy;

float3 color = SAMPLE_TEXTURE2D_X_LOD(_DebugFullScreenTexture, s_linear_clamp_sampler, uv, 0.0).xyz;
float weight = WeightSample(input.positionCS.xy, _ScreenSize.xy);

float3 outputColor = color;

Expand Down Expand Up @@ -616,7 +615,7 @@ Shader "Hidden/HDRP/DebugExposure"

uint2 unormCoord = input.positionCS.xy;
float3 textColor = float3(0.5f, 0.5f, 0.5f);
int2 textLocation = int2(DEBUG_FONT_TEXT_WIDTH * 0.5, DEBUG_FONT_TEXT_WIDTH * 0.5 + histFrameHeight * (_ScreenSize.y / _RTHandleScale.y));
uint2 textLocation = uint2(DEBUG_FONT_TEXT_WIDTH * 0.5, DEBUG_FONT_TEXT_WIDTH * 0.5 + histFrameHeight * (_ScreenSize.y / _RTHandleScale.y));
DrawCharacter('C', textColor, unormCoord, textLocation, outputColor.rgb, 1, 10);
DrawCharacter('u', textColor, unormCoord, textLocation, outputColor.rgb, 1, 7);
DrawCharacter('r', textColor, unormCoord, textLocation, outputColor.rgb, 1, 7);
Expand All @@ -636,7 +635,7 @@ Shader "Hidden/HDRP/DebugExposure"
DrawCharacter(':', textColor, unormCoord, textLocation, outputColor.rgb, 1, 7);
textLocation.x += DEBUG_FONT_TEXT_WIDTH * 0.5f;
DrawFloatExplicitPrecision(currExposure, textColor, unormCoord, 3, textLocation, outputColor.rgb);
textLocation = int2(DEBUG_FONT_TEXT_WIDTH * 0.5, textLocation.y + DEBUG_FONT_TEXT_WIDTH);
textLocation = uint2(DEBUG_FONT_TEXT_WIDTH * 0.5, textLocation.y + DEBUG_FONT_TEXT_WIDTH);
DrawCharacter('T', textColor, unormCoord, textLocation, outputColor.rgb, 1, 10);
DrawCharacter('a', textColor, unormCoord, textLocation, outputColor.rgb, 1, 7);
DrawCharacter('r', textColor, unormCoord, textLocation, outputColor.rgb, 1, 7);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,37 @@ public sealed class Exposure : VolumeComponent, IPostProcessComponent
[Tooltip("Sets the desired Mid gray level used by the auto exposure (i.e. to what grey value the auto exposure system maps the average scene luminance).")]
public TargetMidGrayParameter targetMidGray = new TargetMidGrayParameter(TargetMidGray.Grey125);

/// <summary>
/// Sets whether the procedural metering mask is centered around the exposure target (to be set on the camera)
/// </summary>
[Tooltip("Sets whether histogram exposure mode will remap the computed exposure with a curve remapping (akin to Curve Remapping mode).")]
public BoolParameter centerAroundExposureTarget = new BoolParameter(false);

/// <summary>
/// Sets the center of the procedural metering mask ([0,0] being bottom left of the screen and [1,1] top right of the screen)
/// </summary>
public NoInterpVector2Parameter proceduralCenter = new NoInterpVector2Parameter(new Vector2(0.5f, 0.5f));
/// <summary>
/// Sets the radii of the procedural mask, in terms of fraction of the screen (i.e. 0.5 means a radius that stretch half of the screen).
/// </summary>
public NoInterpVector2Parameter proceduralRadii = new NoInterpVector2Parameter(new Vector2(0.15f, 0.15f));
/// <summary>
/// All pixels below this threshold (in EV100 units) will be assigned a weight of 0 in the metering mask.
/// </summary>
[Tooltip("All pixels below this threshold (in EV100 units) will be assigned a weight of 0 in the metering mask.")]
public FloatParameter maskMinIntensity = new FloatParameter(-30.0f);
/// <summary>
/// All pixels above this threshold (in EV100 units) will be assigned a weight of 0 in the metering mask.
/// </summary>
[Tooltip("All pixels above this threshold (in EV100 units) will be assigned a weight of 0 in the metering mask.")]
public FloatParameter maskMaxIntensity = new FloatParameter(30.0f);

/// <summary>
/// Sets the softness of the mask, the higher the value the less influence is given to pixels at the edge of the mask.
/// </summary>
public NoInterpMinFloatParameter proceduralSoftness = new NoInterpMinFloatParameter(0.5f, 0.0f);


/// <summary>
/// Tells if the effect needs to be rendered or not.
/// </summary>
Expand Down Expand Up @@ -185,7 +216,13 @@ public enum MeteringMode
/// the exposure. The weighting is specified by the texture provided by the user. Note that if
/// no texture is provided, then this metering mode is equivalent to Average.
/// </summary>
MaskWeighted
MaskWeighted,

/// <summary>
/// Create a weight mask centered around the specified UV and with the desired parameters.
/// </summary>
ProceduralMask,


}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,42 @@ internal ComputeBuffer GetHistogramBuffer()
return m_HistogramBuffer;
}

internal void ComputeProceduralMeteringParams(HDCamera camera, out Vector4 proceduralParams1, out Vector4 proceduralParams2)
{
Vector2 proceduralCenter = m_Exposure.proceduralCenter.value;
if (camera.exposureTarget != null && m_Exposure.centerAroundExposureTarget.value)
{
var transform = camera.exposureTarget.transform;
// Transform in screen space
Vector3 targetLocation = transform.position;
if (ShaderConfig.s_CameraRelativeRendering != 0)
{
targetLocation -= camera.camera.transform.position;
}
var ndcLoc = camera.mainViewConstants.viewProjMatrix * (targetLocation);
ndcLoc.x /= ndcLoc.w;
ndcLoc.y /= ndcLoc.w;

Vector2 targetUV = new Vector2(ndcLoc.x, ndcLoc.y) * 0.5f + new Vector2(0.5f, 0.5f);
targetUV.y = 1.0f - targetUV.y;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA: please be sure to test Target on both windows on Metal, just to be sure it work on all platform


proceduralCenter += targetUV;
}

proceduralCenter.x = Mathf.Clamp01(proceduralCenter.x);
proceduralCenter.y = Mathf.Clamp01(proceduralCenter.y);

proceduralCenter.x *= camera.actualWidth;
proceduralCenter.y *= camera.actualHeight;

float screenDiagonal = 0.5f * (camera.actualHeight + camera.actualWidth);

proceduralParams1 = new Vector4(proceduralCenter.x, proceduralCenter.y,
m_Exposure.proceduralRadii.value.x * screenDiagonal,
m_Exposure.proceduralRadii.value.y * screenDiagonal);

proceduralParams2 = new Vector4(1.0f / m_Exposure.proceduralSoftness.value, LightUtils.ConvertEvToLuminance(m_Exposure.maskMinIntensity.value), LightUtils.ConvertEvToLuminance(m_Exposure.maskMaxIntensity.value), 0.0f);
}
void DoFixedExposure(CommandBuffer cmd, HDCamera camera)
{
var cs = m_Resources.shaders.exposureCS;
Expand Down Expand Up @@ -1050,6 +1086,11 @@ void DoDynamicExposure(CommandBuffer cmd, HDCamera camera, RTHandle colorBuffer)
{
cmd.SetComputeTextureParam(cs, kernel, HDShaderIDs._ExposureWeightMask, Texture2D.whiteTexture);
}

ComputeProceduralMeteringParams(camera, out Vector4 proceduralParams1, out Vector4 proceduralParams2);
cmd.SetComputeVectorParam(cs, HDShaderIDs._ProceduralMaskParams, proceduralParams1);
cmd.SetComputeVectorParam(cs, HDShaderIDs._ProceduralMaskParams2, proceduralParams2);

cmd.SetComputeTextureParam(cs, kernel, HDShaderIDs._OutputTexture, m_TempTexture1024);
cmd.DispatchCompute(cs, kernel, 1024 / 8, 1024 / 8, 1);

Expand Down Expand Up @@ -1099,6 +1140,10 @@ void DoHistogramBasedExposure(CommandBuffer cmd, HDCamera camera, RTHandle sourc
float histBias = -m_Exposure.limitMin.value * histScale;
Vector4 histogramParams = new Vector4(histScale, histBias, histogramFraction.x, histogramFraction.y);

ComputeProceduralMeteringParams(camera, out Vector4 proceduralParams1, out Vector4 proceduralParams2);
cmd.SetComputeVectorParam(cs, HDShaderIDs._ProceduralMaskParams, proceduralParams1);
cmd.SetComputeVectorParam(cs, HDShaderIDs._ProceduralMaskParams2, proceduralParams2);

ValidateComputeBuffer(ref m_HistogramBuffer, k_HistogramBins, sizeof(uint));
m_HistogramBuffer.SetData(m_EmptyHistogram); // Clear the histogram
cmd.SetComputeVectorParam(cs, HDShaderIDs._HistogramExposureParams, histogramParams);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ TEXTURE2D(_InputTexture);

#define PREPASS_TEX_SIZE 1024.0
#define PREPASS_TEX_HALF_SIZE 512.0
//#pragma enable_d3d11_debug_symbols

//
// Fixed exposure
Expand Down Expand Up @@ -51,7 +52,7 @@ void KPrePass(uint2 dispatchThreadId : SV_DispatchThreadID)
float2 uv = ClampAndScaleUVForBilinear(posInputs.positionNDC);
float luma = SampleLuminance(uv);

float weight = WeightSample(dispatchThreadId, PREPASS_TEX_SIZE.xx);
float weight = WeightSample(dispatchThreadId, PREPASS_TEX_SIZE.xx, luma);

float logLuma = ComputeEV100FromAvgLuminance(max(luma, 1e-4), MeterCalibrationConstant);
_OutputTexture[posInputs.positionSS] = float2(logLuma, weight);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ TEXTURE2D(_ExposureCurveTexture);
CBUFFER_START(cb)
float4 _ExposureParams;
float4 _ExposureParams2;
float4 _ProceduralMaskParams;
float4 _ProceduralMaskParams2;
float4 _HistogramExposureParams;
float4 _AdaptationParams;
uint4 _Variants;
Expand All @@ -39,12 +41,18 @@ CBUFFER_END
#define ParamAdaptationMode _Variants.z
#define ParamEvaluateMode _Variants.w

#define ProceduralCenter _ProceduralMaskParams.xy // Transformed in screen space on CPU
#define ProceduralRadii _ProceduralMaskParams.zw
#define ProceduralSoftness _ProceduralMaskParams2.x
#define ProceduralMin _ProceduralMaskParams2.y
#define ProceduralMax _ProceduralMaskParams2.z

float GetPreviousExposureEV100()
{
return _PreviousExposureTexture[uint2(0u, 0u)].y;
}

float WeightSample(uint2 pixel, float2 sourceSize)
float WeightSample(uint2 pixel, float2 sourceSize, float luminance)
{
UNITY_BRANCH
switch (ParamMeteringMode)
Expand All @@ -70,7 +78,15 @@ float WeightSample(uint2 pixel, float2 sourceSize)
// Mask weigthing
return SAMPLE_TEXTURE2D_LOD(_ExposureWeightMask, s_linear_clamp_sampler, pixel * rcp(sourceSize), 0.0).x;
}
case 4u:
{
// Procedural.
float radius = max(ProceduralRadii.x, ProceduralRadii.y);
float2 ellipseScale = float2(radius / ProceduralRadii.x, radius / ProceduralRadii.y);

float dist = length(ProceduralCenter * ellipseScale - pixel * ellipseScale);
return (luminance > ProceduralMin && luminance < ProceduralMax) ? saturate(1.0 - pow((dist / radius), ProceduralSoftness)) : 0.0f;
}
default:
{
// Global average
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void KHistogramGen(uint groupIndex : SV_GroupIndex,
{
float2 uv = ClampAndScaleUVForBilinear((fullResCoords + 0.5) * _ScreenSize.zw);
float luminance = SampleLuminance(uv);
float weight = WeightSample(fullResCoords, _ScreenSize.xy);
float weight = WeightSample(fullResCoords, _ScreenSize.xy, luminance);

uint bin = GetHistogramBinLocation(luminance);
InterlockedAdd(gs_localHistogram[bin], PackWeight(weight));
Expand Down
Loading