diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsVolumes.cs b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsVolumes.cs index 0ff6303ba12..ef240ec408c 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsVolumes.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsVolumes.cs @@ -399,15 +399,11 @@ private static void GenerateTableRows(DebugUI.Table table, List parameters, { VolumeParameter volumeParameter = (VolumeParameter)field.GetValue(o); #if UNITY_EDITOR || DEVELOPMENT_BUILD - var attr = (DisplayInfoAttribute[])field.GetCustomAttributes(typeof(DisplayInfoAttribute), true); - if (attr.Length != 0) - { - volumeParameter.debugId = attr[0].name; - } - else - { - volumeParameter.debugId = field.Name; - } + VolumeDebugData.AddVolumeParameterDebugId(volumeParameter, field); #endif parameters.Add(volumeParameter); } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Volume/VolumeDebugData.cs b/Packages/com.unity.render-pipelines.core/Runtime/Volume/VolumeDebugData.cs new file mode 100644 index 00000000000..7dad87b04aa --- /dev/null +++ b/Packages/com.unity.render-pipelines.core/Runtime/Volume/VolumeDebugData.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Reflection; + +namespace UnityEngine.Rendering +{ +#if UNITY_EDITOR || DEVELOPMENT_BUILD + internal static class VolumeDebugData + { + static Lazy> debugIds = new(() => new Dictionary()); + + internal static string GetVolumeParameterDebugId(VolumeParameter parameter) + { + return debugIds.Value.TryGetValue(parameter.fieldHash, out var debugId) ? debugId : string.Empty; + } + + internal static void AddVolumeParameterDebugId(VolumeParameter parameter, FieldInfo field) + { + var fieldHash = field.GetHashCode(); + parameter.fieldHash = fieldHash; + if (debugIds.Value.ContainsKey(fieldHash)) + return; + + var displayInfo = field.GetCustomAttribute(true); + var debugId = displayInfo != null ? displayInfo.name : field.Name; +#if UNITY_EDITOR + debugId = UnityEditor.ObjectNames.NicifyVariableName(debugId); // In the editor, make the name more readable +#endif + debugIds.Value.Add(fieldHash, debugId); + } + } +#endif +} \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Volume/VolumeDebugData.cs.meta b/Packages/com.unity.render-pipelines.core/Runtime/Volume/VolumeDebugData.cs.meta new file mode 100644 index 00000000000..f3d5f4cf0e3 --- /dev/null +++ b/Packages/com.unity.render-pipelines.core/Runtime/Volume/VolumeDebugData.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a359de1dc98b4f1db3fffb9601eb785b +timeCreated: 1743511791 \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Volume/VolumeParameter.cs b/Packages/com.unity.render-pipelines.core/Runtime/Volume/VolumeParameter.cs index 0a08f1ba9a8..989ced33837 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Volume/VolumeParameter.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Volume/VolumeParameter.cs @@ -19,7 +19,7 @@ namespace UnityEngine.Rendering public abstract class VolumeParameter : ICloneable { #if UNITY_EDITOR || DEVELOPMENT_BUILD - internal string debugId { get; set; } + internal int fieldHash { get; set; } #endif /// diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Dynamic-Resolution.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Dynamic-Resolution.md index 45bf98bf01e..66d4431cc94 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Dynamic-Resolution.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Dynamic-Resolution.md @@ -118,10 +118,11 @@ HDRP provides the following upscale filter methods: | **Upscale Filter Name** | Description | | ------------------------------------ | ------------------------------------------------------------ | -| Catmull-Rom | Catmull-Rom uses four bilinear samples. This uses the least resources, but it can cause blurry images after HDRP performs the upscaling step.

Catmull-Rom has no dependencies and runs at the end of the post-processing pipeline. | -| Contrast Adaptive Sharpen (CAS) | Contrast Adaptive Sharpen (CAS) uses **FidelityFX (CAS) AMD™**. This method produces a sharp image with an aggressive sharpening step. Do not use this option when the dynamic resolution screen percentage is less than 50%. For information about FidelityFX and Contrast Adaptive Sharpening, see[ AMD FidelityFX](https://www.amd.com/en/technologies/radeon-software-fidelityfx).

Contrast Adaptive Sharpen (CAS) has no dependencies and runs at the end of the post-processing pipeline. | -| FidelityFX Super Resolution 1.0 | FidelityFX Super Resolution 1.0 uses a spatial super-resolution method that balances quality and performance. For more information, see [AMD FidelityFX](https://www.amd.com/en/technologies/radeon-software-fidelityfx).

FidelityFX Super Resolution 1.0 has no dependencies and runs at the end of the post-processing pipeline.
FidelityFX Super Resolution 1.0 also runs when at 100% resolution as it can have beneficial sharpening effects.
For more information, see the section [Notes on FidelityFX Super Resolution 1.0](Dynamic-Resolution.md#notes-on-fidelityfx-super-resolution-1.0-(FSR))| -| Temporal Anti-Aliasing (TAA) Upscale | Temporal Anti-Aliasing (TAA) Upscale uses temporal integration to produce a sharp image. Unity performs this method alongside the normal anti-aliasing.
HDRP executes this upscale filter before post processing and at the same time as the TAA step. This means you can only use the TAA anti-aliasing method. This filter is not compatible with other anti-aliasing methods.

Temporal Anti-Aliasing (TAA) Upscale performs antialiasing on each frame. This means that it also runs when you enable Dynamic Resolution, even when the screen percentage is at 100% resolution.
For more information, see the section [Notes on TAA Upscale](Dynamic-Resolution.md#Notes). | +| **Catmull-Rom** | Catmull-Rom uses four bilinear samples. This uses the least resources, but it can cause blurry images after HDRP performs the upscaling step.

Catmull-Rom has no dependencies and runs at the end of the post-processing pipeline. | +| **Contrast Adaptive Sharpen (CAS)** | Contrast Adaptive Sharpen (CAS) uses **FidelityFX (CAS) AMD™**. This method produces a sharp image with an aggressive sharpening step. Do not use this option when the dynamic resolution screen percentage is less than 50%. For information about FidelityFX and Contrast Adaptive Sharpening, refer to [AMD FidelityFX](https://www.amd.com/en/technologies/radeon-software-fidelityfx).

Contrast Adaptive Sharpen (CAS) has no dependencies and runs at the end of the post-processing pipeline. | +| **AMD FidelityFX Super Resolution 1.0 (FSR1)** | FidelityFX Super Resolution 1.0 uses a spatial super-resolution method that balances quality and performance. For more information, refer to [AMD FidelityFX](https://www.amd.com/en/technologies/radeon-software-fidelityfx).

FSR1 has no dependencies and runs at the end of the post-processing pipeline.

FSR1 also runs when at 100% resolution as it can have beneficial sharpening effects.

For more information, refer to the section [Notes on FidelityFX Super Resolution 1.0](Dynamic-Resolution.md#notes-on-fidelityfx-super-resolution-10-fsr)| +| **Temporal Anti-Aliasing (TAA) Upscale** | Temporal Anti-Aliasing (TAA) Upscale uses temporal integration to produce a sharp image. Unity performs this method alongside the normal anti-aliasing.

HDRP executes this upscale filter before post processing and at the same time as the TAA step. This means you can only use the TAA anti-aliasing method. This filter is not compatible with other anti-aliasing methods.

Temporal Anti-Aliasing (TAA) Upscale performs antialiasing on each frame. This means that it also runs when you enable Dynamic Resolution, even when the screen percentage is at 100% resolution.

For more information, see the section [Notes on TAA Upscale](Dynamic-Resolution.md#notes-on-temporal-anti-aliasing-taa-upscale). | +| **NVIDIA Deep Learning Super Sampling (DLSS)** | HDRP supports DLSS only on the following platforms:
  • DirectX 11 on Windows 64-bit
  • DirectX 12 on Windows 64-bit
  • Vulkan on Windows 64-bit
Refer to [DLSS in HDRP](deep-learning-super-sampling-in-hdrp.md). | ## Overriding upscale options with code diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Asset.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Asset.md index feb0c341f92..f0c23330aae 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Asset.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Asset.md @@ -76,31 +76,56 @@ These settings control the draw distance and resolution of the decals atlas that | **- Layers** | Enable the checkbox to allow decals to only affect specific layers. | - ### Dynamic Resolution +For more information about dynamic resolution and upscale filters, refer to [Dynamic Resolution](Dynamic-Resolution.md). + | **Property** | **Description** | | ------------------------------------------- | ------------------------------------------------------------ | | **Enable** | Enable the checkbox to make HDRP support dynamic resolution in your Unity Project. | -| **- Enable DLSS** | Enable the checkbox to make HDRP support NVIDIA Deep Learning Super Sampling (DLSS).
This property only appears if you enable the NVIDIA package (com.unity.modules.nvidia) in your Unity project. | -| **-- Mode** | Use the drop-down to select which performance mode DLSS operates on. The options are:
• **Balanced**: - Balances performance with quality.
• **MaxPerf**: - Fast performance, lower quality.
• **MaxQuality**: - High quality, lower performance.
• **UltraPerformance**: - Fastest performance, lowest quality. | -| **-- Injection Point** | Use the drop-down to select at which point DLSS runs in the rendering pipeline:
• **Before Post**: - DLSS runs when all post processing effects are at full resolution.
• **After Depth Of Field**: - Depth of field runs at a low resolution and DLSS upscales everything in the next rendering step. All other post processing effects run at full resolution.
• **After Post Process**: - DLSS runs at the end of the pipeline when all post process are at low resolution.
• | -| **-- Use Optimal Settings** | Enable the checkbox to make DLSS control the Sharpness and Screen Percentage automatically. | -| **-- Sharpness** | Controls how the DLSS upsampler renders edges on the image. More sharpness usually means more contrast and a clearer image but can increase flickering and fireflies. Unity ignores this property if you enable **Use Optimal Settings**. | -| **- Dynamic Resolution Type** | Use the drop-down to select the type of dynamic resolution HDRP uses:
• **Software**: This option allocates render targets to accommodate the maximum resolution possible, then rescales the viewport accordingly. This allows the viewport to render at varying resolutions.
• **Hardware**: This option treats the render targets, up until the back buffer, as if they are all the scaled size. This means HDRP clears the render targets faster. | -| **- Upscale Filter** | Use the drop-down to select the filter that HDRP uses for upscaling unless overridden by user via script.
• **Catmull-Rom**: A bicubic upsample with 4 taps.
• **Contrast Adaptive Sharpen**: An ultra sharp upsample. This option is not meant for screen percentages less than 50% and still sharpens when the screen percentage is set to 100%. This uses **FidelityFX (CAS) AMD™**: For information about FidelityFX and Contrast Adaptive Sharpening, see [AMD FidelityFX](https://www.amd.com/en/technologies/radeon-software-fidelityfx).
• **FidelityFX Super Resolution 1.0 AMD™**: a spatial super-resolution technology that leverages cutting-edge algorithms to produce impressive upscaling quality at very fast performance. | -| **- Use Mip Bias** | Apply a negative bias on the texture samplers of deferred, opaque and transparent passes. This improves detail on textures but increases the texture fetching cost. Cost varies per platform. | -| **- Minimum Screen Percentage** | The minimum screen percentage that dynamic resolution can reach. | -| **- Maximum Screen Percentage** | The maximum screen percentage that dynamic resolution can reach. This value must be higher than the **Min Screen Percentage**. | -| **- Force Screen Percentage** | Enable the checkbox to force HDRP to use a specific screen percentage for dynamic resolution. This feature is useful for debugging dynamic resolution. | -| **- Forced Screen Percentage** | The specific screen percentage that HDRP uses for dynamic resolution. This property is only visible when you enable the **Force Screen Percentage**.. | -| **- Low Res Transparency Min Threshold** | The minimum percentage threshold allowed to clamp low resolution transparency. When the resolution percentage falls below this threshold, HDRP will clamp the low resolution to this percentage. | -| **- Ray Tracing Half Resolution Threshold** | The minimum percentage threshold allowed to render ray tracing effects at half resolution. When the resolution percentage falls below this threshold, HDRP will render ray tracing effects at full resolution. | -| **Water** | Controls for the Water System. | -| **- Enable** | Enable the Water System.| -| **- Simulation Resolution** | Set the resolution of the water simulation. Higher values use more system resources but provide higher visual quality. | -| **- Script Interactions** | Enable to have HDRP calculate the height of the water simulation on the CPU. Also makes it possible for you to query height data for specific points on the water's surface. You can use this data for customizations like your own buoyancy implementation, for example. | - +| **Enable DLSS** | Enables NVIDIA Deep Learning Super Sampling (DLSS). This option is available only if you enable the NVIDIA built-in package in the [Package Manager window](https://docs.unity3d.com/Manual/upm-ui.html). For more information, refer to [DLSS settings](#dlss-settings). | +| **Dynamic Resolution Type** | Sets how HDRP renders at a lower resolution. The options are:
  • **Software**: Allocates render targets to accommodate the maximum resolution possible, then rescales the viewport accordingly. This allows the viewport to render at varying resolutions.
  • **Hardware**: Treats the render targets up to the back buffer as if they're all the scaled size. This means HDRP clears the render targets faster.
| +| **Default Upscale Filter** | Sets the upscale filter HDRP uses to increase the resolution after rendering at a lower resolution.

The options are:
  • **Catmull-Rom**: A bicubic upsample with 4 taps.
  • **Contrast Adaptive Sharpen**: An ultra-sharp upsample. This option is not meant for screen percentages less than 50% and still sharpens when you set the screen percentage to 100%. This filter uses FidelityFX (CAS) AMD™.
  • **FidelityFX Super Resolution 1.0 AMD™ (FSR1)**: A spatial super-resolution technology that leverages cutting-edge algorithms to produce high upscaling quality at very fast performance.
  • **TAA Upscale**: A temporal anti-aliasing upscaler that uses information from previous frames to produce high-quality visuals.
If you enable **Enable DLSS**, this property becomes **Default Fallback Upscale Filter**. HDRP uses this filter if your build platform doesn't support DLSS.| +| **Injection Point** | Sets when HDRP applies the Catmull-Rom upscale filter. This property is available here only if you set **Default Upscale Filter** to **Catmull-Rom**. For more information, refer to [Injection points dropdown](#injection-points). | +| **Override FSR Sharpness** | Enables an **FSR Sharpness** slider that lets you set the sharpness of the FSR1 upscale filter. A value of 1.0 means maximum sharpness. A value of 0 means no sharpening. You can also set the sharpness per camera in the [Camera Inspector window](hdrp-camera-component-reference.md). This property is available only if you set **Default Upscale Filter** to **FidelityFX Super Resolution 1.0**. | +| **TAA Upscale Injection Point** | Sets when HDRP applies the TAA Upscaling filter. This property is available here only if you set **Default Upscale Filter** to **TAA Upscaling**. For more information, refer to [Injection points dropdown](#injection-points). | +| **Use Mip Bias** | Apply a negative bias on the texture samplers of deferred, opaque, and transparent passes. This improves detail on textures but increases the texture fetching cost. Cost varies per platform. | +| **Force Screen Percentage** | The specific screen percentage that HDRP uses for dynamic resolution. This property is only visible when you enable the **Force Screen Percentage**. | +| **Minimum Screen Percentage** | The minimum screen percentage that dynamic resolution can reach. | +| **Maximum Screen Percentage** | The maximum screen percentage that dynamic resolution can reach. This value must be higher than the **Min Screen Percentage**. | +| **Low Res Transparency Min Threshold** | Sets the minimum resolution that HDRP can render transparency, as a percentage of full screen resolution. | +| **Low Res Screen Space GI Min Threshold** | Sets the minimum resolution that HDRP can render screen-space global illumination, as a percentage of full screen resolution. | +| **Ray Tracing Half Resolution Threshold** | Sets the minimum resolution that HDRP can render ray tracing at half resolution. If the resolution falls below this threshold, HDRP renders ray tracing at full resolution. | + + +#### DLSS settings + +The following properties are available only if you enable **Enable DLSS**. + +| **Property** | **Description** | +|-|-| +| **DLSS Mode** | Sets whether DLSS prioritizes quality or performance. The options are:
  • **Maximum Quality**
  • **Balanced**
  • **Maximum Performance**
  • **Ultra Performance**
| +| **DLSS Injection Point** | Sets when DLSS runs in the rendering pipeline. For more information, refer to [Injection points dropdown](#injection-points). | +| **DLSS Use Optimal Settings** | Enables DLSS controlling screen percentage automatically. | + + +#### Injection points dropdown + +| **Option** | **Description** | +|-|-| +|**Before Post Process**|HDRP upscales when post-processing effects are at full resolution.| +|**After Depth Of Field**|HDRP upscales when depth of field is at low resolution, but post-processing effects are at full resolution.| +|**After Post Process**|HDRP upscales at the end of the pipeline, when post-processing effects are at low resolution.| + +## Water + +Controls for the Water System. + +| **Property** | **Description** | +|-|-| +| **Enable** | Enable the Water System.| +| **Simulation Resolution** | Set the resolution of the water simulation. Higher values use more system resources but provide higher visual quality. | +| **Script Interactions** | Enable to have HDRP calculate the height of the water simulation on the CPU. Also makes it possible for you to query height data for specific points on the water's surface. You can use this data for customizations like your own buoyancy implementation, for example. | diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Camera.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Camera.md index d77812f01b8..19e80b1881f 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Camera.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Camera.md @@ -47,18 +47,14 @@ The Camera Inspector includes the following groups of properties: | |**Barrel Clipping** | Use the slider to set the strength of the “cat eye” effect. You can see this effect on bokeh as a result of lens shadowing (distortion along the edges of the frame). This property affects the look of the [Depth of Field](Post-Processing-Depth-of-Field.md) bokeh. | | |**Anamorphism** | Use the slider to stretch the sensor to simulate an anamorphic look. Positive values distort the Camera vertically, negative values distort the Camera horizontally. This property affects the look of the [Depth of Field](Post-Processing-Depth-of-Field.md) bokeh and the [Bloom](Post-Processing-Bloom.md) effect if you enable its *Anamorphic* property. | + ## Rendering | **Property** ||**Description**| | --------- | - | :-------------------------------------------------------------------- | | **Allow Dynamic Resolution** || Enable the checkbox to make this Camera support dynamic resolution for buffers linked to it. | -| **Allow DLSS** || Enable this property to allow this Camera to use NVIDIA Deep Learning Super Sampling (DLSS). To use NVIDIA DLSS, enable the NVIDIA package (com.unity.modules.nvidia) in your Unity project and enable DLSS in your [HDRP Asset](HDRP-Asset.md). | -| |**Use Custom Quality** | Indicates whether this Camera overrides the DLSS quality mode specified in the [HDRP Asset](HDRP-Asset.md). When you enable this property, HDRP uses the **Mode** property. | -| |**Mode** | Specifies the performance quality mode override for performance quality mode for DLSS.The options are:
• **Balanced**: - Balances performance with quality.
• **MaxPerf**: Fast performance, lower quality.
• **MaxQuality**: High quality, lower performance.
• **UltraPerformance**: Fastest performance, lowest quality.
This property only appears if you enable **Use Custom Quality**. | -| |**Use Custom Attributes** | Enable this property to make this Camera override the DLSS attributes specified in the [HDRP Asset](HDRP-Asset.md). | -| |**Use Optimal Settings** | Enable this property to allow DLSS to automatically control the sharpness and screen percentage for this Camera. This property only appears if you enable **Use Custom Attributes**. | -| |**Sharpness** | The pixel sharpness that the DLSS upscaler uses for this Camera.
This property only appears if you enable **Use Custom Attributes**. | +| **Allow DLSS** || Enables NVIDIA Deep Learning Super Sampling (DLSS). This property has an effect only if you add DLSS to your [HDRP Asset](HDRP-Asset.md). For more information, refer to [DLSS settings](#dlss-settings). | | **Post Anti-aliasing** || This Camera can use [multisample anti-aliasing (MSAA)](Anti-Aliasing.md#MSAA), at the same time as post-process anti-aliasing. This is because MSAA is a hardware feature. To control post-process anti-aliasing, use the [Frame Settings](Frame-Settings.md).
• **No Anti-aliasing**: This Camera processes MSAA but doesn't process any post-process anti-aliasing.
• **Fast Approximate Anti-aliasing (FXAA)**: Smooths edges on a per-pixel level. This is the most efficient anti-aliasing technique in HDRP.
• **Temporal Anti-aliasing (TAA)**: Uses frames from a history buffer to smooth edges more effectively than fast approximate anti-aliasing.
• **Subpixel Morphological Anti-aliasing (SMAA)**: Finds patterns in borders of the image and blends the pixels on these borders according to the pattern. | || **SMAA Quality Preset** | Use the drop-down to select the quality of SMAA. The difference in resource intensity is small between **Low** and **High**.
• **Low**: The lowest SMAA quality. This is the least resource-intensive option.
• **Medium**: A good balance between SMAA quality and resource intensity.
• **High**: The highest SMAA quality. This is the most resource-intensive option. This property only appears when you select **Subpixel Morphological Anti-aliasing (SMAA)** from the **Anti-aliasing** drop-down. | | |**TAA Quality Preset** | The quality level of TAA. The default settings for higher presets aren't guaranteed to produce better results than lower presets. The result depends on the content in your scene. However, the high quality presets give you more options that you can use to adapt the anti-aliasing to your content. | @@ -74,6 +70,18 @@ The Camera Inspector includes the following groups of properties: | **Occlusion Culling** | |Enable the checkbox to make this Camera not render GameObjects that aren't currently visible. For more information, see the [Occlusion Culling documentation](). | | **Exposure Target** | |The GameObject to center the [Auto Exposure](Override-Exposure.md) procedural mask around. | + +### DLSS settings + +The following properties are available only if you enable **Allow DLSS**. + +| **Property** | **Description** | +|-|-| +| **Use DLSS Custom Quality** | Indicates whether this Camera overrides the DLSS quality mode specified in the [HDRP Asset](HDRP-Asset.md). | +| **DLSS Mode** | Sets whether DLSS prioritizes quality or performance. The options are:
  • **Maximum Quality**
  • **Balanced**
  • **Maximum Performance**
  • **Ultra Performance**
This property is available only if you enable **Use DLSS Custom Quality**. | +| **Use DLSS Custom Attributes** | Overrides the DLSS properties specified in the [HDRP Asset](HDRP-Asset.md), on this camera. | +| **DLSS Use Optimal Settings** | Enables DLSS controlling sharpness and screen percentage automatically. This property is available only if you enable **Use DLSS Custom Attributes**. | + ## Environment diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Ray-Tracing-Getting-Started.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Ray-Tracing-Getting-Started.md index a2f7a204286..e9d4cc10687 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Ray-Tracing-Getting-Started.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Ray-Tracing-Getting-Started.md @@ -271,7 +271,7 @@ There is no support for ray tracing on platforms other than DX12 for now. HDRP ray tracing in Unity has the following limitations: - Doesn't support vertex animation. -- Doesn't support decals. +- Doesn't support emissive [Decals](Decal.md). To disable emission, go to the Decal Material Inspector window and disable **Affect Emissive**. - Doesn't support Box-shaped spot lights. - Doesn't support the volumetric part of the [fog](Override-Fog.md). - Doesn't support tessellation. diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Ray-Tracing-Path-Tracing.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Ray-Tracing-Path-Tracing.md index f3eabc7c323..151ef4c95f8 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Ray-Tracing-Path-Tracing.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Ray-Tracing-Path-Tracing.md @@ -197,7 +197,8 @@ HDRP path tracing in Unity 2020.2 has the following limitations: - Tessellation. - Tube and Disc-shaped Area Lights. - Translucent Opaque Materials. - - Several of HDRP's Materials. This includes Eye, Hair, and Decal. + - Several of HDRP's Materials. This includes Eye and Hair. + - Emissive [Decals](Decal.md). To disable emission, go to the Decal Material Inspector window and disable **Affect Emissive**. - Per-pixel displacement (parallax occlusion mapping, height map, depth offset). - MSAA. - [Graphics.DrawMesh](https://docs.unity3d.com/ScriptReference/Graphics.DrawMesh.html) or [Graphics.RenderMesh](https://docs.unity3d.com/2022.1/Documentation/ScriptReference/Graphics.RenderMesh.html), because rasterization and ray tracing are different ways of generating an image. diff --git a/Packages/com.unity.render-pipelines.universal/Editor/Converter/PPv2/PPv2Converter.cs b/Packages/com.unity.render-pipelines.universal/Editor/Converter/PPv2/PPv2Converter.cs index 8820598395c..ba27eb5de86 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/Converter/PPv2/PPv2Converter.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/Converter/PPv2/PPv2Converter.cs @@ -52,7 +52,7 @@ public override void OnInitialize(InitializeConverterContext context, Action cal // Components First using var componentContext = Search.SearchService.CreateContext("asset", "urp=convert-ppv2component a=URPConverterIndex"); - using var componentItems = Search.SearchService.Request(componentContext); + using var componentItems = Search.SearchService.Request(componentContext, SearchFlags.Synchronous); { AddSearchItemsAsConverterAssetEntries(componentItems, context); } @@ -60,7 +60,7 @@ public override void OnInitialize(InitializeConverterContext context, Action cal // Then ScriptableObjects using var scriptableObjectContext = Search.SearchService.CreateContext("asset", "urp=convert-ppv2scriptableobject a=URPConverterIndex "); - using var scriptableObjectItems = Search.SearchService.Request(scriptableObjectContext); + using var scriptableObjectItems = Search.SearchService.Request(scriptableObjectContext, SearchFlags.Synchronous); { AddSearchItemsAsConverterAssetEntries(scriptableObjectItems, context); } diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGUI/BaseShaderGUI.cs b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGUI/BaseShaderGUI.cs index 5d75bcf04b8..57d54a62259 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGUI/BaseShaderGUI.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGUI/BaseShaderGUI.cs @@ -840,7 +840,8 @@ public static void SetMaterialKeywords(Material material, Action shadi if (material.HasProperty(Property.EmissionColor)) MaterialEditor.FixupEmissiveFlag(material); - bool shouldEmissionBeEnabled = (material.globalIlluminationFlags & MaterialGlobalIlluminationFlags.AnyEmissive) != 0; + bool shouldEmissionBeEnabled = + (material.globalIlluminationFlags & MaterialGlobalIlluminationFlags.EmissiveIsBlack) == 0; // Not sure what this is used for, I don't see this property declared by any Unity shader in our repo... // I'm guessing it is some kind of legacy material upgrade support thing? Or maybe just dead code now... diff --git a/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineMaterialUpgrader.cs b/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineMaterialUpgrader.cs index 287c1658e2e..15f93c2d219 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineMaterialUpgrader.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineMaterialUpgrader.cs @@ -598,7 +598,7 @@ internal static void UpdateMaterialKeywords(Material material) // or is enabled and may be modified at runtime. This state depends on the values of the current flag and emissive color. // The fixup routine makes sure that the material is in the correct state if/when changes are made to the mode or color. MaterialEditor.FixupEmissiveFlag(material); - bool shouldEmissionBeEnabled = (material.globalIlluminationFlags & MaterialGlobalIlluminationFlags.AnyEmissive) != 0; + bool shouldEmissionBeEnabled = (material.globalIlluminationFlags & MaterialGlobalIlluminationFlags.EmissiveIsBlack) == 0; CoreUtils.SetKeyword(material, "_EMISSION", shouldEmissionBeEnabled); UniversalRenderPipelineMaterialUpgrader.DisableKeywords(material); } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Passes/Render2DLightingPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Passes/Render2DLightingPass.cs index 6805f56456d..b805f123e3f 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Passes/Render2DLightingPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Passes/Render2DLightingPass.cs @@ -347,7 +347,7 @@ public override void Execute(ScriptableRenderContext context, ref RenderingData var isLitView = true; #if UNITY_EDITOR - if (renderingData.cameraData.isSceneViewCamera) + if (renderingData.cameraData.isSceneViewCamera && UnityEditor.SceneView.currentDrawingSceneView != null) isLitView = UnityEditor.SceneView.currentDrawingSceneView.sceneLighting; if (renderingData.cameraData.camera.cameraType == CameraType.Preview) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs index 9ddad06f7f5..a9ce944741f 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs @@ -62,6 +62,8 @@ public ShadowResolutionRequest(int _visibleLightIndex, int _perLightShadowSliceI internal RTHandle m_AdditionalLightsShadowmapHandle; private bool m_CreateEmptyShadowmap; + private bool m_EmptyShadowmapNeedsClear = false; + private RTHandle m_EmptyAdditionalLightShadowmapTexture; private const int k_EmptyShadowMapDimensions = 1; private const string k_AdditionalLightShadowMapTextureName = "_AdditionalLightsShadowmapTexture"; @@ -142,7 +144,8 @@ public AdditionalLightsShadowCasterPass(RenderPassEvent evt) m_ShadowResolutionRequests.Capacity = maxVisibleAdditionalLights; } - m_EmptyAdditionalLightShadowmapTexture = RTHandles.Alloc(Texture2D.blackTexture); + m_EmptyAdditionalLightShadowmapTexture = ShadowUtils.AllocShadowRT(1, 1, k_ShadowmapBufferBits, 1, 0, name: "_EmptyAdditionalLightShadowmapTexture"); + m_EmptyShadowmapNeedsClear = true; } /// @@ -151,6 +154,7 @@ public AdditionalLightsShadowCasterPass(RenderPassEvent evt) public void Dispose() { m_AdditionalLightsShadowmapHandle?.Release(); + m_EmptyAdditionalLightShadowmapTexture?.Release(); } private int GetPunctualLightShadowSlicesCount(in LightType lightType) @@ -850,6 +854,10 @@ bool SetupForEmptyRendering(ref RenderingData renderingData) m_CreateEmptyShadowmap = true; useNativeRenderPass = false; + // Required for scene view camera(URP renderer not initialized) + if(ShadowUtils.ShadowRTReAllocateIfNeeded(ref m_EmptyAdditionalLightShadowmapTexture, 1, 1, k_ShadowmapBufferBits, name: "_EmptyAdditionalLightShadowmapTexture")) + m_EmptyShadowmapNeedsClear = true; + // initialize _AdditionalShadowParams for (int i = 0; i < m_AdditionalLightIndexToShadowParams.Length; ++i) m_AdditionalLightIndexToShadowParams[i] = c_DefaultShadowParams; @@ -860,13 +868,18 @@ bool SetupForEmptyRendering(ref RenderingData renderingData) /// public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor) { - - if (m_CreateEmptyShadowmap) + if (m_CreateEmptyShadowmap && !m_EmptyShadowmapNeedsClear) { // Reset pass RTs to null ResetTarget(); return; } + if (m_CreateEmptyShadowmap) + { + ConfigureTarget(m_EmptyAdditionalLightShadowmapTexture); + m_EmptyShadowmapNeedsClear = false; + } + else ConfigureTarget(m_AdditionalLightsShadowmapHandle); ConfigureClear(ClearFlag.All, Color.black); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs index 2a3a5ff21ec..801b5e7740c 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs @@ -43,6 +43,7 @@ private static class MainLightShadowConstantBuffer Vector4[] m_CascadeSplitDistances; bool m_CreateEmptyShadowmap; + private bool m_EmptyShadowmapNeedsClear = false; int renderTargetWidth; int renderTargetHeight; @@ -76,7 +77,8 @@ public MainLightShadowCasterPass(RenderPassEvent evt) m_MainLightShadowmapID = Shader.PropertyToID(k_MainLightShadowMapTextureName); - m_EmptyMainLightShadowmapTexture = RTHandles.Alloc(Texture2D.blackTexture); + m_EmptyMainLightShadowmapTexture = ShadowUtils.AllocShadowRT(1, 1, k_ShadowmapBufferBits, 1, 0, name: "_EmptyLightShadowmapTexture"); + m_EmptyShadowmapNeedsClear = true; } /// @@ -163,7 +165,10 @@ bool SetupForEmptyRendering(ref RenderingData renderingData) m_CreateEmptyShadowmap = true; useNativeRenderPass = false; - ShadowUtils.ShadowRTReAllocateIfNeeded(ref m_EmptyMainLightShadowmapTexture, k_EmptyShadowMapDimensions, k_EmptyShadowMapDimensions, k_ShadowmapBufferBits, name: k_EmptyMainLightShadowMapTextureName); + + // Required for scene view camera(URP renderer not initialized) + if(ShadowUtils.ShadowRTReAllocateIfNeeded(ref m_EmptyMainLightShadowmapTexture, 1, 1, k_ShadowmapBufferBits, name: "_EmptyLightShadowmapTexture")) + m_EmptyShadowmapNeedsClear = true; return true; } @@ -171,14 +176,20 @@ bool SetupForEmptyRendering(ref RenderingData renderingData) /// public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor) { - - if (m_CreateEmptyShadowmap) + if (m_CreateEmptyShadowmap && !m_EmptyShadowmapNeedsClear) { // Reset pass RTs to null ResetTarget(); return; } + if (m_CreateEmptyShadowmap) + { + ConfigureTarget(m_EmptyMainLightShadowmapTexture); + m_EmptyShadowmapNeedsClear = false; + } + else ConfigureTarget(m_MainLightShadowmapTexture); + ConfigureClear(ClearFlag.All, Color.black); } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/ReflectionProbeManager.cs b/Packages/com.unity.render-pipelines.universal/Runtime/ReflectionProbeManager.cs index dd47c9987d9..265be0d1dde 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/ReflectionProbeManager.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/ReflectionProbeManager.cs @@ -325,6 +325,8 @@ public void Dispose() { m_AtlasTexture0.Release(); } + m_AtlasAllocator.Dispose(); + Object.DestroyImmediate(m_AtlasTexture0); Object.DestroyImmediate(m_AtlasTexture1); diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/LegacySurfaceVertex.hlsl b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/LegacySurfaceVertex.hlsl index c73be651426..a2abf182c35 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/LegacySurfaceVertex.hlsl +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/LegacySurfaceVertex.hlsl @@ -21,6 +21,7 @@ struct v2f_surf { //#endif UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO + V2F_SHADOW_CASTER_NOPOS }; #endif // UNITY_LEGACY_SURFACE_VERTEX diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/AutoLightShim.hlsl b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/AutoLightShim.hlsl new file mode 100644 index 00000000000..deb0952dadc --- /dev/null +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/AutoLightShim.hlsl @@ -0,0 +1,302 @@ +#pragma once + +// This file acts as the bridge to avoid including AutoLight.cginc which contains uses of macros incompatible with SRP + +// Use the include guard to force AutoLight.cginc to not get included +#define AUTOLIGHT_INCLUDED + +// ---------------- +// Shadow helpers +// ---------------- + +// If none of the keywords are defined, assume directional? +#if !defined(POINT) && !defined(SPOT) && !defined(DIRECTIONAL) && !defined(POINT_COOKIE) && !defined(DIRECTIONAL_COOKIE) + #define DIRECTIONAL 1 +#endif + +// ---- Screen space direction light shadows helpers (any version) +#if defined (SHADOWS_SCREEN) + + #if defined(UNITY_NO_SCREENSPACE_SHADOWS) + UNITY_DECLARE_SHADOWMAP(_ShadowMapTexture); + #define TRANSFER_SHADOW(a) a._ShadowCoord = mul( unity_WorldToShadow[0], mul( unity_ObjectToWorld, v.vertex ) ); + #define TRANSFER_SHADOW_WPOS(a, wpos) a._ShadowCoord = mul( unity_WorldToShadow[0], float4(wpos.xyz, 1.0f) ); + inline fixed unitySampleShadow (unityShadowCoord4 shadowCoord) + { + #if defined(SHADOWS_NATIVE) + fixed shadow = UNITY_SAMPLE_SHADOW(_ShadowMapTexture, shadowCoord.xyz); + shadow = _LightShadowData.r + shadow * (1-_LightShadowData.r); + return shadow; + #else + // This macro call is one difference from AutoLight.cginc + unityShadowCoord dist = UNITY_SAMPLE_DEPTH_TEXTURE(_ShadowMapTexture, shadowCoord.xy); + // tegra is confused if we use _LightShadowData.x directly + // with "ambiguous overloaded function reference max(mediump float, float)" + unityShadowCoord lightShadowDataX = _LightShadowData.x; + unityShadowCoord threshold = shadowCoord.z; + return max(dist > threshold, lightShadowDataX); + #endif + } + + #else // UNITY_NO_SCREENSPACE_SHADOWS + UNITY_DECLARE_SCREENSPACE_SHADOWMAP(_ShadowMapTexture); + #define TRANSFER_SHADOW(a) a._ShadowCoord = ComputeScreenPos(a.pos); + #define TRANSFER_SHADOW_WPOS(a, wpos) a._ShadowCoord = ComputeScreenPos(a.pos); + inline fixed unitySampleShadow (unityShadowCoord4 shadowCoord) + { + fixed shadow = UNITY_SAMPLE_SCREEN_SHADOW(_ShadowMapTexture, shadowCoord); + return shadow; + } + + #endif + + #define SHADOW_COORDS(idx1) unityShadowCoord4 _ShadowCoord : TEXCOORD##idx1; + #define SHADOW_ATTENUATION(a) unitySampleShadow(a._ShadowCoord) +#endif + +// ----------------------------- +// Shadow helpers (5.6+ version) +// ----------------------------- +// This version depends on having worldPos available in the fragment shader and using that to compute light coordinates. +// if also supports ShadowMask (separately baked shadows for lightmapped objects) + +half UnityComputeForwardShadows(float2 lightmapUV, float3 worldPos, float4 screenPos) +{ + //fade value + float zDist = dot(_WorldSpaceCameraPos - worldPos, UNITY_MATRIX_V[2].xyz); + float fadeDist = UnityComputeShadowFadeDistance(worldPos, zDist); + half realtimeToBakedShadowFade = UnityComputeShadowFade(fadeDist); + + //baked occlusion if any + half shadowMaskAttenuation = UnitySampleBakedOcclusion(lightmapUV, worldPos); + + half realtimeShadowAttenuation = 1.0f; + //directional realtime shadow + #if defined (SHADOWS_SCREEN) + #if defined(UNITY_NO_SCREENSPACE_SHADOWS) && !defined(UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS) + realtimeShadowAttenuation = unitySampleShadow(mul(unity_WorldToShadow[0], unityShadowCoord4(worldPos, 1))); + #else + //Only reached when LIGHTMAP_ON is NOT defined (and thus we use interpolator for screenPos rather than lightmap UVs). See HANDLE_SHADOWS_BLENDING_IN_GI below. + realtimeShadowAttenuation = unitySampleShadow(screenPos); + #endif + #endif + + #if defined(UNITY_FAST_COHERENT_DYNAMIC_BRANCHING) && defined(SHADOWS_SOFT) && !defined(LIGHTMAP_SHADOW_MIXING) + //avoid expensive shadows fetches in the distance where coherency will be good + UNITY_BRANCH + if (realtimeToBakedShadowFade < (1.0f - 1e-2f)) + { + #endif + + //spot realtime shadow + #if (defined (SHADOWS_DEPTH) && defined (SPOT)) + #if !defined(UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS) + unityShadowCoord4 spotShadowCoord = mul(unity_WorldToShadow[0], unityShadowCoord4(worldPos, 1)); + #else + unityShadowCoord4 spotShadowCoord = screenPos; + #endif + realtimeShadowAttenuation = UnitySampleShadowmap(spotShadowCoord); + #endif + + //point realtime shadow + #if defined (SHADOWS_CUBE) + realtimeShadowAttenuation = UnitySampleShadowmap(worldPos - _LightPositionRange.xyz); + #endif + + #if defined(UNITY_FAST_COHERENT_DYNAMIC_BRANCHING) && defined(SHADOWS_SOFT) && !defined(LIGHTMAP_SHADOW_MIXING) + } + #endif + + return UnityMixRealtimeAndBakedShadows(realtimeShadowAttenuation, shadowMaskAttenuation, realtimeToBakedShadowFade); +} + +#if defined(SHADER_API_D3D11) || defined(SHADER_API_D3D12) || defined(SHADER_API_PSSL) || defined(UNITY_COMPILER_HLSLCC) +# define UNITY_SHADOW_W(_w) _w +#else +# define UNITY_SHADOW_W(_w) (1.0/_w) +#endif + +#if !defined(UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS) +# define UNITY_READ_SHADOW_COORDS(input) 0 +#else +# define UNITY_READ_SHADOW_COORDS(input) READ_SHADOW_COORDS(input) +#endif + +#if defined(HANDLE_SHADOWS_BLENDING_IN_GI) // handles shadows in the depths of the GI function for performance reasons +# define UNITY_SHADOW_COORDS(idx1) SHADOW_COORDS(idx1) +# define UNITY_TRANSFER_SHADOW(a, coord) TRANSFER_SHADOW(a) +# define UNITY_SHADOW_ATTENUATION(a, worldPos) SHADOW_ATTENUATION(a) +#elif defined(SHADOWS_SCREEN) && !defined(LIGHTMAP_ON) && !defined(UNITY_NO_SCREENSPACE_SHADOWS) // no lightmap uv thus store screenPos instead + // can happen if we have two directional lights. main light gets handled in GI code, but 2nd dir light can have shadow screen and mask. + // - Disabled on ES2 because WebGL 1.0 seems to have junk in .w (even though it shouldn't) +# if defined(SHADOWS_SHADOWMASK) && !defined(SHADER_API_GLES) +# define UNITY_SHADOW_COORDS(idx1) unityShadowCoord4 _ShadowCoord : TEXCOORD##idx1; +# define UNITY_TRANSFER_SHADOW(a, coord) {a._ShadowCoord.xy = coord * unity_LightmapST.xy + unity_LightmapST.zw; a._ShadowCoord.zw = ComputeScreenPos(a.pos).xy;} +# define UNITY_SHADOW_ATTENUATION(a, worldPos) UnityComputeForwardShadows(a._ShadowCoord.xy, worldPos, float4(a._ShadowCoord.zw, 0.0, UNITY_SHADOW_W(a.pos.w))); +# else +# define UNITY_SHADOW_COORDS(idx1) SHADOW_COORDS(idx1) +# define UNITY_TRANSFER_SHADOW(a, coord) TRANSFER_SHADOW(a) +# define UNITY_SHADOW_ATTENUATION(a, worldPos) UnityComputeForwardShadows(0, worldPos, a._ShadowCoord) +# endif +#else +# define UNITY_SHADOW_COORDS(idx1) unityShadowCoord4 _ShadowCoord : TEXCOORD##idx1; +# if defined(SHADOWS_SHADOWMASK) +# define UNITY_TRANSFER_SHADOW(a, coord) a._ShadowCoord.xy = coord.xy * unity_LightmapST.xy + unity_LightmapST.zw; +# if (defined(SHADOWS_DEPTH) || defined(SHADOWS_SCREEN) || defined(SHADOWS_CUBE) || UNITY_LIGHT_PROBE_PROXY_VOLUME) +# define UNITY_SHADOW_ATTENUATION(a, worldPos) UnityComputeForwardShadows(a._ShadowCoord.xy, worldPos, UNITY_READ_SHADOW_COORDS(a)) +# else +# define UNITY_SHADOW_ATTENUATION(a, worldPos) UnityComputeForwardShadows(a._ShadowCoord.xy, 0, 0) +# endif +# else +# if !defined(UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS) +# define UNITY_TRANSFER_SHADOW(a, coord) +# else +# define UNITY_TRANSFER_SHADOW(a, coord) TRANSFER_SHADOW(a) +# endif +# if (defined(SHADOWS_DEPTH) || defined(SHADOWS_SCREEN) || defined(SHADOWS_CUBE)) +# define UNITY_SHADOW_ATTENUATION(a, worldPos) UnityComputeForwardShadows(0, worldPos, UNITY_READ_SHADOW_COORDS(a)) +# else +# if UNITY_LIGHT_PROBE_PROXY_VOLUME +# define UNITY_SHADOW_ATTENUATION(a, worldPos) UnityComputeForwardShadows(0, worldPos, UNITY_READ_SHADOW_COORDS(a)) +# else +# define UNITY_SHADOW_ATTENUATION(a, worldPos) UnityComputeForwardShadows(0, 0, 0) +# endif +# endif +# endif +#endif + +#ifdef POINT +sampler2D_float _LightTexture0; +unityShadowCoord4x4 unity_WorldToLight; +# define UNITY_LIGHT_ATTENUATION(destName, input, worldPos) \ + unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(worldPos, 1)).xyz; \ + fixed shadow = UNITY_SHADOW_ATTENUATION(input, worldPos); \ + fixed destName = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r * shadow; +#endif + +#ifdef SPOT +sampler2D_float _LightTexture0; +unityShadowCoord4x4 unity_WorldToLight; +sampler2D_float _LightTextureB0; +inline fixed UnitySpotCookie(unityShadowCoord4 LightCoord) +{ + return tex2D(_LightTexture0, LightCoord.xy / LightCoord.w + 0.5).w; +} +inline fixed UnitySpotAttenuate(unityShadowCoord3 LightCoord) +{ + return tex2D(_LightTextureB0, dot(LightCoord, LightCoord).xx).r; +} +#if !defined(UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS) +#define DECLARE_LIGHT_COORD(input, worldPos) unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(worldPos, 1)) +#else +#define DECLARE_LIGHT_COORD(input, worldPos) unityShadowCoord4 lightCoord = input._LightCoord +#endif +# define UNITY_LIGHT_ATTENUATION(destName, input, worldPos) \ + DECLARE_LIGHT_COORD(input, worldPos); \ + fixed shadow = UNITY_SHADOW_ATTENUATION(input, worldPos); \ + fixed destName = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz) * shadow; +#endif + +#ifdef DIRECTIONAL +# define UNITY_LIGHT_ATTENUATION(destName, input, worldPos) fixed destName = UNITY_SHADOW_ATTENUATION(input, worldPos); +#endif + +#ifdef POINT_COOKIE +samplerCUBE_float _LightTexture0; +unityShadowCoord4x4 unity_WorldToLight; +sampler2D_float _LightTextureB0; +# if !defined(UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS) +# define DECLARE_LIGHT_COORD(input, worldPos) unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(worldPos, 1)).xyz +# else +# define DECLARE_LIGHT_COORD(input, worldPos) unityShadowCoord3 lightCoord = input._LightCoord +# endif +# define UNITY_LIGHT_ATTENUATION(destName, input, worldPos) \ + DECLARE_LIGHT_COORD(input, worldPos); \ + fixed shadow = UNITY_SHADOW_ATTENUATION(input, worldPos); \ + fixed destName = tex2D(_LightTextureB0, dot(lightCoord, lightCoord).rr).r * texCUBE(_LightTexture0, lightCoord).w * shadow; +#endif + +#ifdef DIRECTIONAL_COOKIE +sampler2D_float _LightTexture0; +unityShadowCoord4x4 unity_WorldToLight; +# if !defined(UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS) +# define DECLARE_LIGHT_COORD(input, worldPos) unityShadowCoord2 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(worldPos, 1)).xy +# else +# define DECLARE_LIGHT_COORD(input, worldPos) unityShadowCoord2 lightCoord = input._LightCoord +# endif +# define UNITY_LIGHT_ATTENUATION(destName, input, worldPos) \ + DECLARE_LIGHT_COORD(input, worldPos); \ + fixed shadow = UNITY_SHADOW_ATTENUATION(input, worldPos); \ + fixed destName = tex2D(_LightTexture0, lightCoord).w * shadow; +#endif + + +// ----------------------------- +// Light/Shadow helpers (4.x version) +// ----------------------------- +// This version computes light coordinates in the vertex shader and passes them to the fragment shader. + +// ---- Spot light shadows +#if defined (SHADOWS_DEPTH) && defined (SPOT) +#define SHADOW_COORDS(idx1) unityShadowCoord4 _ShadowCoord : TEXCOORD##idx1; +#define TRANSFER_SHADOW(a) a._ShadowCoord = mul (unity_WorldToShadow[0], mul(unity_ObjectToWorld,v.vertex)); +#define TRANSFER_SHADOW_WPOS(a, wpos) a._ShadowCoord = mul (unity_WorldToShadow[0], float4(wpos.xyz, 1.0f)); +#define SHADOW_ATTENUATION(a) UnitySampleShadowmap(a._ShadowCoord) +#endif + +// ---- Point light shadows +#if defined (SHADOWS_CUBE) +#define SHADOW_COORDS(idx1) unityShadowCoord3 _ShadowCoord : TEXCOORD##idx1; +#define TRANSFER_SHADOW(a) a._ShadowCoord.xyz = mul(unity_ObjectToWorld, v.vertex).xyz - _LightPositionRange.xyz; +#define TRANSFER_SHADOW_WPOS(a, wpos) a._ShadowCoord.xyz = wpos.xyz - _LightPositionRange.xyz; +#define SHADOW_ATTENUATION(a) UnitySampleShadowmap(a._ShadowCoord) +#define READ_SHADOW_COORDS(a) unityShadowCoord4(a._ShadowCoord.xyz, 1.0) +#endif + +// ---- Shadows off +#if !defined (SHADOWS_SCREEN) && !defined (SHADOWS_DEPTH) && !defined (SHADOWS_CUBE) +#define SHADOW_COORDS(idx1) +#define TRANSFER_SHADOW(a) +#define TRANSFER_SHADOW_WPOS(a, wpos) +#define SHADOW_ATTENUATION(a) 1.0 +#define READ_SHADOW_COORDS(a) 0 +#else +#ifndef READ_SHADOW_COORDS +#define READ_SHADOW_COORDS(a) a._ShadowCoord +#endif +#endif + +#ifdef POINT +# define DECLARE_LIGHT_COORDS(idx) unityShadowCoord3 _LightCoord : TEXCOORD##idx; +# define COMPUTE_LIGHT_COORDS(a) a._LightCoord = mul(unity_WorldToLight, mul(unity_ObjectToWorld, v.vertex)).xyz; +# define LIGHT_ATTENUATION(a) (tex2D(_LightTexture0, dot(a._LightCoord,a._LightCoord).rr).r * SHADOW_ATTENUATION(a)) +#endif + +#ifdef SPOT +# define DECLARE_LIGHT_COORDS(idx) unityShadowCoord4 _LightCoord : TEXCOORD##idx; +# define COMPUTE_LIGHT_COORDS(a) a._LightCoord = mul(unity_WorldToLight, mul(unity_ObjectToWorld, v.vertex)); +# define LIGHT_ATTENUATION(a) ( (a._LightCoord.z > 0) * UnitySpotCookie(a._LightCoord) * UnitySpotAttenuate(a._LightCoord.xyz) * SHADOW_ATTENUATION(a) ) +#endif + +#ifdef DIRECTIONAL +# define DECLARE_LIGHT_COORDS(idx) +# define COMPUTE_LIGHT_COORDS(a) +# define LIGHT_ATTENUATION(a) SHADOW_ATTENUATION(a) +#endif + +#ifdef POINT_COOKIE +# define DECLARE_LIGHT_COORDS(idx) unityShadowCoord3 _LightCoord : TEXCOORD##idx; +# define COMPUTE_LIGHT_COORDS(a) a._LightCoord = mul(unity_WorldToLight, mul(unity_ObjectToWorld, v.vertex)).xyz; +# define LIGHT_ATTENUATION(a) (tex2D(_LightTextureB0, dot(a._LightCoord,a._LightCoord).rr).r * texCUBE(_LightTexture0, a._LightCoord).w * SHADOW_ATTENUATION(a)) +#endif + +#ifdef DIRECTIONAL_COOKIE +# define DECLARE_LIGHT_COORDS(idx) unityShadowCoord2 _LightCoord : TEXCOORD##idx; +# define COMPUTE_LIGHT_COORDS(a) a._LightCoord = mul(unity_WorldToLight, mul(unity_ObjectToWorld, v.vertex)).xy; +# define LIGHT_ATTENUATION(a) (tex2D(_LightTexture0, a._LightCoord).w * SHADOW_ATTENUATION(a)) +#endif + +#define UNITY_LIGHTING_COORDS(idx1, idx2) DECLARE_LIGHT_COORDS(idx1) UNITY_SHADOW_COORDS(idx2) +#define LIGHTING_COORDS(idx1, idx2) DECLARE_LIGHT_COORDS(idx1) SHADOW_COORDS(idx2) +#define UNITY_TRANSFER_LIGHTING(a, coord) COMPUTE_LIGHT_COORDS(a) UNITY_TRANSFER_SHADOW(a, coord) +#define TRANSFER_VERTEX_TO_FRAGMENT(a) COMPUTE_LIGHT_COORDS(a) TRANSFER_SHADOW(a) diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/AutoLightShim.hlsl.meta b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/AutoLightShim.hlsl.meta new file mode 100644 index 00000000000..945d467f2f4 --- /dev/null +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/AutoLightShim.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 722625f51da829945b59cd41d374a3a5 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/HLSLSupportShim.hlsl b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/HLSLSupportShim.hlsl index 0e14f06a527..5cd95a5770f 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/HLSLSupportShim.hlsl +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/HLSLSupportShim.hlsl @@ -35,6 +35,7 @@ #define UNITY_PROJ_COORD(a) a #define UNITY_SAMPLE_DEPTH_TEXTURE(tex, coord) SAMPLE_DEPTH_TEXTURE(tex, sampler##tex, coord) +#define SAMPLE_DEPTH_TEXTURE_PROJ(sampler, uv) (tex2Dproj(sampler, uv).r) // 2D textures #define UNITY_DECLARE_TEX2D(tex) TEXTURE2D(tex); SAMPLER(sampler##tex) diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/Shims.hlsl b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/Shims.hlsl index 477ba4fab8c..f5a6348ca40 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/Shims.hlsl +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/Shims.hlsl @@ -18,12 +18,13 @@ #include "SurfaceShaderProxy.hlsl" #include "UnityShaderVariables.cginc" -#include "UnityShaderUtilities.cginc" #include "UnityCG.cginc" +#include "UnityShadowLibraryShim.hlsl" +#include "UnityShaderUtilities.cginc" #include "Lighting.cginc" #include "UnityPBSLighting.cginc" -#include "AutoLight.cginc" +#include "AutoLightShim.hlsl" #ifdef POINT # define COPY_FROM_LIGHT_COORDS(dest, src) dest = src._LightCoord diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/UnityShadowLibraryShim.hlsl b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/UnityShadowLibraryShim.hlsl new file mode 100644 index 00000000000..bacaf46e337 --- /dev/null +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/UnityShadowLibraryShim.hlsl @@ -0,0 +1,791 @@ +#pragma once + +// This file acts as the bridge to avoid including UnityShadowLibrary.cginc which contains uses of macros incompatible with SRP + +// Use the include guard to force UnityShadowLibrary.cginc to not get included +#define UNITY_BUILTIN_SHADOW_LIBRARY_INCLUDED + +// Shadowmap helpers. +#if defined( SHADOWS_SCREEN ) && defined( LIGHTMAP_ON ) + #define HANDLE_SHADOWS_BLENDING_IN_GI 1 +#endif + +#define unityShadowCoord float +#define unityShadowCoord2 float2 +#define unityShadowCoord3 float3 +#define unityShadowCoord4 float4 +#define unityShadowCoord4x4 float4x4 + +half UnitySampleShadowmap_PCF7x7(float4 coord, float3 receiverPlaneDepthBias); // Samples the shadowmap based on PCF filtering (7x7 kernel) +half UnitySampleShadowmap_PCF5x5(float4 coord, float3 receiverPlaneDepthBias); // Samples the shadowmap based on PCF filtering (5x5 kernel) +half UnitySampleShadowmap_PCF3x3(float4 coord, float3 receiverPlaneDepthBias); // Samples the shadowmap based on PCF filtering (3x3 kernel) +float3 UnityGetReceiverPlaneDepthBias(float3 shadowCoord, float biasbiasMultiply); // Receiver plane depth bias + +// ------------------------------------------------------------------ +// Spot light shadows +// ------------------------------------------------------------------ + +#if defined (SHADOWS_DEPTH) && defined (SPOT) + + // declare shadowmap + #if !defined(SHADOWMAPSAMPLER_DEFINED) + UNITY_DECLARE_SHADOWMAP(_ShadowMapTexture); + #define SHADOWMAPSAMPLER_DEFINED + #endif + + // shadow sampling offsets and texel size + #if defined (SHADOWS_SOFT) + float4 _ShadowOffsets[4]; + float4 _ShadowMapTexture_TexelSize; + #define SHADOWMAPSAMPLER_AND_TEXELSIZE_DEFINED + #endif + +inline fixed UnitySampleShadowmap (float4 shadowCoord) +{ + #if defined (SHADOWS_SOFT) + + half shadow = 1; + + // No hardware comparison sampler (ie some mobile + xbox360) : simple 4 tap PCF + #if !defined (SHADOWS_NATIVE) + float3 coord = shadowCoord.xyz / shadowCoord.w; + float4 shadowVals; + // This is one difference from UnityShadowLibrary.cginc + shadowVals.x = UNITY_SAMPLE_DEPTH_TEXTURE(_ShadowMapTexture, coord + _ShadowOffsets[0].xy); + shadowVals.y = UNITY_SAMPLE_DEPTH_TEXTURE(_ShadowMapTexture, coord + _ShadowOffsets[1].xy); + shadowVals.z = UNITY_SAMPLE_DEPTH_TEXTURE(_ShadowMapTexture, coord + _ShadowOffsets[2].xy); + shadowVals.w = UNITY_SAMPLE_DEPTH_TEXTURE(_ShadowMapTexture, coord + _ShadowOffsets[3].xy); + half4 shadows = (shadowVals < coord.zzzz) ? _LightShadowData.rrrr : 1.0f; + shadow = dot(shadows, 0.25f); + #else + // Mobile with comparison sampler : 4-tap linear comparison filter + #if defined(SHADER_API_MOBILE) + float3 coord = shadowCoord.xyz / shadowCoord.w; + half4 shadows; + shadows.x = UNITY_SAMPLE_SHADOW(_ShadowMapTexture, coord + _ShadowOffsets[0]); + shadows.y = UNITY_SAMPLE_SHADOW(_ShadowMapTexture, coord + _ShadowOffsets[1]); + shadows.z = UNITY_SAMPLE_SHADOW(_ShadowMapTexture, coord + _ShadowOffsets[2]); + shadows.w = UNITY_SAMPLE_SHADOW(_ShadowMapTexture, coord + _ShadowOffsets[3]); + shadow = dot(shadows, 0.25f); + // Everything else + #else + float3 coord = shadowCoord.xyz / shadowCoord.w; + float3 receiverPlaneDepthBias = UnityGetReceiverPlaneDepthBias(coord, 1.0f); + shadow = UnitySampleShadowmap_PCF3x3(float4(coord, 1), receiverPlaneDepthBias); + #endif + shadow = lerp(_LightShadowData.r, 1.0f, shadow); + #endif + #else + // 1-tap shadows + #if defined (SHADOWS_NATIVE) + half shadow = UNITY_SAMPLE_SHADOW_PROJ(_ShadowMapTexture, shadowCoord); + shadow = lerp(_LightShadowData.r, 1.0f, shadow); + #else + half shadow = SAMPLE_DEPTH_TEXTURE_PROJ(_ShadowMapTexture, UNITY_PROJ_COORD(shadowCoord)) < (shadowCoord.z / shadowCoord.w) ? _LightShadowData.r : 1.0; + #endif + + #endif + + return shadow; +} + +#endif // #if defined (SHADOWS_DEPTH) && defined (SPOT) + +// ------------------------------------------------------------------ +// Point light shadows +// ------------------------------------------------------------------ + +#if defined (SHADOWS_CUBE) + +#if defined(SHADOWS_CUBE_IN_DEPTH_TEX) + UNITY_DECLARE_TEXCUBE_SHADOWMAP(_ShadowMapTexture); +#else + UNITY_DECLARE_TEXCUBE(_ShadowMapTexture); + inline float SampleCubeDistance (float3 vec) + { + return UnityDecodeCubeShadowDepth(UNITY_SAMPLE_TEXCUBE_LOD(_ShadowMapTexture, vec, 0)); + } + +#endif + +inline half UnitySampleShadowmap (float3 vec) +{ + #if defined(SHADOWS_CUBE_IN_DEPTH_TEX) + float3 absVec = abs(vec); + float dominantAxis = max(max(absVec.x, absVec.y), absVec.z); // TODO use max3() instead + dominantAxis = max(0.00001, dominantAxis - _LightProjectionParams.z); // shadow bias from point light is apllied here. + dominantAxis *= _LightProjectionParams.w; // bias + float mydist = -_LightProjectionParams.x + _LightProjectionParams.y/dominantAxis; // project to shadow map clip space [0; 1] + + #if defined(UNITY_REVERSED_Z) + mydist = 1.0 - mydist; // depth buffers are reversed! Additionally we can move this to CPP code! + #endif + #else + float mydist = length(vec) * _LightPositionRange.w; + mydist *= _LightProjectionParams.w; // bias + #endif + + #if defined (SHADOWS_SOFT) + float z = 1.0/128.0; + float4 shadowVals; + // No hardware comparison sampler (ie some mobile + xbox360) : simple 4 tap PCF + #if defined (SHADOWS_CUBE_IN_DEPTH_TEX) + shadowVals.x = UNITY_SAMPLE_TEXCUBE_SHADOW(_ShadowMapTexture, float4(vec+float3( z, z, z), mydist)); + shadowVals.y = UNITY_SAMPLE_TEXCUBE_SHADOW(_ShadowMapTexture, float4(vec+float3(-z,-z, z), mydist)); + shadowVals.z = UNITY_SAMPLE_TEXCUBE_SHADOW(_ShadowMapTexture, float4(vec+float3(-z, z,-z), mydist)); + shadowVals.w = UNITY_SAMPLE_TEXCUBE_SHADOW(_ShadowMapTexture, float4(vec+float3( z,-z,-z), mydist)); + half shadow = dot(shadowVals, 0.25); + return lerp(_LightShadowData.r, 1.0, shadow); + #else + shadowVals.x = SampleCubeDistance (vec+float3( z, z, z)); + shadowVals.y = SampleCubeDistance (vec+float3(-z,-z, z)); + shadowVals.z = SampleCubeDistance (vec+float3(-z, z,-z)); + shadowVals.w = SampleCubeDistance (vec+float3( z,-z,-z)); + half4 shadows = (shadowVals < mydist.xxxx) ? _LightShadowData.rrrr : 1.0f; + return dot(shadows, 0.25); + #endif + #else + #if defined (SHADOWS_CUBE_IN_DEPTH_TEX) + half shadow = UNITY_SAMPLE_TEXCUBE_SHADOW(_ShadowMapTexture, float4(vec, mydist)); + return lerp(_LightShadowData.r, 1.0, shadow); + #else + half shadowVal = UnityDecodeCubeShadowDepth(UNITY_SAMPLE_TEXCUBE(_ShadowMapTexture, vec)); + half shadow = shadowVal < mydist ? _LightShadowData.r : 1.0; + return shadow; + #endif + #endif + +} +#endif // #if defined (SHADOWS_CUBE) + + +// ------------------------------------------------------------------ +// Baked shadows +// ------------------------------------------------------------------ + +#if UNITY_LIGHT_PROBE_PROXY_VOLUME + +half4 LPPV_SampleProbeOcclusion(float3 worldPos) +{ + const float transformToLocal = unity_ProbeVolumeParams.y; + const float texelSizeX = unity_ProbeVolumeParams.z; + + //The SH coefficients textures and probe occlusion are packed into 1 atlas. + //------------------------- + //| ShR | ShG | ShB | Occ | + //------------------------- + + float3 position = (transformToLocal == 1.0f) ? mul(unity_ProbeVolumeWorldToObject, float4(worldPos, 1.0)).xyz : worldPos; + + //Get a tex coord between 0 and 1 + float3 texCoord = (position - unity_ProbeVolumeMin.xyz) * unity_ProbeVolumeSizeInv.xyz; + + // Sample fourth texture in the atlas + // We need to compute proper U coordinate to sample. + // Clamp the coordinate otherwize we'll have leaking between ShB coefficients and Probe Occlusion(Occ) info + texCoord.x = max(texCoord.x * 0.25f + 0.75f, 0.75f + 0.5f * texelSizeX); + + return UNITY_SAMPLE_TEX3D_SAMPLER(unity_ProbeVolumeSH, unity_ProbeVolumeSH, texCoord); +} + +#endif //#if UNITY_LIGHT_PROBE_PROXY_VOLUME + +// ------------------------------------------------------------------ +// Used by the forward rendering path +fixed UnitySampleBakedOcclusion (float2 lightmapUV, float3 worldPos) +{ + #if defined (SHADOWS_SHADOWMASK) + #if defined(LIGHTMAP_ON) + fixed4 rawOcclusionMask = UNITY_SAMPLE_TEX2D(unity_ShadowMask, lightmapUV.xy); + #else + fixed4 rawOcclusionMask = fixed4(1.0, 1.0, 1.0, 1.0); + #if UNITY_LIGHT_PROBE_PROXY_VOLUME + if (unity_ProbeVolumeParams.x == 1.0) + rawOcclusionMask = LPPV_SampleProbeOcclusion(worldPos); + else + rawOcclusionMask = UNITY_SAMPLE_TEX2D(unity_ShadowMask, lightmapUV.xy); + #else + rawOcclusionMask = UNITY_SAMPLE_TEX2D(unity_ShadowMask, lightmapUV.xy); + #endif + #endif + return saturate(dot(rawOcclusionMask, unity_OcclusionMaskSelector)); + + #else + + //In forward dynamic objects can only get baked occlusion from LPPV, light probe occlusion is done on the CPU by attenuating the light color. + fixed atten = 1.0f; + #if defined(UNITY_INSTANCING_ENABLED) && defined(UNITY_USE_SHCOEFFS_ARRAYS) + // ...unless we are doing instancing, and the attenuation is packed into SHC array's .w component. + atten = unity_SHC.w; + #endif + + #if UNITY_LIGHT_PROBE_PROXY_VOLUME && !defined(LIGHTMAP_ON) && !UNITY_STANDARD_SIMPLE + fixed4 rawOcclusionMask = atten.xxxx; + if (unity_ProbeVolumeParams.x == 1.0) + rawOcclusionMask = LPPV_SampleProbeOcclusion(worldPos); + return saturate(dot(rawOcclusionMask, unity_OcclusionMaskSelector)); + #endif + + return atten; + #endif +} + +// ------------------------------------------------------------------ +// Used by the deferred rendering path (in the gbuffer pass) +fixed4 UnityGetRawBakedOcclusions(float2 lightmapUV, float3 worldPos) +{ + #if defined (SHADOWS_SHADOWMASK) + #if defined(LIGHTMAP_ON) + return UNITY_SAMPLE_TEX2D(unity_ShadowMask, lightmapUV.xy); + #else + half4 probeOcclusion = unity_ProbesOcclusion; + + #if UNITY_LIGHT_PROBE_PROXY_VOLUME + if (unity_ProbeVolumeParams.x == 1.0) + probeOcclusion = LPPV_SampleProbeOcclusion(worldPos); + #endif + + return probeOcclusion; + #endif + #else + return fixed4(1.0, 1.0, 1.0, 1.0); + #endif +} + +// ------------------------------------------------------------------ +// Used by both the forward and the deferred rendering path +half UnityMixRealtimeAndBakedShadows(half realtimeShadowAttenuation, half bakedShadowAttenuation, half fade) +{ + // -- Static objects -- + // FWD BASE PASS + // ShadowMask mode = LIGHTMAP_ON + SHADOWS_SHADOWMASK + LIGHTMAP_SHADOW_MIXING + // Distance shadowmask mode = LIGHTMAP_ON + SHADOWS_SHADOWMASK + // Subtractive mode = LIGHTMAP_ON + LIGHTMAP_SHADOW_MIXING + // Pure realtime direct lit = LIGHTMAP_ON + + // FWD ADD PASS + // ShadowMask mode = SHADOWS_SHADOWMASK + LIGHTMAP_SHADOW_MIXING + // Distance shadowmask mode = SHADOWS_SHADOWMASK + // Pure realtime direct lit = LIGHTMAP_ON + + // DEFERRED LIGHTING PASS + // ShadowMask mode = LIGHTMAP_ON + SHADOWS_SHADOWMASK + LIGHTMAP_SHADOW_MIXING + // Distance shadowmask mode = LIGHTMAP_ON + SHADOWS_SHADOWMASK + // Pure realtime direct lit = LIGHTMAP_ON + + // -- Dynamic objects -- + // FWD BASE PASS + FWD ADD ASS + // ShadowMask mode = LIGHTMAP_SHADOW_MIXING + // Distance shadowmask mode = N/A + // Subtractive mode = LIGHTMAP_SHADOW_MIXING (only matter for LPPV. Light probes occlusion being done on CPU) + // Pure realtime direct lit = N/A + + // DEFERRED LIGHTING PASS + // ShadowMask mode = SHADOWS_SHADOWMASK + LIGHTMAP_SHADOW_MIXING + // Distance shadowmask mode = SHADOWS_SHADOWMASK + // Pure realtime direct lit = N/A + + #if !defined(SHADOWS_DEPTH) && !defined(SHADOWS_SCREEN) && !defined(SHADOWS_CUBE) + #if defined(LIGHTMAP_ON) && defined (LIGHTMAP_SHADOW_MIXING) && !defined (SHADOWS_SHADOWMASK) + //In subtractive mode when there is no shadow we kill the light contribution as direct as been baked in the lightmap. + return 0.0; + #else + return bakedShadowAttenuation; + #endif + #endif + + #if (SHADER_TARGET <= 20) || UNITY_STANDARD_SIMPLE + //no fading nor blending on SM 2.0 because of instruction count limit. + #if defined(SHADOWS_SHADOWMASK) || defined(LIGHTMAP_SHADOW_MIXING) + return min(realtimeShadowAttenuation, bakedShadowAttenuation); + #else + return realtimeShadowAttenuation; + #endif + #endif + + #if defined(LIGHTMAP_SHADOW_MIXING) + //Subtractive or shadowmask mode + realtimeShadowAttenuation = saturate(realtimeShadowAttenuation + fade); + return min(realtimeShadowAttenuation, bakedShadowAttenuation); + #endif + + //In distance shadowmask or realtime shadow fadeout we lerp toward the baked shadows (bakedShadowAttenuation will be 1 if no baked shadows) + return lerp(realtimeShadowAttenuation, bakedShadowAttenuation, fade); +} + +// ------------------------------------------------------------------ +// Shadow fade +// ------------------------------------------------------------------ + +float UnityComputeShadowFadeDistance(float3 wpos, float z) +{ + float sphereDist = distance(wpos, unity_ShadowFadeCenterAndType.xyz); + return lerp(z, sphereDist, unity_ShadowFadeCenterAndType.w); +} + +// ------------------------------------------------------------------ +half UnityComputeShadowFade(float fadeDist) +{ + return saturate(fadeDist * _LightShadowData.z + _LightShadowData.w); +} + + +// ------------------------------------------------------------------ +// Bias +// ------------------------------------------------------------------ + +/** +* Computes the receiver plane depth bias for the given shadow coord in screen space. +* Inspirations: +* http://mynameismjp.wordpress.com/2013/09/10/shadow-maps/ +* http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/Isidoro-ShadowMapping.pdf +*/ +float3 UnityGetReceiverPlaneDepthBias(float3 shadowCoord, float biasMultiply) +{ + // Should receiver plane bias be used? This estimates receiver slope using derivatives, + // and tries to tilt the PCF kernel along it. However, when doing it in screenspace from the depth texture + // (ie all light in deferred and directional light in both forward and deferred), the derivatives are wrong + // on edges or intersections of objects, leading to shadow artifacts. Thus it is disabled by default. + float3 biasUVZ = 0; + +#if defined(UNITY_USE_RECEIVER_PLANE_BIAS) && defined(SHADOWMAPSAMPLER_AND_TEXELSIZE_DEFINED) + float3 dx = ddx(shadowCoord); + float3 dy = ddy(shadowCoord); + + biasUVZ.x = dy.y * dx.z - dx.y * dy.z; + biasUVZ.y = dx.x * dy.z - dy.x * dx.z; + biasUVZ.xy *= biasMultiply / ((dx.x * dy.y) - (dx.y * dy.x)); + + // Static depth biasing to make up for incorrect fractional sampling on the shadow map grid. + const float UNITY_RECEIVER_PLANE_MIN_FRACTIONAL_ERROR = 0.01f; + float fractionalSamplingError = dot(_ShadowMapTexture_TexelSize.xy, abs(biasUVZ.xy)); + biasUVZ.z = -min(fractionalSamplingError, UNITY_RECEIVER_PLANE_MIN_FRACTIONAL_ERROR); + #if defined(UNITY_REVERSED_Z) + biasUVZ.z *= -1; + #endif +#endif + + return biasUVZ; +} + +/** +* Combines the different components of a shadow coordinate and returns the final coordinate. +* See UnityGetReceiverPlaneDepthBias +*/ +float3 UnityCombineShadowcoordComponents(float2 baseUV, float2 deltaUV, float depth, float3 receiverPlaneDepthBias) +{ + float3 uv = float3(baseUV + deltaUV, depth + receiverPlaneDepthBias.z); + uv.z += dot(deltaUV, receiverPlaneDepthBias.xy); + return uv; +} + +// ------------------------------------------------------------------ +// PCF Filtering helpers +// ------------------------------------------------------------------ + +/** +* Assuming a isoceles rectangle triangle of height "triangleHeight" (as drawn below). +* This function return the area of the triangle above the first texel. +* +* |\ <-- 45 degree slop isosceles rectangle triangle +* | \ +* ---- <-- length of this side is "triangleHeight" +* _ _ _ _ <-- texels +*/ +float _UnityInternalGetAreaAboveFirstTexelUnderAIsocelesRectangleTriangle(float triangleHeight) +{ + return triangleHeight - 0.5; +} + +/** +* Assuming a isoceles triangle of 1.5 texels height and 3 texels wide lying on 4 texels. +* This function return the area of the triangle above each of those texels. +* | <-- offset from -0.5 to 0.5, 0 meaning triangle is exactly in the center +* / \ <-- 45 degree slop isosceles triangle (ie tent projected in 2D) +* / \ +* _ _ _ _ <-- texels +* X Y Z W <-- result indices (in computedArea.xyzw and computedAreaUncut.xyzw) +*/ +void _UnityInternalGetAreaPerTexel_3TexelsWideTriangleFilter(float offset, out float4 computedArea, out float4 computedAreaUncut) +{ + //Compute the exterior areas + float offset01SquaredHalved = (offset + 0.5) * (offset + 0.5) * 0.5; + computedAreaUncut.x = computedArea.x = offset01SquaredHalved - offset; + computedAreaUncut.w = computedArea.w = offset01SquaredHalved; + + //Compute the middle areas + //For Y : We find the area in Y of as if the left section of the isoceles triangle would + //intersect the axis between Y and Z (ie where offset = 0). + computedAreaUncut.y = _UnityInternalGetAreaAboveFirstTexelUnderAIsocelesRectangleTriangle(1.5 - offset); + //This area is superior to the one we are looking for if (offset < 0) thus we need to + //subtract the area of the triangle defined by (0,1.5-offset), (0,1.5+offset), (-offset,1.5). + float clampedOffsetLeft = min(offset,0); + float areaOfSmallLeftTriangle = clampedOffsetLeft * clampedOffsetLeft; + computedArea.y = computedAreaUncut.y - areaOfSmallLeftTriangle; + + //We do the same for the Z but with the right part of the isoceles triangle + computedAreaUncut.z = _UnityInternalGetAreaAboveFirstTexelUnderAIsocelesRectangleTriangle(1.5 + offset); + float clampedOffsetRight = max(offset,0); + float areaOfSmallRightTriangle = clampedOffsetRight * clampedOffsetRight; + computedArea.z = computedAreaUncut.z - areaOfSmallRightTriangle; +} + +/** + * Assuming a isoceles triangle of 1.5 texels height and 3 texels wide lying on 4 texels. + * This function return the weight of each texels area relative to the full triangle area. + */ +void _UnityInternalGetWeightPerTexel_3TexelsWideTriangleFilter(float offset, out float4 computedWeight) +{ + float4 dummy; + _UnityInternalGetAreaPerTexel_3TexelsWideTriangleFilter(offset, computedWeight, dummy); + computedWeight *= 0.44444;//0.44 == 1/(the triangle area) +} + +/** +* Assuming a isoceles triangle of 2.5 texel height and 5 texels wide lying on 6 texels. +* This function return the weight of each texels area relative to the full triangle area. +* / \ +* _ _ _ _ _ _ <-- texels +* 0 1 2 3 4 5 <-- computed area indices (in texelsWeights[]) +*/ +void _UnityInternalGetWeightPerTexel_5TexelsWideTriangleFilter(float offset, out float3 texelsWeightsA, out float3 texelsWeightsB) +{ + //See _UnityInternalGetAreaPerTexel_3TexelTriangleFilter for details. + float4 computedArea_From3texelTriangle; + float4 computedAreaUncut_From3texelTriangle; + _UnityInternalGetAreaPerTexel_3TexelsWideTriangleFilter(offset, computedArea_From3texelTriangle, computedAreaUncut_From3texelTriangle); + + //Triangle slop is 45 degree thus we can almost reuse the result of the 3 texel wide computation. + //the 5 texel wide triangle can be seen as the 3 texel wide one but shifted up by one unit/texel. + //0.16 is 1/(the triangle area) + texelsWeightsA.x = 0.16 * (computedArea_From3texelTriangle.x); + texelsWeightsA.y = 0.16 * (computedAreaUncut_From3texelTriangle.y); + texelsWeightsA.z = 0.16 * (computedArea_From3texelTriangle.y + 1); + texelsWeightsB.x = 0.16 * (computedArea_From3texelTriangle.z + 1); + texelsWeightsB.y = 0.16 * (computedAreaUncut_From3texelTriangle.z); + texelsWeightsB.z = 0.16 * (computedArea_From3texelTriangle.w); +} + +/** +* Assuming a isoceles triangle of 3.5 texel height and 7 texels wide lying on 8 texels. +* This function return the weight of each texels area relative to the full triangle area. +* / \ +* _ _ _ _ _ _ _ _ <-- texels +* 0 1 2 3 4 5 6 7 <-- computed area indices (in texelsWeights[]) +*/ +void _UnityInternalGetWeightPerTexel_7TexelsWideTriangleFilter(float offset, out float4 texelsWeightsA, out float4 texelsWeightsB) +{ + //See _UnityInternalGetAreaPerTexel_3TexelTriangleFilter for details. + float4 computedArea_From3texelTriangle; + float4 computedAreaUncut_From3texelTriangle; + _UnityInternalGetAreaPerTexel_3TexelsWideTriangleFilter(offset, computedArea_From3texelTriangle, computedAreaUncut_From3texelTriangle); + + //Triangle slop is 45 degree thus we can almost reuse the result of the 3 texel wide computation. + //the 7 texel wide triangle can be seen as the 3 texel wide one but shifted up by two unit/texel. + //0.081632 is 1/(the triangle area) + texelsWeightsA.x = 0.081632 * (computedArea_From3texelTriangle.x); + texelsWeightsA.y = 0.081632 * (computedAreaUncut_From3texelTriangle.y); + texelsWeightsA.z = 0.081632 * (computedAreaUncut_From3texelTriangle.y + 1); + texelsWeightsA.w = 0.081632 * (computedArea_From3texelTriangle.y + 2); + texelsWeightsB.x = 0.081632 * (computedArea_From3texelTriangle.z + 2); + texelsWeightsB.y = 0.081632 * (computedAreaUncut_From3texelTriangle.z + 1); + texelsWeightsB.z = 0.081632 * (computedAreaUncut_From3texelTriangle.z); + texelsWeightsB.w = 0.081632 * (computedArea_From3texelTriangle.w); +} + +// ------------------------------------------------------------------ +// PCF Filtering +// ------------------------------------------------------------------ + +/** +* PCF gaussian shadowmap filtering based on a 3x3 kernel (9 taps no PCF hardware support) +*/ +half UnitySampleShadowmap_PCF3x3NoHardwareSupport(float4 coord, float3 receiverPlaneDepthBias) +{ + half shadow = 1; + +#ifdef SHADOWMAPSAMPLER_AND_TEXELSIZE_DEFINED + // when we don't have hardware PCF sampling, then the above 5x5 optimized PCF really does not work. + // Fallback to a simple 3x3 sampling with averaged results. + float2 base_uv = coord.xy; + float2 ts = _ShadowMapTexture_TexelSize.xy; + shadow = 0; + shadow += UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(-ts.x, -ts.y), coord.z, receiverPlaneDepthBias)); + shadow += UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(0, -ts.y), coord.z, receiverPlaneDepthBias)); + shadow += UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(ts.x, -ts.y), coord.z, receiverPlaneDepthBias)); + shadow += UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(-ts.x, 0), coord.z, receiverPlaneDepthBias)); + shadow += UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(0, 0), coord.z, receiverPlaneDepthBias)); + shadow += UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(ts.x, 0), coord.z, receiverPlaneDepthBias)); + shadow += UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(-ts.x, ts.y), coord.z, receiverPlaneDepthBias)); + shadow += UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(0, ts.y), coord.z, receiverPlaneDepthBias)); + shadow += UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(ts.x, ts.y), coord.z, receiverPlaneDepthBias)); + shadow /= 9.0; +#endif + + return shadow; +} + +/** +* PCF tent shadowmap filtering based on a 3x3 kernel (optimized with 4 taps) +*/ +half UnitySampleShadowmap_PCF3x3Tent(float4 coord, float3 receiverPlaneDepthBias) +{ + half shadow = 1; + +#ifdef SHADOWMAPSAMPLER_AND_TEXELSIZE_DEFINED + + #ifndef SHADOWS_NATIVE + // when we don't have hardware PCF sampling, fallback to a simple 3x3 sampling with averaged results. + return UnitySampleShadowmap_PCF3x3NoHardwareSupport(coord, receiverPlaneDepthBias); + #endif + + // tent base is 3x3 base thus covering from 9 to 12 texels, thus we need 4 bilinear PCF fetches + float2 tentCenterInTexelSpace = coord.xy * _ShadowMapTexture_TexelSize.zw; + float2 centerOfFetchesInTexelSpace = floor(tentCenterInTexelSpace + 0.5); + float2 offsetFromTentCenterToCenterOfFetches = tentCenterInTexelSpace - centerOfFetchesInTexelSpace; + + // find the weight of each texel based + float4 texelsWeightsU, texelsWeightsV; + _UnityInternalGetWeightPerTexel_3TexelsWideTriangleFilter(offsetFromTentCenterToCenterOfFetches.x, texelsWeightsU); + _UnityInternalGetWeightPerTexel_3TexelsWideTriangleFilter(offsetFromTentCenterToCenterOfFetches.y, texelsWeightsV); + + // each fetch will cover a group of 2x2 texels, the weight of each group is the sum of the weights of the texels + float2 fetchesWeightsU = texelsWeightsU.xz + texelsWeightsU.yw; + float2 fetchesWeightsV = texelsWeightsV.xz + texelsWeightsV.yw; + + // move the PCF bilinear fetches to respect texels weights + float2 fetchesOffsetsU = texelsWeightsU.yw / fetchesWeightsU.xy + float2(-1.5,0.5); + float2 fetchesOffsetsV = texelsWeightsV.yw / fetchesWeightsV.xy + float2(-1.5,0.5); + fetchesOffsetsU *= _ShadowMapTexture_TexelSize.xx; + fetchesOffsetsV *= _ShadowMapTexture_TexelSize.yy; + + // fetch ! + float2 bilinearFetchOrigin = centerOfFetchesInTexelSpace * _ShadowMapTexture_TexelSize.xy; + shadow = fetchesWeightsU.x * fetchesWeightsV.x * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.x, fetchesOffsetsV.x), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.y * fetchesWeightsV.x * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.y, fetchesOffsetsV.x), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.x * fetchesWeightsV.y * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.x, fetchesOffsetsV.y), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.y * fetchesWeightsV.y * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.y, fetchesOffsetsV.y), coord.z, receiverPlaneDepthBias)); +#endif + + return shadow; +} + +/** +* PCF tent shadowmap filtering based on a 5x5 kernel (optimized with 9 taps) +*/ +half UnitySampleShadowmap_PCF5x5Tent(float4 coord, float3 receiverPlaneDepthBias) +{ + half shadow = 1; + +#ifdef SHADOWMAPSAMPLER_AND_TEXELSIZE_DEFINED + + #ifndef SHADOWS_NATIVE + // when we don't have hardware PCF sampling, fallback to a simple 3x3 sampling with averaged results. + return UnitySampleShadowmap_PCF3x3NoHardwareSupport(coord, receiverPlaneDepthBias); + #endif + + // tent base is 5x5 base thus covering from 25 to 36 texels, thus we need 9 bilinear PCF fetches + float2 tentCenterInTexelSpace = coord.xy * _ShadowMapTexture_TexelSize.zw; + float2 centerOfFetchesInTexelSpace = floor(tentCenterInTexelSpace + 0.5); + float2 offsetFromTentCenterToCenterOfFetches = tentCenterInTexelSpace - centerOfFetchesInTexelSpace; + + // find the weight of each texel based on the area of a 45 degree slop tent above each of them. + float3 texelsWeightsU_A, texelsWeightsU_B; + float3 texelsWeightsV_A, texelsWeightsV_B; + _UnityInternalGetWeightPerTexel_5TexelsWideTriangleFilter(offsetFromTentCenterToCenterOfFetches.x, texelsWeightsU_A, texelsWeightsU_B); + _UnityInternalGetWeightPerTexel_5TexelsWideTriangleFilter(offsetFromTentCenterToCenterOfFetches.y, texelsWeightsV_A, texelsWeightsV_B); + + // each fetch will cover a group of 2x2 texels, the weight of each group is the sum of the weights of the texels + float3 fetchesWeightsU = float3(texelsWeightsU_A.xz, texelsWeightsU_B.y) + float3(texelsWeightsU_A.y, texelsWeightsU_B.xz); + float3 fetchesWeightsV = float3(texelsWeightsV_A.xz, texelsWeightsV_B.y) + float3(texelsWeightsV_A.y, texelsWeightsV_B.xz); + + // move the PCF bilinear fetches to respect texels weights + float3 fetchesOffsetsU = float3(texelsWeightsU_A.y, texelsWeightsU_B.xz) / fetchesWeightsU.xyz + float3(-2.5,-0.5,1.5); + float3 fetchesOffsetsV = float3(texelsWeightsV_A.y, texelsWeightsV_B.xz) / fetchesWeightsV.xyz + float3(-2.5,-0.5,1.5); + fetchesOffsetsU *= _ShadowMapTexture_TexelSize.xxx; + fetchesOffsetsV *= _ShadowMapTexture_TexelSize.yyy; + + // fetch ! + float2 bilinearFetchOrigin = centerOfFetchesInTexelSpace * _ShadowMapTexture_TexelSize.xy; + shadow = fetchesWeightsU.x * fetchesWeightsV.x * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.x, fetchesOffsetsV.x), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.y * fetchesWeightsV.x * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.y, fetchesOffsetsV.x), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.z * fetchesWeightsV.x * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.z, fetchesOffsetsV.x), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.x * fetchesWeightsV.y * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.x, fetchesOffsetsV.y), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.y * fetchesWeightsV.y * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.y, fetchesOffsetsV.y), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.z * fetchesWeightsV.y * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.z, fetchesOffsetsV.y), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.x * fetchesWeightsV.z * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.x, fetchesOffsetsV.z), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.y * fetchesWeightsV.z * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.y, fetchesOffsetsV.z), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.z * fetchesWeightsV.z * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.z, fetchesOffsetsV.z), coord.z, receiverPlaneDepthBias)); +#endif + + return shadow; +} + +/** +* PCF tent shadowmap filtering based on a 7x7 kernel (optimized with 16 taps) +*/ +half UnitySampleShadowmap_PCF7x7Tent(float4 coord, float3 receiverPlaneDepthBias) +{ + half shadow = 1; + +#ifdef SHADOWMAPSAMPLER_AND_TEXELSIZE_DEFINED + + #ifndef SHADOWS_NATIVE + // when we don't have hardware PCF sampling, fallback to a simple 3x3 sampling with averaged results. + return UnitySampleShadowmap_PCF3x3NoHardwareSupport(coord, receiverPlaneDepthBias); + #endif + + // tent base is 7x7 base thus covering from 49 to 64 texels, thus we need 16 bilinear PCF fetches + float2 tentCenterInTexelSpace = coord.xy * _ShadowMapTexture_TexelSize.zw; + float2 centerOfFetchesInTexelSpace = floor(tentCenterInTexelSpace + 0.5); + float2 offsetFromTentCenterToCenterOfFetches = tentCenterInTexelSpace - centerOfFetchesInTexelSpace; + + // find the weight of each texel based on the area of a 45 degree slop tent above each of them. + float4 texelsWeightsU_A, texelsWeightsU_B; + float4 texelsWeightsV_A, texelsWeightsV_B; + _UnityInternalGetWeightPerTexel_7TexelsWideTriangleFilter(offsetFromTentCenterToCenterOfFetches.x, texelsWeightsU_A, texelsWeightsU_B); + _UnityInternalGetWeightPerTexel_7TexelsWideTriangleFilter(offsetFromTentCenterToCenterOfFetches.y, texelsWeightsV_A, texelsWeightsV_B); + + // each fetch will cover a group of 2x2 texels, the weight of each group is the sum of the weights of the texels + float4 fetchesWeightsU = float4(texelsWeightsU_A.xz, texelsWeightsU_B.xz) + float4(texelsWeightsU_A.yw, texelsWeightsU_B.yw); + float4 fetchesWeightsV = float4(texelsWeightsV_A.xz, texelsWeightsV_B.xz) + float4(texelsWeightsV_A.yw, texelsWeightsV_B.yw); + + // move the PCF bilinear fetches to respect texels weights + float4 fetchesOffsetsU = float4(texelsWeightsU_A.yw, texelsWeightsU_B.yw) / fetchesWeightsU.xyzw + float4(-3.5,-1.5,0.5,2.5); + float4 fetchesOffsetsV = float4(texelsWeightsV_A.yw, texelsWeightsV_B.yw) / fetchesWeightsV.xyzw + float4(-3.5,-1.5,0.5,2.5); + fetchesOffsetsU *= _ShadowMapTexture_TexelSize.xxxx; + fetchesOffsetsV *= _ShadowMapTexture_TexelSize.yyyy; + + // fetch ! + float2 bilinearFetchOrigin = centerOfFetchesInTexelSpace * _ShadowMapTexture_TexelSize.xy; + shadow = fetchesWeightsU.x * fetchesWeightsV.x * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.x, fetchesOffsetsV.x), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.y * fetchesWeightsV.x * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.y, fetchesOffsetsV.x), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.z * fetchesWeightsV.x * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.z, fetchesOffsetsV.x), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.w * fetchesWeightsV.x * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.w, fetchesOffsetsV.x), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.x * fetchesWeightsV.y * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.x, fetchesOffsetsV.y), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.y * fetchesWeightsV.y * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.y, fetchesOffsetsV.y), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.z * fetchesWeightsV.y * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.z, fetchesOffsetsV.y), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.w * fetchesWeightsV.y * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.w, fetchesOffsetsV.y), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.x * fetchesWeightsV.z * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.x, fetchesOffsetsV.z), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.y * fetchesWeightsV.z * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.y, fetchesOffsetsV.z), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.z * fetchesWeightsV.z * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.z, fetchesOffsetsV.z), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.w * fetchesWeightsV.z * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.w, fetchesOffsetsV.z), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.x * fetchesWeightsV.w * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.x, fetchesOffsetsV.w), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.y * fetchesWeightsV.w * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.y, fetchesOffsetsV.w), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.z * fetchesWeightsV.w * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.z, fetchesOffsetsV.w), coord.z, receiverPlaneDepthBias)); + shadow += fetchesWeightsU.w * fetchesWeightsV.w * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(bilinearFetchOrigin, float2(fetchesOffsetsU.w, fetchesOffsetsV.w), coord.z, receiverPlaneDepthBias)); +#endif + + return shadow; +} + +/** +* PCF gaussian shadowmap filtering based on a 3x3 kernel (optimized with 4 taps) +* +* Algorithm: http://the-witness.net/news/2013/09/shadow-mapping-summary-part-1/ +* Implementation example: http://mynameismjp.wordpress.com/2013/09/10/shadow-maps/ +*/ +half UnitySampleShadowmap_PCF3x3Gaussian(float4 coord, float3 receiverPlaneDepthBias) +{ + half shadow = 1; + +#ifdef SHADOWMAPSAMPLER_AND_TEXELSIZE_DEFINED + + #ifndef SHADOWS_NATIVE + // when we don't have hardware PCF sampling, fallback to a simple 3x3 sampling with averaged results. + return UnitySampleShadowmap_PCF3x3NoHardwareSupport(coord, receiverPlaneDepthBias); + #endif + + const float2 offset = float2(0.5, 0.5); + float2 uv = (coord.xy * _ShadowMapTexture_TexelSize.zw) + offset; + float2 base_uv = (floor(uv) - offset) * _ShadowMapTexture_TexelSize.xy; + float2 st = frac(uv); + + float2 uw = float2(3 - 2 * st.x, 1 + 2 * st.x); + float2 u = float2((2 - st.x) / uw.x - 1, (st.x) / uw.y + 1); + u *= _ShadowMapTexture_TexelSize.x; + + float2 vw = float2(3 - 2 * st.y, 1 + 2 * st.y); + float2 v = float2((2 - st.y) / vw.x - 1, (st.y) / vw.y + 1); + v *= _ShadowMapTexture_TexelSize.y; + + half sum = 0; + + sum += uw[0] * vw[0] * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(u[0], v[0]), coord.z, receiverPlaneDepthBias)); + sum += uw[1] * vw[0] * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(u[1], v[0]), coord.z, receiverPlaneDepthBias)); + sum += uw[0] * vw[1] * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(u[0], v[1]), coord.z, receiverPlaneDepthBias)); + sum += uw[1] * vw[1] * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(u[1], v[1]), coord.z, receiverPlaneDepthBias)); + + shadow = sum / 16.0f; +#endif + + return shadow; +} + +/** +* PCF gaussian shadowmap filtering based on a 5x5 kernel (optimized with 9 taps) +* +* Algorithm: http://the-witness.net/news/2013/09/shadow-mapping-summary-part-1/ +* Implementation example: http://mynameismjp.wordpress.com/2013/09/10/shadow-maps/ +*/ +half UnitySampleShadowmap_PCF5x5Gaussian(float4 coord, float3 receiverPlaneDepthBias) +{ + half shadow = 1; + +#ifdef SHADOWMAPSAMPLER_AND_TEXELSIZE_DEFINED + + #ifndef SHADOWS_NATIVE + // when we don't have hardware PCF sampling, fallback to a simple 3x3 sampling with averaged results. + return UnitySampleShadowmap_PCF3x3NoHardwareSupport(coord, receiverPlaneDepthBias); + #endif + + const float2 offset = float2(0.5, 0.5); + float2 uv = (coord.xy * _ShadowMapTexture_TexelSize.zw) + offset; + float2 base_uv = (floor(uv) - offset) * _ShadowMapTexture_TexelSize.xy; + float2 st = frac(uv); + + float3 uw = float3(4 - 3 * st.x, 7, 1 + 3 * st.x); + float3 u = float3((3 - 2 * st.x) / uw.x - 2, (3 + st.x) / uw.y, st.x / uw.z + 2); + u *= _ShadowMapTexture_TexelSize.x; + + float3 vw = float3(4 - 3 * st.y, 7, 1 + 3 * st.y); + float3 v = float3((3 - 2 * st.y) / vw.x - 2, (3 + st.y) / vw.y, st.y / vw.z + 2); + v *= _ShadowMapTexture_TexelSize.y; + + half sum = 0.0f; + + half3 accum = uw * vw.x; + sum += accum.x * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(u.x, v.x), coord.z, receiverPlaneDepthBias)); + sum += accum.y * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(u.y, v.x), coord.z, receiverPlaneDepthBias)); + sum += accum.z * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(u.z, v.x), coord.z, receiverPlaneDepthBias)); + + accum = uw * vw.y; + sum += accum.x * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(u.x, v.y), coord.z, receiverPlaneDepthBias)); + sum += accum.y * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(u.y, v.y), coord.z, receiverPlaneDepthBias)); + sum += accum.z * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(u.z, v.y), coord.z, receiverPlaneDepthBias)); + + accum = uw * vw.z; + sum += accum.x * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(u.x, v.z), coord.z, receiverPlaneDepthBias)); + sum += accum.y * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(u.y, v.z), coord.z, receiverPlaneDepthBias)); + sum += accum.z * UNITY_SAMPLE_SHADOW(_ShadowMapTexture, UnityCombineShadowcoordComponents(base_uv, float2(u.z, v.z), coord.z, receiverPlaneDepthBias)); + shadow = sum / 144.0f; + +#endif + + return shadow; +} + +half UnitySampleShadowmap_PCF3x3(float4 coord, float3 receiverPlaneDepthBias) +{ + return UnitySampleShadowmap_PCF3x3Tent(coord, receiverPlaneDepthBias); +} + +half UnitySampleShadowmap_PCF5x5(float4 coord, float3 receiverPlaneDepthBias) +{ + return UnitySampleShadowmap_PCF5x5Tent(coord, receiverPlaneDepthBias); +} + +half UnitySampleShadowmap_PCF7x7(float4 coord, float3 receiverPlaneDepthBias) +{ + return UnitySampleShadowmap_PCF7x7Tent(coord, receiverPlaneDepthBias); +} diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/UnityShadowLibraryShim.hlsl.meta b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/UnityShadowLibraryShim.hlsl.meta new file mode 100644 index 00000000000..ec47be2e59a --- /dev/null +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/UnityShadowLibraryShim.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bfd7d54886c05e54cb8c49733c587e43 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/Artistic/Blend.shadergraph b/Packages/com.unity.shadergraph/Samples~/NodeReference/Artistic/Blend.shadergraph index 891b3bbfb66..1fc73a72e54 100644 --- a/Packages/com.unity.shadergraph/Samples~/NodeReference/Artistic/Blend.shadergraph +++ b/Packages/com.unity.shadergraph/Samples~/NodeReference/Artistic/Blend.shadergraph @@ -1212,7 +1212,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 @@ -1309,7 +1309,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 @@ -2031,7 +2031,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 @@ -2601,7 +2601,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 @@ -2828,7 +2828,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 @@ -3198,7 +3198,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 @@ -6186,7 +6186,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 @@ -7089,7 +7089,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/Input/SplitTextureTransform.shadergraph b/Packages/com.unity.shadergraph/Samples~/NodeReference/Input/SplitTextureTransform.shadergraph index 080427c7d81..633ca1274a4 100644 --- a/Packages/com.unity.shadergraph/Samples~/NodeReference/Input/SplitTextureTransform.shadergraph +++ b/Packages/com.unity.shadergraph/Samples~/NodeReference/Input/SplitTextureTransform.shadergraph @@ -2008,7 +2008,7 @@ "m_SerializableColors": [] }, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" } } diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/Input/Time.shadergraph b/Packages/com.unity.shadergraph/Samples~/NodeReference/Input/Time.shadergraph index c41291e2a55..c58b8f19df2 100644 --- a/Packages/com.unity.shadergraph/Samples~/NodeReference/Input/Time.shadergraph +++ b/Packages/com.unity.shadergraph/Samples~/NodeReference/Input/Time.shadergraph @@ -1635,7 +1635,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 @@ -5660,7 +5660,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 @@ -6745,7 +6745,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/Input/UV.shadergraph b/Packages/com.unity.shadergraph/Samples~/NodeReference/Input/UV.shadergraph index 87a879e6801..1637ebfb0f6 100644 --- a/Packages/com.unity.shadergraph/Samples~/NodeReference/Input/UV.shadergraph +++ b/Packages/com.unity.shadergraph/Samples~/NodeReference/Input/UV.shadergraph @@ -3650,7 +3650,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/Math/Add.shadergraph b/Packages/com.unity.shadergraph/Samples~/NodeReference/Math/Add.shadergraph index 099f74bd503..bfa47d4cde9 100644 --- a/Packages/com.unity.shadergraph/Samples~/NodeReference/Math/Add.shadergraph +++ b/Packages/com.unity.shadergraph/Samples~/NodeReference/Math/Add.shadergraph @@ -316,7 +316,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/Math/Lerp.shadergraph b/Packages/com.unity.shadergraph/Samples~/NodeReference/Math/Lerp.shadergraph index 43e975aca3d..d59449a59b7 100644 --- a/Packages/com.unity.shadergraph/Samples~/NodeReference/Math/Lerp.shadergraph +++ b/Packages/com.unity.shadergraph/Samples~/NodeReference/Math/Lerp.shadergraph @@ -2806,7 +2806,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/Math/Subtract.shadergraph b/Packages/com.unity.shadergraph/Samples~/NodeReference/Math/Subtract.shadergraph index 8cb55a6782d..2cf75b3e451 100644 --- a/Packages/com.unity.shadergraph/Samples~/NodeReference/Math/Subtract.shadergraph +++ b/Packages/com.unity.shadergraph/Samples~/NodeReference/Math/Subtract.shadergraph @@ -292,7 +292,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/Textures/FlipbookTest.png.meta b/Packages/com.unity.shadergraph/Samples~/NodeReference/Textures/FlipbookTest.png.meta index c4fae1489b2..8e65613209a 100644 --- a/Packages/com.unity.shadergraph/Samples~/NodeReference/Textures/FlipbookTest.png.meta +++ b/Packages/com.unity.shadergraph/Samples~/NodeReference/Textures/FlipbookTest.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a7ff24a0f3bd4dd4aaf9265ba8da09ba +guid: b8aa35b1f4ce5ee5bbf0376cb9eb10cb TextureImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/Textures/SmallNoiseMask.tga b/Packages/com.unity.shadergraph/Samples~/NodeReference/Textures/SmallNoiseMask.tga deleted file mode 100644 index 3b309c51fcb..00000000000 Binary files a/Packages/com.unity.shadergraph/Samples~/NodeReference/Textures/SmallNoiseMask.tga and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/Textures/SmallNoiseMask.tga.meta b/Packages/com.unity.shadergraph/Samples~/NodeReference/Textures/SmallNoiseMask.tga.meta deleted file mode 100644 index 35949ffc3dd..00000000000 --- a/Packages/com.unity.shadergraph/Samples~/NodeReference/Textures/SmallNoiseMask.tga.meta +++ /dev/null @@ -1,147 +0,0 @@ -fileFormatVersion: 2 -guid: 2fe31a8312ab8524ebd8601be367f0c8 -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 11 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - flipGreenChannel: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - vTOnly: 0 - ignoreMasterTextureLimit: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: 1 - aniso: 1 - mipBias: 0 - wrapU: 0 - wrapV: 0 - wrapW: 0 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 10 - textureShape: 1 - singleChannelComponent: 1 - flipbookRows: 1 - flipbookColumns: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - ignorePngGamma: 0 - applyGammaDecoding: 0 - swizzle: 50462976 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 64 - resizeAlgorithm: 0 - textureFormat: 63 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Standalone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Server - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: WebGL - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Windows Store Apps - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - nameFileIdTable: {} - spritePackingTag: - pSDRemoveMatte: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/Textures/flowmap.png b/Packages/com.unity.shadergraph/Samples~/NodeReference/Textures/flowmap.png deleted file mode 100644 index d3abf5bc620..00000000000 Binary files a/Packages/com.unity.shadergraph/Samples~/NodeReference/Textures/flowmap.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/Textures/flowmap.png.meta b/Packages/com.unity.shadergraph/Samples~/NodeReference/Textures/flowmap.png.meta deleted file mode 100644 index 6521f6c92b3..00000000000 --- a/Packages/com.unity.shadergraph/Samples~/NodeReference/Textures/flowmap.png.meta +++ /dev/null @@ -1,146 +0,0 @@ -fileFormatVersion: 2 -guid: 0f8b659603075564c8b3b82db6ccef13 -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 11 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - vTOnly: 0 - ignoreMasterTextureLimit: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: 1 - aniso: 1 - mipBias: 0 - wrapU: 0 - wrapV: 0 - wrapW: 0 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - flipbookRows: 1 - flipbookColumns: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - ignorePngGamma: 0 - applyGammaDecoding: 0 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 2 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Standalone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Server - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: WebGL - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Windows Store Apps - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - nameFileIdTable: {} - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Flipbook.shadergraph b/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Flipbook.shadergraph index fd1ad939ae4..278ebe5a316 100644 --- a/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Flipbook.shadergraph +++ b/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Flipbook.shadergraph @@ -1095,7 +1095,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 @@ -2522,7 +2522,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 @@ -3231,7 +3231,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 @@ -4050,7 +4050,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/PolarCoordinates.shadergraph b/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/PolarCoordinates.shadergraph index 4120b13efe2..d20ab5a3b7c 100644 --- a/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/PolarCoordinates.shadergraph +++ b/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/PolarCoordinates.shadergraph @@ -2725,7 +2725,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 @@ -3125,7 +3125,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/RadialShear.shadergraph b/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/RadialShear.shadergraph index 8b22c0d895d..e97ba4cc26d 100644 --- a/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/RadialShear.shadergraph +++ b/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/RadialShear.shadergraph @@ -1236,7 +1236,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Rotate.shadergraph b/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Rotate.shadergraph index 9a4622076f9..976204a031a 100644 --- a/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Rotate.shadergraph +++ b/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Rotate.shadergraph @@ -1967,7 +1967,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Spherize.shadergraph b/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Spherize.shadergraph index 8f7da11c980..afb7a900486 100644 --- a/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Spherize.shadergraph +++ b/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Spherize.shadergraph @@ -1583,7 +1583,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Triplanar.shadergraph b/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Triplanar.shadergraph index 28f83af971b..0e28ba1081e 100644 --- a/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Triplanar.shadergraph +++ b/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Triplanar.shadergraph @@ -1704,7 +1704,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 diff --git a/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Twirl.shadergraph b/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Twirl.shadergraph index 254360e5391..3b105f48fa1 100644 --- a/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Twirl.shadergraph +++ b/Packages/com.unity.shadergraph/Samples~/NodeReference/UV/Twirl.shadergraph @@ -2477,7 +2477,7 @@ "m_StageCapability": 3, "m_BareResource": false, "m_Texture": { - "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"a7ff24a0f3bd4dd4aaf9265ba8da09ba\",\"type\":3}}", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"b8aa35b1f4ce5ee5bbf0376cb9eb10cb\",\"type\":3}}", "m_Guid": "" }, "m_DefaultType": 0 diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Operator-ProbabilitySampling.md b/Packages/com.unity.visualeffectgraph/Documentation~/Operator-ProbabilitySampling.md index d64d16167d1..807df150c96 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/Operator-ProbabilitySampling.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/Operator-ProbabilitySampling.md @@ -6,7 +6,7 @@ Menu Path : **Operator > Logic > Probability Sampling** The **Probability Sampling** Operator performs a kind of switch/case operation where a weight controls the probability of selecting a case. If all weights are equal, this Operator produces a uniform distribution of the different output values. -![img](Images/Operator-ProbabilitySamplingExample.gif) + ## Operator settings diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/161_FP16_BackBuffer/ParticleWhiteTransparent.mat b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/161_FP16_BackBuffer/ParticleWhiteTransparent.mat index f77f45ba9ee..37ce54e1baf 100644 --- a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/161_FP16_BackBuffer/ParticleWhiteTransparent.mat +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/161_FP16_BackBuffer/ParticleWhiteTransparent.mat @@ -15,7 +15,7 @@ Material: - _EMISSION - _SURFACE_TYPE_TRANSPARENT m_InvalidKeywords: [] - m_LightmapFlags: 2 + m_LightmapFlags: 0 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 m_CustomRenderQueue: 3000 @@ -86,9 +86,7 @@ Material: m_Offset: {x: 0, y: 0} m_Ints: [] m_Floats: - - _AddPrecomputedVelocity: 0 - _AlphaClip: 0 - - _AlphaToMask: 0 - _Blend: 0 - _BlendModePreserveSpecular: 0 - _BumpScale: 1 @@ -116,7 +114,6 @@ Material: - _SrcBlendAlpha: 1 - _Surface: 1 - _WorkflowMode: 1 - - _XRMotionVectorsPass: 1 - _ZWrite: 0 m_Colors: - _BaseColor: {r: 1, g: 1, b: 1, a: 0.12941177} @@ -124,7 +121,6 @@ Material: - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} m_BuildTextureStacks: [] - m_AllowLocking: 1 --- !u!114 &6421356677785975880 MonoBehaviour: m_ObjectHideFlags: 11 diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Lighting/Assets/Scenes/153_Lighting_EnlightenTerrain/153_Terrain.asset b/Tests/SRPTests/Projects/UniversalGraphicsTest_Lighting/Assets/Scenes/153_Lighting_EnlightenTerrain/153_Terrain.asset index a1460f9c111..f5f6c937a9f 100644 Binary files a/Tests/SRPTests/Projects/UniversalGraphicsTest_Lighting/Assets/Scenes/153_Lighting_EnlightenTerrain/153_Terrain.asset and b/Tests/SRPTests/Projects/UniversalGraphicsTest_Lighting/Assets/Scenes/153_Lighting_EnlightenTerrain/153_Terrain.asset differ