From 850907ef9027fec49d7009c9b6a1f153683f92e4 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Wed, 7 Apr 2021 14:52:20 +0200 Subject: [PATCH] Update refraction documentation --- .../ShaderLibrary/Refraction.hlsl | 2 +- .../Documentation~/Refraction-in-HDRP.md | 12 ++++++------ .../Editor/Material/UIBlocks/RefractionUIBlock.cs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/com.unity.render-pipelines.core/ShaderLibrary/Refraction.hlsl b/com.unity.render-pipelines.core/ShaderLibrary/Refraction.hlsl index 5ad1d16ee23..66059e3af34 100644 --- a/com.unity.render-pipelines.core/ShaderLibrary/Refraction.hlsl +++ b/com.unity.render-pipelines.core/ShaderLibrary/Refraction.hlsl @@ -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 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Refraction-in-HDRP.md b/com.unity.render-pipelines.high-definition/Documentation~/Refraction-in-HDRP.md index ef8b4b3c7a0..7c3a9756c46 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Refraction-in-HDRP.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Refraction-in-HDRP.md @@ -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. @@ -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) diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/RefractionUIBlock.cs b/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/RefractionUIBlock.cs index f8c765d7719..907ff437934 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/RefractionUIBlock.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/RefractionUIBlock.cs @@ -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.");