浏览代码

Merge branch 'HDRP/staging' of https://github.com/Unity-Technologies/ScriptableRenderPipeline into Branch_FixPreIntegratedFGD

# Conflicts:
#	com.unity.render-pipelines.high-definition/CHANGELOG.md
/main
Julien Ignace 6 年前
当前提交
a66ac281
共有 9 个文件被更改,包括 81 次插入23 次删除
  1. 4
      com.unity.render-pipelines.high-definition/CHANGELOG.md
  2. 37
      com.unity.render-pipelines.high-definition/HDRP/Camera/HDAdditionalCameraData.cs
  3. 31
      com.unity.render-pipelines.high-definition/HDRP/Editor/Camera/HDCameraEditor.cs
  4. 4
      com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDPBRPass.template
  5. 4
      com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDUnlitPassForward.template
  6. 5
      com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs
  7. 14
      com.unity.render-pipelines.high-definition/HDRP/ShaderVariables.hlsl
  8. 3
      com.unity.render-pipelines.high-definition/HDRP/ShaderVariablesMatrixDefsHDCamera.hlsl
  9. 2
      com.unity.render-pipelines.high-definition/HDRP/ShaderVariablesMatrixDefsLegacyUnity.hlsl

4
com.unity.render-pipelines.high-definition/CHANGELOG.md


## [unreleased]
- Fixed an issue with PreIntegratedFGD texture being sometimes destroyed and not regenerated causing rendering to break
## [3.0.0-preview]
### Added
- Added support for RendererPriority on Renderer. This allow to control order of transparent rendering manually. HDRP have now two stage of sorting for transparent in addition to bact to front. Material have a priority then Renderer have a priority.
- Add Coupling of (HD)Camera and HDAdditionalCameraData for reset and remove in inspector contextual menu of Camera
### Fixed
- Fixed an issue with distortion that was using previous frame instead of current frame

37
com.unity.render-pipelines.high-definition/HDRP/Camera/HDAdditionalCameraData.cs


using UnityEngine.Serialization;
using UnityEngine.Assertions;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{

None
};
public ClearColorMode clearColorMode = ClearColorMode.Sky;
public ClearColorMode clearColorMode;
public Color backgroundColorHDR = new Color(0.025f, 0.07f, 0.19f, 0.0f);
public bool clearDepth = true;
public Color backgroundColorHDR;
public bool clearDepth;
public LayerMask volumeLayerMask = -1;
public LayerMask volumeLayerMask;
public float aperture = 8f;
public float shutterSpeed = 1f / 200f;
public float iso = 400f;
public float aperture;
public float shutterSpeed;
public float iso;
// To be able to turn on/off FrameSettings properties at runtime for debugging purpose without affecting the original one
// we create a runtime copy (m_ActiveFrameSettings that is used, and any parametrization is done on serialized frameSettings)

// When we are a preview, there is no way inside Unity to make a disctinctoin between camera preview and material preview.
// This property allow to say that we are an editor camera preview when the type is preview.
public bool isEditorCameraPreview { get; set; }
private void Awake()
{
Init();
}
public void Reset()
{
Init();
}
private void Init()
{
clearColorMode = ClearColorMode.Sky;
backgroundColorHDR = new Color(0.025f, 0.07f, 0.19f, 0.0f);
clearDepth = true;
renderingPath = RenderingPath.Default;
volumeLayerMask = -1;
aperture = 8f;
shutterSpeed = 1f / 200f;
iso = 400f;
}
// This is the function use outside to access FrameSettings. It return the current state of FrameSettings for the camera
// taking into account the customization via the debug menu

31
com.unity.render-pipelines.high-definition/HDRP/Editor/Camera/HDCameraEditor.cs


