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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RefractionModelResult RefractionModelSphere(real3 V, float3 positionWS, real3 no
// Sphere shape model:
// We approximate locally the shape of the object as sphere, that is tangent to the shape.
// The sphere has a diameter of {thickness}
// The center of the sphere is at {positionWS} - {normalWS} * {thickness}
// The center of the sphere is at {positionWS} - {normalWS} * {thickness} * 0.5
//
// So the light is refracted twice: in and out of the tangent sphere

Expand Down
8 changes: 8 additions & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- API to allow OnDemand shadows to not render upon placement in the Cached Shadow Atlas.
- Exposed update upon light movement for directional light shadows in UI.
- Added a fallback for the ray traced directional shadow in case of a transmission (case 1307870).
- Added an info box for micro shadow editor (case 1322830).

### Fixed
- Fixed probe volumes debug views.
Expand Down Expand Up @@ -154,6 +155,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed a bug with Reflection Probe baking would result in an incorrect baking reusing other's Reflection Probe baking
- Fixed volumetric fog being visually chopped or missing when using hardware Dynamic Resolution Scaling.
- Fixed generation of the packed depth pyramid when hardware Dynamic Resolution Scaling is enabled.
- Fixed issue with an assert getting triggered with OnDemand shadows.
- Fixed Decal's UV edit mode with negative UV
- Fixed issue with the color space of AOVs (case 1324759)
- Fixed issue with history buffers when using multiple AOVs (case 1323684).
- Fixed camera preview with multi selection (case 1324126).

### Changed
- Removed the material pass probe volumes evaluation mode.
Expand Down Expand Up @@ -189,6 +195,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- The default LookDev volume profile is now copied and referened in the Asset folder instead of the package folder.
- Changed normal used in path tracing to create a local light list from the geometric to the smooth shading one.
- Assets going through the migration system are now dirtied.
- Changed ray tracing acceleration structure build, so that only meshes with HDRP materials are included (case 1322365).
- Increased path tracing max samples from 4K to 16K (case 1327729).

## [10.3.0] - 2020-12-01

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ This means that, if screen space refraction does not return information for a pi

The first tier of the refraction hierarchy is a screen space solution. To calculate screen space refraction, the algorithm traces a ray starting from the refractive object. It then refracts the ray according to the properties of the material. To compute the refracted ray, the algorithm assumes that the refractive object can be approximated as a simple shape ([Refraction Model](#RefractionModel)) .

The refracted ray will be then intersected against the proxy volume to find the right pixel in screen space that best approximates the result of the refracted ray.
The refracted ray will be then intersected against the closest probe proxy volume to find the pixel in screen space that best approximates the result of the refracted ray. If there is no reflection probe proxy available, HDRP will fallback to a projection at infinite.

<a name="ReflectionProbes"></a>

Expand All @@ -82,15 +82,15 @@ For more information on Reflection Probes, see:
HDRP uses simple shapes to approximate the surface of GameObjects:

- **Sphere**: Approximates the surface as a sphere.
- **Box**: Approximates the surface as an hollow box. In this case think of the thickness as being the distance between two parallel faces of the box.
- **Thin**: Approximated the surface as a box with a fixed thickness of 5cm.
- **Box**: Approximates the surface as a hollow box. In this case think of the thickness as being the distance between two parallel faces of the box.
- **Thin**: Approximates the surface as a hollow box with a fixed thickness of 5cm.

### Examples

- For a filled GameObject, use a **Sphere** Refraction Model with a thickness that is approximately the size of the GameObject that the Material is for. To set the thickness, use the **Refraction Thickness**.
- For a solid GameObject, use the **Sphere** Refraction Model with a thickness that is approximately the size of the GameObject that the Material is for. To set the thickness, use the **Refraction Thickness**.

![](Images/RefractionInHDRP1.png)

- For a hollow refractive GameObject (for example, a bubble), use a **Box** refraction Mode with a small value for thickness. To set the thickness, use the **Refraction Thickness**.
- For a hollow refractive GameObject (for example, a bubble), use the **Thin** refraction Model, or **Box** with a small thickness value. To set the thickness, use the **Refraction Thickness**.

![](Images/RefractionInHDRP2.png)
![](Images/RefractionInHDRP2.png)
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The following table shows the compatibility of the High Definition Render Pipeli

| **Package version** | **Minimum Unity version** | **Maximum Unity version** |
| ------------------- | ------------------------- | ------------------------- |
| 11.x | 2021.1 | 2021.1 |
| 10.x | 2020.2 | 2020.2 |
| 8.x / 9.x-preview | 2020.1 | 2020.1 |
| 7.x | 2019.3 | 2019.4 |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using UnityEngine.Rendering.HighDefinition;

namespace UnityEditor.Rendering.HighDefinition
{
[VolumeComponentEditor(typeof(MicroShadowing))]
sealed class MicroShadowingEditor : VolumeComponentEditor
{
static public readonly string k_DirectionnalWarning = "Micro Shadows only works with directional Lights";

public override void OnInspectorGUI()
{
base.OnInspectorGUI();
EditorGUILayout.HelpBox(k_DirectionnalWarning, MessageType.Info);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static DisplacableRectHandles uvHandles
get
{
if (s_uvHandles == null || s_uvHandles.Equals(null))
s_uvHandles = new DisplacableRectHandles(s_LastColor);
s_uvHandles = new DisplacableRectHandles(s_LastColor, allowsNegative: true);
return s_uvHandles;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ enum NamedEdge { Right, Top, Left, Bottom, None }
Color m_MonochromeHandleColor;
Color m_WireframeColor;
Color m_WireframeColorBehind;
bool allowsNegative;

/// <summary>The position of the center of the box in Handle.matrix space. On plane z=0.</summary>
public Vector2 center { get; set; }
Expand Down Expand Up @@ -58,9 +59,10 @@ public Color baseColor
}
}

public DisplacableRectHandles(Color baseColor)
public DisplacableRectHandles(Color baseColor, bool allowsNegative = false)
{
this.baseColor = baseColor;
this.allowsNegative = allowsNegative;
}

/// <summary>Draw the rect.</summary>
Expand Down Expand Up @@ -258,7 +260,8 @@ public void DrawHandle()
case NamedEdge.Bottom: topPosition.y -= delta; break;
}

EnsureEdgeFacesOutsideForSymetry(theChangedEdge, ref leftPosition, ref rightPosition, ref topPosition, ref bottomPosition);
if (!allowsNegative)
EnsureEdgeFacesOutsideForSymetry(theChangedEdge, ref leftPosition, ref rightPosition, ref topPosition, ref bottomPosition);
}

if (useHomothety)
Expand All @@ -278,13 +281,14 @@ public void DrawHandle()
break;
}

EnsureEdgeFacesOutsideForHomothety(theChangedEdge, ref leftPosition, ref rightPosition, ref topPosition, ref bottomPosition);
if (!allowsNegative)
EnsureEdgeFacesOutsideForHomothety(theChangedEdge, ref leftPosition, ref rightPosition, ref topPosition, ref bottomPosition);
}

var max = new Vector2(rightPosition.x, topPosition.y);
var min = new Vector2(leftPosition.x, bottomPosition.y);

if (!useSymetry && !useHomothety)
if (!useSymetry && !useHomothety && !allowsNegative)
EnsureEdgeFacesOutsideForOtherTransformation(ref max, ref min);

center = (max + min) * .5f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal static class Styles
{
public static string refractionModelText = "Refraction Model";
public static GUIContent refractionIorText = new GUIContent("Index Of Refraction", "Controls the index of refraction for this Material.");
public static GUIContent refractionThicknessText = new GUIContent("Thickness", "Controls the thickness for rough refraction.");
public static GUIContent refractionThicknessText = new GUIContent("Thickness", "Controls the thickness for rough refraction.\nFor a Sphere model, this is the diameter of the sphere.");
public static GUIContent refractionThicknessMapText = new GUIContent("Thickness Map", "Specifies the Refraction Thickness Map (R) for this Material - This acts as a thickness multiplier map.");
public static GUIContent refractionThicknessRemappingText = new GUIContent("Thickness Remapping", "Controls the maximum thickness for rough refraction.");
public static GUIContent thicknessMapText = new GUIContent("Thickness Map", "Specifies the Thickness Map (R) for this Material - This map describes the thickness of the object. When subsurface scattering is enabled, low values allow some light to transmit through the object.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,32 @@ void OnOverlayGUI(Object target, SceneView sceneView)

Camera InitializePreviewCamera(Camera c, Vector2 previewSize)
{
m_PreviewCamera.CopyFrom(c);
EditorUtility.CopySerialized(c, m_PreviewCamera);
Camera previewCamera = null;
HDAdditionalCameraData previewAdditionalCameraData = null;
for (int i = 0; i < serializedObject.targetObjects.Length; i++)
{
if (serializedObject.targetObjects[i] == c)
{
previewCamera = m_PreviewCameras[i];
previewAdditionalCameraData = m_PreviewAdditionalCameraDatas[i];
break;
}
}

previewCamera.CopyFrom(c);
EditorUtility.CopySerialized(c, previewCamera);
var cameraData = c.GetComponent<HDAdditionalCameraData>();
EditorUtility.CopySerialized(cameraData, m_PreviewAdditionalCameraData);
EditorUtility.CopySerialized(cameraData, previewAdditionalCameraData);
// We need to explicitly reset the camera type here
// It is probably a CameraType.Game, because we copied the source camera's properties.
m_PreviewCamera.cameraType = CameraType.Preview;
m_PreviewCamera.gameObject.SetActive(false);
previewCamera.cameraType = CameraType.Preview;
previewCamera.gameObject.SetActive(false);

var previewTexture = GetPreviewTextureWithSize((int)previewSize.x, (int)previewSize.y);
m_PreviewCamera.targetTexture = previewTexture;
m_PreviewCamera.pixelRect = new Rect(0, 0, previewSize.x, previewSize.y);
previewCamera.targetTexture = previewTexture;
previewCamera.pixelRect = new Rect(0, 0, previewSize.x, previewSize.y);

return m_PreviewCamera;
return previewCamera;
}

static Type k_SceneViewOverlay_WindowFunction = Type.GetType("UnityEditor.SceneViewOverlay+WindowFunction,UnityEditor");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,25 @@ partial class HDCameraEditor : Editor
SerializedHDCamera m_SerializedCamera;

RenderTexture m_PreviewTexture;
Camera m_PreviewCamera;
HDAdditionalCameraData m_PreviewAdditionalCameraData;
Camera[] m_PreviewCameras;
HDAdditionalCameraData[] m_PreviewAdditionalCameraDatas;

void OnEnable()
{
m_SerializedCamera = new SerializedHDCamera(serializedObject);

m_PreviewCamera = EditorUtility.CreateGameObjectWithHideFlags("Preview Camera", HideFlags.HideAndDontSave, typeof(Camera)).GetComponent<Camera>();
m_PreviewCamera.enabled = false;
m_PreviewCamera.cameraType = CameraType.Preview; // Must be init before adding HDAdditionalCameraData
m_PreviewAdditionalCameraData = m_PreviewCamera.gameObject.AddComponent<HDAdditionalCameraData>();
// Say that we are a camera editor preview and not just a regular preview
m_PreviewAdditionalCameraData.isEditorCameraPreview = true;
var targetCount = serializedObject.targetObjects.Length;
m_PreviewCameras = new Camera[targetCount];
m_PreviewAdditionalCameraDatas = new HDAdditionalCameraData[targetCount];
for (int i = 0; i < targetCount; i++)
{
m_PreviewCameras[i] = EditorUtility.CreateGameObjectWithHideFlags("Preview " + serializedObject.targetObject.name, HideFlags.HideAndDontSave, typeof(Camera)).GetComponent<Camera>();
m_PreviewCameras[i].enabled = false;
m_PreviewCameras[i].cameraType = CameraType.Preview; // Must be init before adding HDAdditionalCameraData
m_PreviewAdditionalCameraDatas[i] = m_PreviewCameras[i].gameObject.AddComponent<HDAdditionalCameraData>();
// Say that we are a camera editor preview and not just a regular preview
m_PreviewAdditionalCameraDatas[i].isEditorCameraPreview = true;
}
}

void OnDisable()
Expand All @@ -36,8 +42,10 @@ void OnDisable()
m_PreviewTexture.Release();
m_PreviewTexture = null;
}
DestroyImmediate(m_PreviewCamera.gameObject);
m_PreviewCamera = null;
for (int i = 0; i < serializedObject.targetObjects.Length; i++)
DestroyImmediate(m_PreviewCameras[i].gameObject);
m_PreviewCameras = null;
m_PreviewAdditionalCameraDatas = null;
}

public override void OnInspectorGUI()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ static void MenuCreateCSharpPostProcessVolume()
static void MenuCreatePostProcessShader()
{
string templatePath = $"{HDUtils.GetHDRenderPipelinePath()}/Editor/PostProcessing/Templates/CustomPostProcessingShader.template";
ProjectWindowUtil.CreateScriptAssetFromTemplateFile(templatePath, "New Post Process Shader.shader");
ProjectWindowUtil.CreateScriptAssetFromTemplateFile(templatePath, "New Post Process Volume.shader");
}

//[MenuItem("Internal/HDRP/Add \"Additional Light-shadow Data\" (if not present)")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ unsafe struct ShaderVariablesDebugDisplay
public int _DebugSingleShadowIndex;

public int _DebugProbeVolumeMode;
public Vector3 _DebugDisplayPad0;
public int _DebugAOVOutput;
public int _DebugDisplayPad0;
public int _DebugDisplayPad1;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ CBUFFER_START(ShaderVariablesDebugDisplay)
float _MatcapViewScale;
int _DebugSingleShadowIndex;
int _DebugProbeVolumeMode;
float3 _DebugDisplayPad0;
int _DebugAOVOutput;
int _DebugDisplayPad0;
int _DebugDisplayPad1;
CBUFFER_END


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,8 @@ internal void MarkAsRendered(int shadowIdx)
if (m_ShadowsPendingRendering.ContainsKey(shadowIdx))
{
m_ShadowsPendingRendering.Remove(shadowIdx);
m_ShadowsWithValidData.Add(shadowIdx, shadowIdx);
if (!m_ShadowsWithValidData.ContainsKey(shadowIdx))
m_ShadowsWithValidData.Add(shadowIdx, shadowIdx);
}
}

Expand Down
Loading