Skip to content

Fixed rendering breaking when disabling tonemapping in the frame settings. #1284

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 2 commits into from
Jul 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -731,6 +731,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed path-traced subsurface scattering mixing with diffuse and specular BRDFs (1250601).
- Fixed custom pass re-ordering issues.
- Improved robustness of normal mapping when scale is 0, and mapping is extreme (normals in or below the tangent plane).
- Fixed rendering breaking when disabling tonemapping in the frame settings.

### Changed
- Improve MIP selection for decals on Transparents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ void PoolSource(ref RTHandle src, RTHandle dst)
{
using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.DepthOfField)))
{
// If we switch DoF modes and the old one was not using TAA, make sure we invalidate the history
// If we switch DoF modes and the old one was not using TAA, make sure we invalidate the history
if (taaEnabled && m_IsDoFHisotoryValid != m_DepthOfField.physicallyBased)
{
camera.resetPostProcessingHistory = true;
Expand All @@ -636,7 +636,7 @@ void PoolSource(ref RTHandle src, RTHandle dst)
var taaDestination = m_Pool.Get(Vector2.one, m_ColorFormat);
bool postDof = true;
var taaParams = PrepareTAAParameters(camera, postDof);

GrabTemporalAntialiasingHistoryTextures(camera, out var prevHistory, out var nextHistory, postDof);
DoTemporalAntialiasing(taaParams, cmd, source, taaDestination, motionVecTexture, depthBuffer, depthMipChain, prevHistory, nextHistory, prevMVLen:null, nextMVLen:null);
PoolSource(ref source, taaDestination);
Expand All @@ -651,7 +651,7 @@ void PoolSource(ref RTHandle src, RTHandle dst)
{
ReleasePostDoFTAAHistoryTextures(camera);
}

// Motion blur after depth of field for aesthetic reasons (better to see motion
// blurred bokeh rather than out of focus motion blur)
if (m_MotionBlur.IsActive() && m_AnimatedMaterialsEnabled && !camera.resetPostProcessingHistory && m_MotionBlurFS)
Expand All @@ -667,7 +667,7 @@ void PoolSource(ref RTHandle src, RTHandle dst)
out tileToScatterMin);
DoMotionBlur(PrepareMotionBlurParameters(camera), cmd, source, destination, motionVecTexture, preppedMotionVec, minMaxTileVel, maxTileNeigbourhood, tileToScatterMax, tileToScatterMin);
RecycleMotionBlurRenderTargets(preppedMotionVec, minMaxTileVel, maxTileNeigbourhood, tileToScatterMax, tileToScatterMin);

PoolSource(ref source, destination);
}
}
Expand Down Expand Up @@ -1339,7 +1339,7 @@ static void DoDynamicExposure(in ExposureParameters exposureParameters, CommandB
{
var cs = exposureParameters.exposureCS;
int kernel;

var sourceTex = colorBuffer;

kernel = exposureParameters.exposurePreparationKernel;
Expand Down Expand Up @@ -1599,7 +1599,7 @@ static void DoTemporalAntialiasing(in TemporalAntiAliasingParameters taaParams,
{
cmd.SetRandomWriteTarget(2, nextMVLen);
}

cmd.DrawProcedural(Matrix4x4.identity, taaParams.temporalAAMaterial, 0, MeshTopology.Triangles, 3, 1, taaParams.taaPropertyBlock);
cmd.DrawProcedural(Matrix4x4.identity, taaParams.temporalAAMaterial, 1, MeshTopology.Triangles, 3, 1, taaParams.taaPropertyBlock);
cmd.ClearRandomWriteTargets();
Expand Down Expand Up @@ -2274,7 +2274,7 @@ void ReprojectCoCHistory(CommandBuffer cmd, HDCamera camera, bool useMips, ref R
GrabCoCHistory(camera, out var prevCoCTex, out var nextCoCTex, useMips);
var cocHistoryScale = new Vector2(camera.historyRTHandleProperties.rtHandleScale.z, camera.historyRTHandleProperties.rtHandleScale.w);

//Note: this reprojection creates some ghosting, we should replace it with something based on the new TAA
//Note: this reprojection creates some ghosting, we should replace it with something based on the new TAA
ComputeShader cs = m_Resources.shaders.depthOfFieldCoCReprojectCS;
int kernel = cs.FindKernel("KMain");
cmd.SetComputeVectorParam(cs, HDShaderIDs._Params, new Vector4(camera.resetPostProcessingHistory ? 0f : 0.91f, cocHistoryScale.x, cocHistoryScale.y, 0f));
Expand Down Expand Up @@ -2333,7 +2333,7 @@ void DoPhysicallyBasedDepthOfField(CommandBuffer cmd, HDCamera camera, RTHandle
// The sensor scale is used to convert the CoC size from mm to screen pixels
float sensorScale;
if( camera.camera.gateFit == Camera.GateFitMode.Horizontal )
sensorScale = (0.5f / camera.camera.sensorSize.x) * camera.camera.pixelWidth;
sensorScale = (0.5f / camera.camera.sensorSize.x) * camera.camera.pixelWidth;
else
sensorScale = (0.5f / camera.camera.sensorSize.y) * camera.camera.pixelHeight;

Expand Down Expand Up @@ -3208,7 +3208,7 @@ ColorGradingParameters PrepareColorGradingParameters()
// Setup lut builder compute & grab the kernel we need
parameters.builderCS.shaderKeywords = null;

if (m_Tonemapping.IsActive())
if (m_Tonemapping.IsActive() && m_TonemappingFS)
{
switch (parameters.tonemappingMode)
{
Expand Down Expand Up @@ -3325,7 +3325,7 @@ static void DoColorGrading(in ColorGradingParameters parameters,

// Generate the lut
// See the note about Metal & Intel in LutBuilder3D.compute
// GetKernelThreadGroupSizes is currently broken on some binary versions.
// GetKernelThreadGroupSizes is currently broken on some binary versions.
//builderCS.GetKernelThreadGroupSizes(builderKernel, out uint threadX, out uint threadY, out uint threadZ);
uint threadX = 4;
uint threadY = 4;
Expand Down