Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
if (value.propertyType != SerializedPropertyType.LayerMask)
return false;

value.intValue = EditorGUILayout.MaskField(title, value.intValue, InternalEditorUtility.layers);
value.intValue = InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(
EditorGUILayout.MaskField(title, InternalEditorUtility.LayerMaskToConcatenatedLayersMask(value.intValue), InternalEditorUtility.layers));
return true;
}
}
Expand Down
10 changes: 10 additions & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed the FreeCamera and SimpleCameraController mouse rotation unusable at low framerate (case 1340344).
- Fixed warning "Releasing render texture that is set to be RenderTexture.active!" on pipeline disposal / hdrp live editing.
- Fixed a nullref in volume system after deleting a volume object (case 1348374).
- Fixed update order in Graphics Compositor causing jumpy camera updates (case 1345566).
- Fixed material inspector that allowed setting intensity to an infinite value.
- Fixed issue when switching between non-persistent cameras when path tarcing is enabled (case 1337843).
- Fixed issue with the LayerMaskParameter class storing an erroneous mask value (case 1345515).
- Fixed issue with vertex color defaulting to 0.0 when not defined, in ray/path tracing (case 1348821).
- Fixed issue with a compute dispatch being with 0 threads on extremely small resolutions.
- Fixed incorrect light list indexing when TAA is enabled (case 1352444).
- Fixed Additional Velocity for Alembic not taking correctly into account vertex animation
- Fixed wrong LUT initialization in Wireframe mode.
- Fixed case where the SceneView don't refresh when using LightExplorer with a running and Paused game (1354129)

## [10.6.0] - 2021-04-29

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ Using the Inspector allows you to change all of the Decal Projector properties,

## Limitations