[CanEditMultipleObjects]
partial class HDCameraEditor : Editor
{
[MenuItem("CONTEXT/Camera/Remove HD Camera", false, 0)]
[MenuItem("CONTEXT/Camera/Remove Component", false, 0)]
Camera camera = go.GetComponent<Camera>();
HDAdditionalCameraData cameraAdditionalData = go.GetComponent<HDAdditionalCameraData>();
Assert.IsNotNull(camera);
Assert.IsNotNull(cameraAdditionalData);
Undo.DestroyObjectImmediate(go.GetComponent<Camera>());
Undo.DestroyObjectImmediate(go.GetComponent<HDAdditionalCameraData>());
Undo.DestroyObjectImmediate(camera);
Undo.DestroyObjectImmediate(cameraAdditionalData);
}
[MenuItem("CONTEXT/Camera/Reset", false, 0)]
static void ResetCamera(MenuCommand menuCommand)
{
GameObject go = ((Camera)menuCommand.context).gameObject;
Assert.IsNotNull(go);
Camera camera = go.GetComponent<Camera>();
HDAdditionalCameraData cameraAdditionalData = go.GetComponent<HDAdditionalCameraData>();
Assert.IsNotNull(camera);
Assert.IsNotNull(cameraAdditionalData);
Undo.SetCurrentGroupName("Reset HD Camera");
Undo.RecordObjects(new UnityEngine.Object[] { camera, cameraAdditionalData }, "Reset HD Camera");
camera.Reset();
cameraAdditionalData.Reset();
}
SerializedHDCamera m_SerializedCamera;

4
com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDPBRPass.template


ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
$SurfaceDescriptionInputs.WorldSpaceNormal: output.WorldSpaceNormal = normalize(input.worldToTangent[2].xyz);
$SurfaceDescriptionInputs.ObjectSpaceNormal: output.ObjectSpaceNormal = mul(output.WorldSpaceNormal, (float3x3) unity_ObjectToWorld); // transposed multiplication by inverse matrix to handle normal scale
$SurfaceDescriptionInputs.ViewSpaceNormal: output.ViewSpaceNormal = mul(output.WorldSpaceNormal, (float3x3) UNITY_MATRIX_I_V); // transposed multiplication by inverse matrix to handle normal scale
$SurfaceDescriptionInputs.ObjectSpaceNormal: output.ObjectSpaceNormal = mul(output.WorldSpaceNormal, (float3x3) UNITY_MATRIX_M); // transposed multiplication by inverse matrix to handle normal scale
$SurfaceDescriptionInputs.ViewSpaceNormal: output.ViewSpaceNormal = mul(output.WorldSpaceNormal, (float3x3) UNITY_MATRIX_I_V); // transposed multiplication by inverse matrix to handle normal scale
$SurfaceDescriptionInputs.TangentSpaceNormal: output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
$SurfaceDescriptionInputs.WorldSpaceTangent: output.WorldSpaceTangent = input.worldToTangent[0].xyz;
$SurfaceDescriptionInputs.ObjectSpaceTangent: output.ObjectSpaceTangent = TransformWorldToObjectDir(output.WorldSpaceTangent);

4
com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDUnlitPassForward.template


ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
$SurfaceDescriptionInputs.WorldSpaceNormal: output.WorldSpaceNormal = normalize(input.worldToTangent[2].xyz);
$SurfaceDescriptionInputs.ObjectSpaceNormal: output.ObjectSpaceNormal = mul(output.WorldSpaceNormal, (float3x3) unity_ObjectToWorld); // transposed multiplication by inverse matrix to handle normal scale
$SurfaceDescriptionInputs.ViewSpaceNormal: output.ViewSpaceNormal = mul(output.WorldSpaceNormal, (float3x3) UNITY_MATRIX_I_V); // transposed multiplication by inverse matrix to handle normal scale
$SurfaceDescriptionInputs.ObjectSpaceNormal: output.ObjectSpaceNormal = mul(output.WorldSpaceNormal, (float3x3) UNITY_MATRIX_M); // transposed multiplication by inverse matrix to handle normal scale
$SurfaceDescriptionInputs.ViewSpaceNormal: output.ViewSpaceNormal = mul(output.WorldSpaceNormal, (float3x3) UNITY_MATRIX_I_V); // transposed multiplication by inverse matrix to handle normal scale
$SurfaceDescriptionInputs.TangentSpaceNormal: output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
$SurfaceDescriptionInputs.WorldSpaceTangent: output.WorldSpaceTangent = input.worldToTangent[0].xyz;
$SurfaceDescriptionInputs.ObjectSpaceTangent: output.ObjectSpaceTangent = TransformWorldToObjectDir(output.WorldSpaceTangent);