- The Decal Projector can affect opaque Materials with either a [Decal Shader](Decal-Shader.md) or a [Decal Master Stack](master-stack-decal.md). However, it can only affect transparent Materials with the [Decal Shader](Decal-Shader.md).
- Decal Emissive isn't supported on Transparent Material.
- The Decal Projector can affect opaque Materials with either a [Decal Shader](Decal-Shader.md) or a [Decal Master Stack](master-stack-decal.md). However, it can only affect transparent Materials with the [Decal Shader](Decal-Shader.md).
- Emissive decals isn't supported on Transparent Material.
- Emissive decals always give an additive positive contribution. This property does not affect the existing emissive properties of the Materials assigned to a GameObject.
- The **Receive Decals** property of Materials in HDRP does not affect emissive decals. HDRP always renders emissive decals unless you use Decal Layers, which can disable emissive decals on a Layer by Layer basis.
- If you project a decal onto a transparent surface, HDRP ignores the decal's Texture tiling.
- In **Project Settings > Graphics**, if **Instancing Variants** is set to **Strip All**, Unity strips the Decal Shader this component references when you build your Project. This happens even if you include the Shader in the **Always Included Shaders** list. If Unity strips the Shader during the build process, the decal does not appear in your built Application.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ These properties allow you to set the affected attributes of the Material the de
| **Affect Metal** | Enable the checkbox to make the decal use the metallic property of its **Mask Map**. Otherwise the decal has no metallic effect. Uses the red channel of the **Mask Map**.<br />This property only appears when you enable the **Metal and Ambient Occlusion properties** checkbox in your [HDRP Asset](HDRP-Asset.md#Decals). |
| **Affect Ambient Occlusion** | Enable the checkbox to make the decal use the ambient occlusion property of its **Mask Map**. Otherwise the decal has no ambient occlusion effect. Uses the green channel of the **Mask Map**.<br />This property only appears when you enable the **Metal and Ambient Occlusion properties** checkbox in your [HDRP Asset](HDRP-Asset.md#Decals). |
| **Affect Smoothness** | Enable the checkbox to make the decal use the smoothness property of its **Mask Map**. Otherwise the decal has no smoothness effect. Uses the alpha channel of the **Mask Map**.<br /> |
| **Affect Emissive** | Enable the checkbox to make this decal emissive. When enabled, this Material appears self-illuminated and acts as a visible source of light. This property does not work with transparent receiving Materials. |
| **Affect Emissive** | Enable the checkbox to make this decal emissive. When enabled, this Material appears self-illuminated and acts as a visible source of light. This property does not work with transparent receiving Materials. Emissive decals always give an additive positive contribution. This property does not affect the existing emissive properties of the Materials assigned to a GameObject. |


### Surface Inputs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,6 @@ static void ZWriteForTransparent(Material material, HDShaderUtils.ShaderID id)
#endregion
static void RenderQueueUpgrade(Material material, HDShaderUtils.ShaderID id)
{
// In order for the ray tracing keyword to be taken into account, we need to make it dirty so that the parameter is created first
HDShaderUtils.ResetMaterialKeywords(material);

// Replace previous ray tracing render queue for opaque to regular opaque with raytracing
if (material.renderQueue == ((int)UnityEngine.Rendering.RenderQueue.GeometryLast + 20))
{
Expand All @@ -279,6 +276,9 @@ static void RenderQueueUpgrade(Material material, HDShaderUtils.ShaderID id)
material.SetFloat(kRayTracing, 1.0f);
}

// In order for the ray tracing keyword to be taken into account, we need to make it dirty so that the parameter is created first
HDShaderUtils.ResetMaterialKeywords(material);

// For shader graphs, there is an additional pass we need to do
if (material.HasProperty("_RenderQueueType"))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,10 @@ protected virtual LightingExplorerTableColumn[] GetHDLightColumns()
{
Undo.RecordObject(tLightData, "Changed shadow resolution override");
tShadowResolution.@override = sShadowResolution.@override;

//SceneView don't update when interacting with Light Explorer when playing and pausing (1354129)
if (EditorApplication.isPlaying && EditorApplication.isPaused)
SceneView.RepaintAll();
}
}),
new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Checkbox, HDStyles.AffectDiffuse, "m_Intensity", 95, (r, prop, dep) => // 16: Affect Diffuse
Expand All @@ -546,6 +550,10 @@ protected virtual LightingExplorerTableColumn[] GetHDLightColumns()
{
Undo.RecordObject(lightData, "Changed affects diffuse");
lightData.affectDiffuse = affectDiffuse;

//SceneView don't update when interacting with Light Explorer when playing and pausing (1354129)
if (EditorApplication.isPlaying && EditorApplication.isPaused)
SceneView.RepaintAll();
}
}, (lprop, rprop) =>
{
Expand Down Expand Up @@ -580,6 +588,10 @@ protected virtual LightingExplorerTableColumn[] GetHDLightColumns()
{
Undo.RecordObject(lightData, "Changed affects specular");
lightData.affectSpecular = affectSpecular;

//SceneView don't update when interacting with Light Explorer when playing and pausing (1354129)
if (EditorApplication.isPlaying && EditorApplication.isPaused)
SceneView.RepaintAll();
}
}, (lprop, rprop) =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ScleraIrisBlend : CodeFunctionNode
{
public ScleraIrisBlend()
{
name = "Sclera Limbal Ring (Preview)";
name = "Sclera Iris Blend (Preview)";
}

public override bool hasPreview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ namespace UnityEditor.Rendering.HighDefinition
{
class EmissionUIBlock : MaterialUIBlock
{
static float s_MaxEvValue = Mathf.Floor(LightUtils.ConvertLuminanceToEv(float.MaxValue));

[Flags]
public enum Features
{
Expand Down Expand Up @@ -119,7 +121,7 @@ internal static void UpdateEmissiveColorFromIntensityAndEmissiveColorLDR(Materia

internal static void UpdateEmissiveColorLDRFromIntensityAndEmissiveColor(MaterialProperty emissiveColorLDR, MaterialProperty emissiveIntensity, MaterialProperty emissiveColor)
{
Color emissiveColorLDRLinear = emissiveColorLDR.colorValue / emissiveIntensity.floatValue;
Color emissiveColorLDRLinear = emissiveColor.colorValue / emissiveIntensity.floatValue;
emissiveColorLDR.colorValue = emissiveColorLDRLinear.gamma;
}

Expand Down Expand Up @@ -183,7 +185,7 @@ void DrawEmissionGUI()
{
float evValue = LightUtils.ConvertLuminanceToEv(emissiveIntensity.floatValue);
evValue = EditorGUILayout.FloatField(Styles.emissiveIntensityText, evValue);
newIntensity = Mathf.Clamp(evValue, 0, float.MaxValue);
newIntensity = Mathf.Clamp(evValue, 0, s_MaxEvValue);
emissiveIntensity.floatValue = LightUtils.ConvertEvToLuminance(evValue);
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ public void UpdateLayerSetup()
SetupLayerPriorities();
}

// Update is called once per frame
void Update()
// LateUpdate is called once per frame
void LateUpdate()
{
// TODO: move all validation calls to onValidate. Before doing it, this needs some extra testing to ensure nothing breaks
if (enableOutput == false || ValidatePipeline() == false || ValidateAndFixRuntime() == false || RuntimeCheck() == false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3360,6 +3360,9 @@ unsafe BuildGPULightListParameters PrepareBuildGPULightListParameters( HDCamera
for (int viewIndex = 0; viewIndex < hdCamera.viewCount; ++viewIndex)
{
var proj = hdCamera.xr.enabled ? hdCamera.xr.GetProjMatrix(viewIndex) : camera.projectionMatrix;
// Note: we need to take into account the TAA jitter when indexing the light list
proj = (hdCamera.antialiasing == HDAdditionalCameraData.AntialiasingMode.TemporalAntialiasing) ? hdCamera.GetJitteredProjectionMatrix(proj) : proj;

m_LightListProjMatrices[viewIndex] = proj * s_FlipMatrixLHSRHS;

for (int i = 0; i < 16; ++i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

#ifndef SCALARIZE_LIGHT_LOOP
// We perform scalarization only for forward rendering as for deferred loads will already be scalar since tiles will match waves and therefore all threads will read from the same tile.
// More info on scalarization: https://flashypixels.wordpress.com/2018/11/10/intro-to-gpu-scalarization-part-2-scalarize-all-the-lights/
// More info on scalarization: https://flashypixels.wordpress.com/2018/11/10/intro-to-gpu-scalarization-part-2-scalarize-all-the-lights/ .
// Note that it is currently disabled on gamecore platforms for issues with wave intrinsics and the new compiler, it will be soon investigated, but we disable it in the meantime.
#define SCALARIZE_LIGHT_LOOP (defined(PLATFORM_SUPPORTS_WAVE_INTRINSICS) && !defined(LIGHTLOOP_DISABLE_TILE_AND_CLUSTER) && !defined(SHADER_API_GAMECORE) && SHADERPASS == SHADERPASS_FORWARD)
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ namespace UnityEngine.Rendering.HighDefinition
/// </summary>
class LightUtils
{
static float s_LuminanceToEvFactor = Mathf.Log(100f / ColorUtils.s_LightMeterCalibrationConstant, 2);
static float s_EvToLuminanceFactor = -Mathf.Log(100f / ColorUtils.s_LightMeterCalibrationConstant, 2);

// Physical light unit helper
// All light unit are in lumen (Luminous power)
// Punctual light (point, spot) are convert to candela (cd = lumens / steradian)
Expand Down Expand Up @@ -163,8 +166,7 @@ public static float ConvertCandelaToLux(float candela, float distance)
/// <returns></returns>
public static float ConvertEvToLuminance(float ev)
{
float k = ColorUtils.s_LightMeterCalibrationConstant;
return (k / 100.0f) * Mathf.Pow(2, ev);
return Mathf.Pow(2, ev + s_EvToLuminanceFactor);
}


Expand Down Expand Up @@ -194,8 +196,7 @@ public static float ConvertEvToLux(float ev, float distance)
/// <returns></returns>
public static float ConvertLuminanceToEv(float luminance)
{
float k = ColorUtils.s_LightMeterCalibrationConstant;
return (float)Math.Log((luminance * 100f) / k, 2);
return Mathf.Log(luminance, 2) + s_LuminanceToEvFactor;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,8 @@ static void GenerateMaxZ(in GenerateMaxZParameters parameters, RTHandle depthTex
cmd.SetComputeVectorParam(cs, HDShaderIDs._SrcOffsetAndLimit, srcLimitAndDepthOffset);
cmd.SetComputeFloatParam(cs, HDShaderIDs._DilationWidth, parameters.dilationWidth);

int finalMaskW = maskW / 2;
int finalMaskH = maskH / 2;
int finalMaskW = Mathf.CeilToInt(maskW / 2.0f);
int finalMaskH = Mathf.CeilToInt(maskH / 2.0f);

dispatchX = HDUtils.DivRoundUp(finalMaskW, 8);
dispatchY = HDUtils.DivRoundUp(finalMaskH, 8);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,13 @@ public override void RenderInit(CommandBuffer cmd)
return;
}

if (GL.wireframe)
{
m_preIntegratedFGD_Ward.Create();
m_preIntegratedFGD_CookTorrance.Create();
return;
}

using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.PreIntegradeWardCookTorrance)))
{
CoreUtils.DrawFullScreen(cmd, m_preIntegratedFGDMaterial_Ward, new RenderTargetIdentifier(m_preIntegratedFGD_Ward));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ TEXTURE2D_X(_ShadowMaskTexture); // Alias for shadow mask, so we don't need to k
// If a user do a lighting architecture without material classification, this can be remove
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl"

// Currently disable SSR until critical editor fix is available
#undef LIGHTFEATUREFLAGS_SSREFLECTION
#define LIGHTFEATUREFLAGS_SSREFLECTION 0

// Combination need to be define in increasing "comlexity" order as define by FeatureFlagsToTileVariant
static const uint kFeatureVariantFlags[NUM_FEATURE_VARIANTS] =
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ public void RenderInit(FGDIndex index, CommandBuffer cmd)
if (m_isInit[(int)index] && m_PreIntegratedFGD[(int)index].IsCreated())
return;

// If we are in wireframe mode, the drawfullscreen will not work as expected, but we don't need the LUT anyway
// So create the texture to avoid errors, it will be initialized by the first render without wireframe
if (GL.wireframe)
{
m_PreIntegratedFGD[(int)index].Create();
return;
}

CoreUtils.DrawFullScreen(cmd, m_PreIntegratedFGDMaterial[(int)index], new RenderTargetIdentifier(m_PreIntegratedFGD[(int)index]));
m_isInit[(int)index] = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ void UpdateVolumeAndPhysicalParameters()
}
}

Matrix4x4 GetJitteredProjectionMatrix(Matrix4x4 origProj)
internal Matrix4x4 GetJitteredProjectionMatrix(Matrix4x4 origProj)
{
// Do not add extra jitter in VR unless requested (micro-variations from head tracking are usually enough)
if (xr.enabled && !HDRenderPipeline.currentAsset.currentPlatformRenderPipelineSettings.xrSettings.cameraJitter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,13 @@ TextureHandle RenderPathTracing(RenderGraph renderGraph, HDCamera hdCamera)
// Refactor that when we formalize how to handle persistent textures better (with automatic lifetime and such).
var radianceTexture = renderGraph.ImportTexture(m_RadianceTexture);

// Check if the camera has a valid history buffer and if not reset the accumulation.
// This can happen if a script disables and re-enables the camera (case 1337843).
if (!hdCamera.isPersistent && hdCamera.GetCurrentFrameRT((int)HDCameraFrameHistoryType.PathTracing) == null)
{
m_SubFrameManager.Reset(hdCamera.camera.GetInstanceID());
}

if (!m_SubFrameManager.isRecording)
{
// If we are recording, the max iteration is set/overridden by the subframe manager, otherwise we read it from the path tracing volume
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,15 @@ void FetchIntersectionVertex(uint vertexIndex, out IntersectionVertex outVertex)

#ifdef ATTRIBUTES_NEED_COLOR
outVertex.color = UnityRayTracingFetchVertexAttribute4(vertexIndex, kVertexAttributeColor);
#else
outVertex.color = 0.0;
#endif

// We want to default to white in case there is no specified color, to match the raster behaviour
// FIXME: This could be addressed in UnityRayTracingFetchVertexAttribute4(), but until then we use this workaround
if (!any(outVertex.color))
outVertex.color = 1.0;

#else
outVertex.color = 0.0;
#endif
}

void GetCurrentIntersectionVertex(AttributeData attributeData, out IntersectionVertex outVertex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,25 @@ PackedVaryingsType MotionVectorVS(inout VaryingsType varyingsType, AttributesMes
bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target

float3 effectivePositionOS = (hasDeformation ? inputPass.previousPositionOS : inputMesh.positionOS);
#if defined(_ADD_PRECOMPUTED_VELOCITY)
effectivePositionOS -= inputPass.precomputedVelocity;
#endif

// Need to apply any vertex animation to the previous worldspace position, if we want it to show up in the motion vector buffer
#if defined(HAVE_MESH_MODIFICATION)
AttributesMesh previousMesh = inputMesh;
previousMesh.positionOS = effectivePositionOS ;

previousMesh = ApplyMeshModification(previousMesh, _LastTimeParameters.xyz);

#if defined(_ADD_PRECOMPUTED_VELOCITY)
previousMesh.positionOS -= inputPass.precomputedVelocity;
#endif

float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.positionOS);
#else

#if defined(_ADD_PRECOMPUTED_VELOCITY)
effectivePositionOS -= inputPass.precomputedVelocity;
#endif

float3 previousPositionRWS = TransformPreviousObjectToWorld(effectivePositionOS);
#endif

Expand Down