5
com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs


rendererSupportsLightProbeProxyVolumes = true,
rendererSupportsMotionVectors = true,
rendererSupportsReceiveShadows = false,
rendererSupportsReflectionProbes = true
rendererSupportsReflectionProbes = true,
rendererSupportsRendererPriority = true
};
Lightmapping.SetDelegate(GlobalIlluminationUtils.hdLightsDelegate);

var drawSettings = new DrawRendererSettings(hdCamera.camera, HDShaderPassNames.s_EmptyName)
{
rendererConfiguration = rendererConfiguration,
sorting = { flags = SortFlags.CommonTransparent }
sorting = { flags = SortFlags.CommonTransparent | SortFlags.RendererPriority }
};
for (int i = 0; i < passNames.Length; ++i)

14
com.unity.render-pipelines.high-definition/HDRP/ShaderVariables.hlsl


#endif
}
// Define Model Matrix Macro
// Note: In order to be able to define our macro to forbid usage of unity_ObjectToWorld/unity_WorldToObject
// We need to declare inline function. Using uniform directly mean they are expand with the macro
float4x4 GetUnityObjectToWorld() { return unity_ObjectToWorld; }
float4x4 GetUnityWorldToObject() { return unity_WorldToObject; }
#define UNITY_MATRIX_M ApplyCameraTranslationToMatrix(GetUnityObjectToWorld())
#define UNITY_MATRIX_I_M ApplyCameraTranslationToInverseMatrix(GetUnityWorldToObject())
#define unity_ObjectToWorld Use_Macro_UNITY_MATRIX_M_instead_of_unity_ObjectToWorld
#define unity_WorldToObject Use_Macro_UNITY_MATRIX_I_M_instead_of_unity_WorldToObject
// Define View/Projection matrix macro
// This define allow to tell to unity instancing that we will use our camera relative functions (ApplyCameraTranslationToMatrix and ApplyCameraTranslationToInverseMatrix) for the model view matrix
#define MODIFY_MATRIX_FOR_CAMERA_RELATIVE_RENDERING

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


#ifndef UNITY_SHADER_VARIABLES_MATRIX_DEFS_HDCAMERA_INCLUDED
#define UNITY_SHADER_VARIABLES_MATRIX_DEFS_HDCAMERA_INCLUDED
#define UNITY_MATRIX_M ApplyCameraTranslationToMatrix(unity_ObjectToWorld)
#define UNITY_MATRIX_I_M ApplyCameraTranslationToInverseMatrix(unity_WorldToObject)
#if defined(USING_STEREO_MATRICES)
#define UNITY_MATRIX_V _ViewMatrixStereo[unity_StereoEyeIndex]

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


#ifndef UNITY_SHADER_VARIABLES_MATRIX_DEFS_LEGACY_UNITY_INCLUDED
#define UNITY_SHADER_VARIABLES_MATRIX_DEFS_LEGACY_UNITY_INCLUDED
#define UNITY_MATRIX_M ApplyCameraTranslationToMatrix(unity_ObjectToWorld)
#define UNITY_MATRIX_I_M ApplyCameraTranslationToInverseMatrix(unity_WorldToObject)
#define UNITY_MATRIX_V unity_MatrixV
#define UNITY_MATRIX_I_V unity_MatrixInvV
#define UNITY_MATRIX_P OptimizeProjectionMatrix(glstate_matrix_projection)

正在加载...
取消
保存