diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/SurfaceCache/SurfaceCacheWorld.cs b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/SurfaceCache/SurfaceCacheWorld.cs index 2a5dda2c450..9fcdd037fbf 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/SurfaceCache/SurfaceCacheWorld.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/SurfaceCache/SurfaceCacheWorld.cs @@ -149,7 +149,7 @@ public AccelStructAdapter GetAccelerationStructure() public void RemoveInstance(InstanceHandle instance) { - _rayTracingAccelerationStructure.RemoveInstance(instance.ToInt()); + _rayTracingAccelerationStructure.RemoveInstance(instance.Value); _instanceHandleSet.Remove(instance); } @@ -193,18 +193,18 @@ public InstanceHandle AddInstance( } InstanceHandle instance = _instanceHandleSet.Add(); - _rayTracingAccelerationStructure.AddInstance(instance.ToInt(), mesh, localToWorldMatrix, masks, materialIndices, isOpaque, 0); + _rayTracingAccelerationStructure.AddInstance(instance.Value, mesh, localToWorldMatrix, masks, materialIndices, isOpaque, 0); return instance; } public void UpdateInstanceTransform(InstanceHandle instance, Matrix4x4 localToWorldMatrix) { - _rayTracingAccelerationStructure.UpdateInstanceTransform(instance.ToInt(), localToWorldMatrix); + _rayTracingAccelerationStructure.UpdateInstanceTransform(instance.Value, localToWorldMatrix); } public void UpdateInstanceMask(InstanceHandle instance, Span perSubMeshMask) { - _rayTracingAccelerationStructure.UpdateInstanceMask(instance.ToInt(), perSubMeshMask); + _rayTracingAccelerationStructure.UpdateInstanceMask(instance.Value, perSubMeshMask); } public void UpdateInstanceMaterials(InstanceHandle instance, Span materials) @@ -215,7 +215,7 @@ public void UpdateInstanceMaterials(InstanceHandle instance, Span lightDescs) diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl index 4f9b5bf0d20..35045c21132 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl @@ -155,6 +155,12 @@ struct UnityTexture3D TEXTURE3D(tex); SAMPLER(samplerstate); + // This dummy field is unused in Unity 6.4 and earlier. Here, the field is added strictly as a dummy to work around UUM-133088 + // Without this additional field, UnityTexture3D and sampler3D_f have the exact same structure, which will cause DXC to consider + // them as the same type. This causes to compilation errors due to the corresponding overloads of tex3D being considered ambiguous + // by DXC. Adding the field resolves this. Starting from Unity 6.5, the field is actually used in code. + float4 hdrDecode; + // these functions allows users to convert code using Texture3D to UnityTexture3D by simply changing the type of the variable // the existing texture macros will call these functions, which will forward the call to the texture appropriately float4 Sample(UnitySamplerState s, float3 uvw) { return SAMPLE_TEXTURE3D(tex, s.samplerstate, uvw); } diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/deep-learning-super-sampling-in-hdrp.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/deep-learning-super-sampling-in-hdrp.md index 0b4b54c3c2c..15565a39b90 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/deep-learning-super-sampling-in-hdrp.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/deep-learning-super-sampling-in-hdrp.md @@ -1,6 +1,6 @@ # Deep learning super sampling (DLSS) -[NVIDIA Deep Learning Super Sampling (DLSS)](https://www.nvidia.com/en-us/geforce/technologies/dlss/) is a rendering technology that uses artificial intelligence to increase graphics performance. The High Definition Render Pipeline (HDRP) natively supports DLSS 4 Super Resolution. +[NVIDIA Deep Learning Super Sampling (DLSS)](https://www.nvidia.com/en-us/geforce/technologies/dlss/) is a rendering technology that uses artificial intelligence to increase graphics performance. The High Definition Render Pipeline (HDRP) natively supports DLSS 4.5 Super Resolution. ## Requirements and compatibility @@ -82,18 +82,20 @@ Available presets are marked as '1' in the table below. | Render Preset | Maximum Quality | Balanced | Maximum Performance | Ultra Performance | DLAA | Explanation | AI Model | |- |- |- |- |- |- |- |- | -| Preset F | | | | 1 | 1 | Provides the highest image stability. Default value for UltraPerformance. | CNN | -| Preset J | 1 | 1 | 1| | 1 | Slightly lowers ghosting but increases flickering.
NVIDIA recommends using **Preset K** instead of **Preset J**. | Transformer | -| Preset K | 1 | 1 | 1| | 1 | Provides the highest image quality. | Transformer | +| Preset F | | | | 1 | 1 | Marked for deprecation in upcoming DLSS releases. Don't use for new projects. | CNN | +| Preset J | 1 | 1 | 1| 1 | 1 | Slightly lowers ghosting but increases flickering.
NVIDIA recommends using **Preset K** instead of **Preset J**. | Transformer | +| Preset K | 1 | 1 | 1| 1 | 1 | Default preset for DLAA/Balanced/Quality modes. Requires fewer resources than Preset L. | Transformer | +| Preset L | | | | 1 | | Delivers a sharper, more stable image with less ghosting than Preset J, K, but lowers performance. Recommended for RTX 40 Series GPUs and above. | Transformer Gen 2 | +Provides about the same image quality as **Preset L**. This preset is slower than presets **J** and **K**, but faster than preset **L**. Recommended for RTX 40 Series GPUs and above. The defaults for each quality mode are: | **Quality mode** | **Default render preset** | |- |- | -| **Maximum Quality** | Preset K -| **Balanced** | Preset K -| **Maximum Performance** | Preset K -| **Ultra Performance** | Preset F +| **Maximum Quality** | Preset K | +| **Balanced** | Preset K | +| **Maximum Performance** | Preset M | +| **Ultra Performance** | Preset L | | **DLAA** | Preset K | DLSS render presets are project-specific. Presets are available only from the HDRP Asset settings. You can't override presets on a per-camera basis. diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/getting-started-in-hdrp.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/getting-started-in-hdrp.md index 036be6fb1f3..c026620fec1 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/getting-started-in-hdrp.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/getting-started-in-hdrp.md @@ -10,4 +10,3 @@ Set up a project to use the High Definition Render Pipeline (HDRP), and use Volu ## Additional resources - [HDRP overview](HDRP-Features.md) -- [Achieving High Fidelity Graphics for Games with HDRP](https://resources.unity.com/unitenow/onlinesessions/achieving-high-fidelity-graphics-for-games-with-hdrp) diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs index 99eb168fe30..6615616c454 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs @@ -319,7 +319,7 @@ int CountBits(uint bitMask) // System.Numerics.BitOperations not available { if (preset == UnityEngine.NVIDIA.DLSSPreset.Preset_Default) { - labels[(int)quality][iWrite++] = "Default Preset"; + labels[(int)quality][iWrite++] = "Default Preset" + " - " + UnityEngine.NVIDIA.GraphicsDevice.GetDLSSPresetExplanation(preset); continue; } diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricClouds.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricClouds.compute index 80b8c9e3e49..9e44c083f7c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricClouds.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricClouds.compute @@ -96,22 +96,41 @@ void REPROJECT_CLOUDS(uint3 dispatchThreadId : SV_DispatchThreadID, float validityFactor = 1.0; #ifdef WITH_REJECTION + + bool currentIsSky = currentSceneDepth == UNITY_RAW_FAR_CLIP_VALUE; + float4 lightingMin = float4(FLT_MAX, FLT_MAX, FLT_MAX, 1.0); float4 lightingMax = float4(0, 0, 0, 0.0); - for (int y = -1; y <= 1; ++y) + + int skySampleCount = 0; + if(currentIsSky) { - for (int x = -1; x <= 1; ++x) + for (int y = -1; y <= 1; ++y) { - CloudReprojectionData data = GetCloudReprojectionDataSample(threadCoord, int2(x, y)); - if ((data.pixelDepth == UNITY_RAW_FAR_CLIP_VALUE) == (currentSceneDepth == UNITY_RAW_FAR_CLIP_VALUE)) + for (int x = -1; x <= 1; ++x) { - lightingMin = min(lightingMin, data.cloudLighting); - lightingMax = max(lightingMax, data.cloudLighting); + CloudReprojectionData data = GetCloudReprojectionDataSample(threadCoord, int2(x, y)); + bool sampleIsSky = data.pixelDepth == UNITY_RAW_FAR_CLIP_VALUE; + + if (sampleIsSky) + { + lightingMin = min(lightingMin, data.cloudLighting); + lightingMax = max(lightingMax, data.cloudLighting); + skySampleCount++; + } } } + + // Only apply clamping if we have enough sky samples (at least 5 out of 9) + if (skySampleCount >= 5) + { + // Modulate validity factor based on sky sample ratio, the more samples are sky, the more ghosting reduction + float skyRatio = skySampleCount / 9.0; + previousColor = ClipCloudsToRegion(previousColor, lightingMin, lightingMax, skyRatio); + validityFactor *= skyRatio; + } } - previousColor = ClipCloudsToRegion(previousColor, lightingMin, lightingMax, validityFactor); #endif if (validTracing) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DLSSPass.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DLSSPass.cs index 89b93bc27ab..adf939a5990 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DLSSPass.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DLSSPass.cs @@ -183,7 +183,7 @@ private bool ShouldUseAutomaticSettings() static NVIDIA.DLSSPreset Uint2Preset(uint preset) { - if (preset >= (uint)NVIDIA.DLSSPreset.Preset_Default && preset <= (uint)NVIDIA.DLSSPreset.Preset_K) + if (preset >= (uint)NVIDIA.DLSSPreset.Preset_Default && preset <= (uint)NVIDIA.DLSSPreset.Preset_M) return (NVIDIA.DLSSPreset)preset; Debug.LogWarningFormat("Unknown DLSS Preset value {0}, using default value.", preset); return NVIDIA.DLSSPreset.Preset_Default; diff --git a/Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/GraphicsSettingsStrippers/SurfaceCacheGlobalIlluminationStripper.cs b/Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/GraphicsSettingsStrippers/SurfaceCacheGIStripper.cs similarity index 96% rename from Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/GraphicsSettingsStrippers/SurfaceCacheGlobalIlluminationStripper.cs rename to Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/GraphicsSettingsStrippers/SurfaceCacheGIStripper.cs index b5c46fad60e..52dc4618735 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/GraphicsSettingsStrippers/SurfaceCacheGlobalIlluminationStripper.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/GraphicsSettingsStrippers/SurfaceCacheGIStripper.cs @@ -21,7 +21,7 @@ static bool IsSurfaceCacheEnabled(List urpAssets) foreach (var rendererFeature in rendererData.rendererFeatures) { - if (rendererFeature is SurfaceCacheGlobalIlluminationRendererFeature { isActive: true }) + if (rendererFeature is SurfaceCacheGIRendererFeature { isActive: true }) return true; } } diff --git a/Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/GraphicsSettingsStrippers/SurfaceCacheGlobalIlluminationStripper.cs.meta b/Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/GraphicsSettingsStrippers/SurfaceCacheGIStripper.cs.meta similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/GraphicsSettingsStrippers/SurfaceCacheGlobalIlluminationStripper.cs.meta rename to Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/GraphicsSettingsStrippers/SurfaceCacheGIStripper.cs.meta diff --git a/Packages/com.unity.render-pipelines.universal/Editor/RendererFeatures/SurfaceCacheGlobalIlluminationEditor.cs b/Packages/com.unity.render-pipelines.universal/Editor/RendererFeatures/SurfaceCacheGIEditor.cs similarity index 98% rename from Packages/com.unity.render-pipelines.universal/Editor/RendererFeatures/SurfaceCacheGlobalIlluminationEditor.cs rename to Packages/com.unity.render-pipelines.universal/Editor/RendererFeatures/SurfaceCacheGIEditor.cs index bf09baa7edd..9bd00282e73 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/RendererFeatures/SurfaceCacheGlobalIlluminationEditor.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/RendererFeatures/SurfaceCacheGIEditor.cs @@ -6,8 +6,8 @@ namespace UnityEditor.Rendering.Universal { - [CustomEditor(typeof(SurfaceCacheGlobalIlluminationRendererFeature))] - internal class SurfaceCacheGlobalIlluminationEditor : Editor + [CustomEditor(typeof(SurfaceCacheGIRendererFeature))] + internal class SurfaceCacheGIEditor : Editor { private bool m_IsInitialized; diff --git a/Packages/com.unity.render-pipelines.universal/Editor/RendererFeatures/SurfaceCacheGlobalIlluminationEditor.cs.meta b/Packages/com.unity.render-pipelines.universal/Editor/RendererFeatures/SurfaceCacheGIEditor.cs.meta similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Editor/RendererFeatures/SurfaceCacheGlobalIlluminationEditor.cs.meta rename to Packages/com.unity.render-pipelines.universal/Editor/RendererFeatures/SurfaceCacheGIEditor.cs.meta diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderBuildPreprocessor.cs b/Packages/com.unity.render-pipelines.universal/Editor/ShaderBuildPreprocessor.cs index e0b82806b1f..294b8f8a9c7 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderBuildPreprocessor.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderBuildPreprocessor.cs @@ -867,7 +867,7 @@ internal static ShaderFeatures GetSupportedShaderFeaturesFromRendererFeatures(re #if SURFACE_CACHE // Surface Cache GI... - SurfaceCacheGlobalIlluminationRendererFeature surfaceCacheFeature = rendererFeature as SurfaceCacheGlobalIlluminationRendererFeature; + SurfaceCacheGIRendererFeature surfaceCacheFeature = rendererFeature as SurfaceCacheGIRendererFeature; if(surfaceCacheFeature != null) { shaderFeatures |= ShaderFeatures.SurfaceCache; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Data/PostProcessData.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Data/PostProcessData.cs index efcb98af8c7..e42fecbd724 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Data/PostProcessData.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Data/PostProcessData.cs @@ -233,7 +233,7 @@ public sealed class TextureResources : IRenderPipelineResources /// /// Pre-baked Blue noise textures. /// - // [ResourceFormattedPaths("Textures/BlueNoise16/L/LDR_LLL1_{0}.png", 0, 32)] + [ResourceFormattedPaths("Textures/BlueNoise16/L/LDR_LLL1_{0}.png", 0, 32)] public Texture2D[] blueNoise16LTex; /// diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DecalProjector.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DecalProjector.cs index 710a8fe18a0..97ba722c212 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DecalProjector.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DecalProjector.cs @@ -247,6 +247,23 @@ public float fadeFactor } } +#if UNITY_EDITOR + [SerializeField] + private bool m_VisibleInScene = true; + public bool visibleInScene + { + get + { + return m_VisibleInScene; + } + set + { + m_VisibleInScene = value; + OnValidate(); + } + } +#endif + private Material m_OldMaterial = null; private float m_OldDrawDistance = 1000.0f; private float m_OldFadeScale = 0.9f; @@ -295,18 +312,12 @@ void OnEnable() #if UNITY_EDITOR void UpdateDecalVisibility() { - // Fade out the decal when it is hidden by the scene visibility - if (UnityEditor.SceneVisibilityManager.instance.IsHidden(gameObject)) - { - onDecalRemove?.Invoke(this); - } - else - { - onDecalAdd?.Invoke(this); - onDecalPropertyChange?.Invoke(this); // Scene culling mask may have changed. - } - } + // Change serialized property when decal is hidden in scene + visibleInScene = !UnityEditor.SceneVisibilityManager.instance.IsHidden(gameObject); + // Force proeprty update that will look at visibleInScene to adjust scene culling mask + onDecalPropertyChange?.Invoke(this); + } #endif void OnDisable() diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/Entities/DecalEntityManager.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/Entities/DecalEntityManager.cs index 8d29ccd21cb..bb4a057f9bc 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/Entities/DecalEntityManager.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/Entities/DecalEntityManager.cs @@ -343,7 +343,13 @@ public void UpdateDecalEntityData(DecalEntity decalEntity, DecalProjector decalP float endAngleFade = decalProjector.endAngleFade; Vector4 uvScaleBias = decalProjector.uvScaleBias; int layerMask = decalProjector.gameObject.layer; +#if UNITY_EDITOR + // instead of removing decal altogether, set scene culling mask to game view only if !visibleInScene + ulong sceneLayerMask = decalProjector.visibleInScene ? decalProjector.gameObject.sceneCullingMask : + UnityEditor.SceneManagement.SceneCullingMasks.GameViewObjects; +#else ulong sceneLayerMask = decalProjector.gameObject.sceneCullingMask; +#endif float fadeFactor = decalProjector.fadeFactor; cachedChunk.drawDistances[arrayIndex] = new Vector2(drawDistance, fadeScale); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature.meta b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature.meta similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature.meta rename to Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature.meta diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/Debug.compute b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/Debug.compute similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/Debug.compute rename to Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/Debug.compute diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/Debug.compute.meta b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/Debug.compute.meta similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/Debug.compute.meta rename to Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/Debug.compute.meta diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/FallbackMaterial.mat b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/FallbackMaterial.mat similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/FallbackMaterial.mat rename to Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/FallbackMaterial.mat diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/FallbackMaterial.mat.meta b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/FallbackMaterial.mat.meta similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/FallbackMaterial.mat.meta rename to Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/FallbackMaterial.mat.meta diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/FallbackMaterial.shader b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/FallbackMaterial.shader similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/FallbackMaterial.shader rename to Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/FallbackMaterial.shader diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/FallbackMaterial.shader.meta b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/FallbackMaterial.shader.meta similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/FallbackMaterial.shader.meta rename to Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/FallbackMaterial.shader.meta diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/FlatNormalResolution.compute b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/FlatNormalResolution.compute similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/FlatNormalResolution.compute rename to Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/FlatNormalResolution.compute diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/FlatNormalResolution.compute.meta b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/FlatNormalResolution.compute.meta similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/FlatNormalResolution.compute.meta rename to Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/FlatNormalResolution.compute.meta diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/PatchAllocation.compute b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/PatchAllocation.compute similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/PatchAllocation.compute rename to Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/PatchAllocation.compute diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/PatchAllocation.compute.meta b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/PatchAllocation.compute.meta similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/PatchAllocation.compute.meta rename to Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/PatchAllocation.compute.meta diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/ScreenResolveLookup.compute b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/ScreenResolveLookup.compute similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/ScreenResolveLookup.compute rename to Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/ScreenResolveLookup.compute diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/ScreenResolveLookup.compute.meta b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/ScreenResolveLookup.compute.meta similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/ScreenResolveLookup.compute.meta rename to Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/ScreenResolveLookup.compute.meta diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/ScreenResolveUpsampling.compute b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/ScreenResolveUpsampling.compute similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/ScreenResolveUpsampling.compute rename to Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/ScreenResolveUpsampling.compute diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/ScreenResolveUpsampling.compute.meta b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/ScreenResolveUpsampling.compute.meta similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/ScreenResolveUpsampling.compute.meta rename to Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/ScreenResolveUpsampling.compute.meta diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/SurfaceCacheGlobalIlluminationRendererFeature.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/SurfaceCacheGIRendererFeature.cs similarity index 98% rename from Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/SurfaceCacheGlobalIlluminationRendererFeature.cs rename to Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/SurfaceCacheGIRendererFeature.cs index d4bd29ad1b7..61100d451c0 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/SurfaceCacheGlobalIlluminationRendererFeature.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/SurfaceCacheGIRendererFeature.cs @@ -24,22 +24,22 @@ sealed class SurfaceCacheRenderPipelineResourceSet : IRenderPipelineResources int IRenderPipelineGraphicsSettings.version => m_Version; - [ResourcePath("Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/FallbackMaterial.mat")] + [ResourcePath("Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/FallbackMaterial.mat")] public Material m_FallbackMaterial; - [ResourcePath("Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/PatchAllocation.compute")] + [ResourcePath("Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/PatchAllocation.compute")] public ComputeShader m_AllocationShader; - [ResourcePath("Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/ScreenResolveLookup.compute")] + [ResourcePath("Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/ScreenResolveLookup.compute")] public ComputeShader m_ScreenResolveLookupShader; - [ResourcePath("Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/ScreenResolveUpsampling.compute")] + [ResourcePath("Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/ScreenResolveUpsampling.compute")] public ComputeShader m_ScreenResolveUpsamplingShader; - [ResourcePath("Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/Debug.compute")] + [ResourcePath("Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/Debug.compute")] public ComputeShader m_DebugShader; - [ResourcePath("Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/FlatNormalResolution.compute")] + [ResourcePath("Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/FlatNormalResolution.compute")] public ComputeShader m_FlatNormalResolutionShader; public Material fallbackMaterial @@ -80,7 +80,7 @@ public ComputeShader flatNormalResolutionShader } [DisallowMultipleRendererFeature("Surface Cache Global Illumination")] - public class SurfaceCacheGlobalIlluminationRendererFeature : ScriptableRendererFeature + public class SurfaceCacheGIRendererFeature : ScriptableRendererFeature { public enum DebugViewMode_ { diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/SurfaceCacheGlobalIlluminationRendererFeature.cs.meta b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/SurfaceCacheGIRendererFeature.cs.meta similarity index 100% rename from Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/SurfaceCacheGlobalIlluminationRendererFeature.cs.meta rename to Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGIRendererFeature/SurfaceCacheGIRendererFeature.cs.meta diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Settings/URPReflectionProbeSettings.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Settings/URPReflectionProbeSettings.cs index 4f16a3aa5ad..47677c29327 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Settings/URPReflectionProbeSettings.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Settings/URPReflectionProbeSettings.cs @@ -18,6 +18,7 @@ public class URPReflectionProbeSettings : IRenderPipelineGraphicsSettings [SerializeField, HideInInspector] private int version = 1; int IRenderPipelineGraphicsSettings.version => version; + bool IRenderPipelineGraphicsSettings.isAvailableInPlayerBuild => true; [SerializeField, Tooltip("Use ReflectionProbe rotation. Enabling this will improve the appearance of reflections when the ReflectionProbe isn't axis aligned, but may worsen performance on lower end platforms.")] private bool useReflectionProbeRotation = true; diff --git a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl index b10860d604b..8d622ceb9a0 100644 --- a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl +++ b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl @@ -591,7 +591,8 @@ uint Select4(uint4 v, uint i) (((v.y & mask0) | (v.x & ~mask0)) & ~mask1); } -#if SHADER_TARGET < 45 +#if SHADER_TARGET < 45 && !defined UNITY_COMPILER_DXC +// Workaround is only technically required for GL Core <4.0 and GLES <3.1 uint URP_FirstBitLow(uint m) { // http://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightFloatCast diff --git a/Packages/com.unity.shadergraph/Documentation~/Blackboard.md b/Packages/com.unity.shadergraph/Documentation~/Blackboard.md index 6e66c3d15d3..22dc6a2c704 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Blackboard.md +++ b/Packages/com.unity.shadergraph/Documentation~/Blackboard.md @@ -3,7 +3,7 @@ ## Description You can use the Blackboard to define, order, and categorize the [Properties](Property-Types.md) and [Keywords](Keywords.md) in a graph. From the Blackboard, you can also edit the path for the selected Shader Graph Asset or Sub Graph. -![image](images/blackboardcategories1.png) +![The blackboard layout with properties, keywords, and categories.](images/blackboardcategories1.png) ## Accessing the Blackboard The Blackboard is visible by default, and you cannot drag it off the graph and lose it. However, you are able to position it anywhere in the [Shader Graph Window](Shader-Graph-Window.md). It always maintains the same distance from the nearest corner, even if you resize the window. @@ -42,8 +42,6 @@ To make the properties in your shader more discoverable, organize them into cate ### Adding, removing, and reordering properties and keywords * To add a property or keyword to a category, expand the category with the foldout (⌄) symbol, then drag and drop the property or keyword onto the expanded category. -![image](images/blackboardcategories2.png) - * To remove a property or keyword, select it and press **Delete**, or right-click and select **Delete**. * To re-order properties or keywords, drag and drop them within a category or move them into other categories. @@ -66,9 +64,6 @@ To copy a specific set of properties: ### Using categories in the Material Inspector To modify a material you have created with a Shader Graph, you can adjust specific property or keyword values in the Material Inspector, or edit the graph itself. -![image](images/blackboardcategories3.png) - - #### Working with Streaming Virtual Textures [Streaming Virtual Texture Properties](https://docs.unity3d.com/Documentation/Manual/svt-use-in-shader-graph.html) sample texture layers. To access these layers in the Material Inspector, expand the relevant **Virtual Texture** section with the ⌄ symbol next to its name. You can add and remove layers via the Inspector. diff --git a/Packages/com.unity.shadergraph/Documentation~/Block-Node.md b/Packages/com.unity.shadergraph/Documentation~/Block-Node.md index 0b8090b83b7..b98826160a4 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Block-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Block-Node.md @@ -26,6 +26,4 @@ If you disable **Automatically Add or Remove Blocks**, Shader Graph doesn't auto Active Block nodes are Blocks that contribute to the final shader. Inactive Block nodes are Blocks that are present in the Shader Graph, but don't contribute to the final shader. -![image](images/Active-Inactive-Blocks.png) - When you change the graph settings, certain Blocks might become active or inactive. Inactive Block nodes and any node streams that are connected only to Inactive Block nodes appear grayed out. diff --git a/Packages/com.unity.shadergraph/Documentation~/Boolean-Node.md b/Packages/com.unity.shadergraph/Documentation~/Boolean-Node.md index 2ff09735709..40196324ee1 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Boolean-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Boolean-Node.md @@ -6,15 +6,15 @@ Defines a constant **Boolean** value in the [Shader Graph](index.md), although i ## Ports -| Name | Direction | Type | Binding | Description | -|:------------ |:-------------|:-----|:---|:---| -| Out | Output | Boolean | None | Output value | +| Name | Direction | Type | Binding | Description | +|:--- |:---|:---|:---|:---| +| Out | Output | Boolean | None | Output value | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Toggle | | Defines the output value. | +| Control | Description | +|:---|:---| +| (Checkbox) | Defines the output value. | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Channel-Mixer-Node.md b/Packages/com.unity.shadergraph/Documentation~/Channel-Mixer-Node.md index 5fba552c278..d45d90c2953 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Channel-Mixer-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Channel-Mixer-Node.md @@ -6,19 +6,19 @@ Controls the amount each of the channels of input **In** contribute to each of t ## Ports -| Name | Direction | Type | Binding | Description | -|:------------ |:-------------|:-----|:---|:---| -| In | Input | Vector 3 | None | Input value | -| Out | Output | Vector 3 | None | Output value | +| Name | Direction | Type | Binding | Description | +|:---|:---|:---|:---|:---| +| In | Input | Vector 3 | None | Input value | +| Out | Output | Vector 3 | None | Output value | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Toggle Button Array | R, G, B | Selects the output channel to edit. | -| R | Slider | | Controls contribution of input red channel to selected output channel. | -| G | Slider | | Controls contribution of input green channel to selected output channel. | -| B | Slider | | Controls contribution of input blue channel to selected output channel. | +| Control | Description | +|:---|:---| +| **R**, **G**, **B** (toggle buttons) | Selects the output channel to edit with the sliders. | +| **R** (slider) | Controls the contribution of the input red channel to the selected output channel. | +| **G** (slider) | Controls the contribution of the input green channel to the selected output channel. | +| **B** (slider) | Controls the contribution of the input blue channel to the selected output channel. | ## Shader Function diff --git a/Packages/com.unity.shadergraph/Documentation~/Color-Node.md b/Packages/com.unity.shadergraph/Documentation~/Color-Node.md index 5405913ea97..ba9dcb722d4 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Color-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Color-Node.md @@ -8,16 +8,16 @@ NOTE: In versions prior to 10.0, Shader Graph assumed that HDR colors from the C ## Ports -| Name | Direction | Type | Binding | Description | -|:------------ |:-------------|:-----|:---|:---| -| Out | Output | Vector 4 | None | Output value | +| Name | Direction | Type | Binding | Description | +|:--- |:---|:---|:---|:---| +| Out | Output | Vector 4 | None | Output value | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Color | | Defines the output value. | -| Mode | Dropdown | Default, HDR | Sets properties of the Color field | +| Control | Description | +|:---|:---| +| (Color) | Defines the output value. | +| **Mode** | Sets properties of the Color field. The options are:
  • **Default**
  • **HDR**
| ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Comparison-Node.md b/Packages/com.unity.shadergraph/Documentation~/Comparison-Node.md index e0424ea5ac4..34a352b124e 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Comparison-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Comparison-Node.md @@ -6,17 +6,17 @@ Compares the two input values **A** and **B** based on the condition selected on ## Ports -| Name | Direction | Type | Binding | Description | -|:------------ |:-------------|:-----|:---|:---| -| A | Input | Float | None | First input value | -| B | Input | Float | None | Second input value | -| Out | Output | Boolean | None | Output value | +| Name | Direction | Type | Binding | Description | +|:--- |:---|:---|:---|:---| +| A | Input | Float | None | First input value | +| B | Input | Float | None | Second input value | +| Out | Output | Boolean | None | Output value | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Dropdown | Equal, NotEqual, Less, LessOrEqual, Greater, GreaterOrEqual | Condition for comparison | +| Control | Description | +|:---|:---| +| (Dropdown) | Select the condition for comparison between A and B. The options are:
  • **Equal**
  • **NotEqual**
  • **Less**
  • **LessOrEqual**
  • **Greater**
  • **GreaterOrEqual**
| ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Cubemap-Asset-Node.md b/Packages/com.unity.shadergraph/Documentation~/Cubemap-Asset-Node.md index 7afa17f55f2..1b8a40870a6 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Cubemap-Asset-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Cubemap-Asset-Node.md @@ -6,12 +6,12 @@ Defines a constant **Cubemap Asset** for use in the shader. To sample the **Cube ## Ports -| Name | Direction | Type | Binding | Description | -|:------------ |:-------------|:-----|:---|:---| -| Out | Output | Cubemap | None | Output value | +| Name | Direction | Type | Binding | Description | +|:--- |:---|:---|:---|:---| +| Out | Output | Cubemap | None | Output value | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Object Field (Cubemap) | | Defines the cubemap asset from the project. | +| Control | Description | +|:--- |:---| +| (Cubemap)| Defines the cubemap asset from the project. | diff --git a/Packages/com.unity.shadergraph/Documentation~/Dielectric-Specular-Node.md b/Packages/com.unity.shadergraph/Documentation~/Dielectric-Specular-Node.md index ab06b823c35..969c297fd12 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Dielectric-Specular-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Dielectric-Specular-Node.md @@ -10,17 +10,17 @@ You can use **Custom** material type to define your own physically based materia ## Ports -| Name | Direction | Type | Binding | Description | -|:------------ |:-------------|:-----|:---|:---| -| Out | Output | Float | None | Output value | +| Name | Direction | Type | Binding | Description | +|:--- |:---|:---|:---|:---| +| Out | Output | Float | None | Output value | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| Material | Dropdown | Common, RustedMetal, Water, Ice, Glass, Custom | Selects the material value to output. | -| Range | Slider | | Controls output value for **Common** material type. | -| IOR | Slider | | Controls index of refraction for **Custom** material type. | +| Control | Description | +|:---|:---| +| **Material** | Selects the material value to output. The options are:
  • **Common**
  • **RustedMetal**
  • **Water**
  • **Ice**
  • **Glass**
  • **Custom**
| +| **Range** | Controls the output value for a **Common** material type. | +| **IOR** | Controls the index of refraction for a **Custom** material type. | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Fresnel-Equation-Node.md b/Packages/com.unity.shadergraph/Documentation~/Fresnel-Equation-Node.md index e6ed9badb8c..d5aeeefed59 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Fresnel-Equation-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Fresnel-Equation-Node.md @@ -35,9 +35,9 @@ You can find Numerical values of refractive indices at [refractiveindex.info](ht ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| Mode | Dropdown | • **Schlick**: This mode produces an approximation based on [Schlick's Approximation](https://en.wikipedia.org/wiki/Schlick%27s_approximation). Use the Schlick mode for interactions between air and dielectric materials.
• **Dielectric**: Use this mode for interactions between two dielectric Materials. For example, air to glass, glass to water, or water to air.
• **DielectricGeneric**: This mode computes a [Fresnel equation](https://seblagarde.wordpress.com/2013/04/29/memo-on-fresnel-equations) for interactions between a dielectric and a metal. For example, clear-coat- to metal, glass to metal, or water to metal.
**Note:** if the **IORMediumK** value is 0, **DielectricGeneric** behaves in the same way as the **Dielectric** mode. || +| Control | Description | +|:---|:---| +| **Mode** | Select an equation mode to affect Material interactions to the Fresnel Component. The options are:
  • **Schlick**: This mode produces an approximation based on [Schlick's Approximation](https://en.wikipedia.org/wiki/Schlick%27s_approximation). Use the Schlick mode for interactions between air and dielectric materials.
  • **Dielectric**: Use this mode for interactions between two dielectric Materials. For example, air to glass, glass to water, or water to air.
  • **DielectricGeneric**: This mode computes a [Fresnel equation](https://seblagarde.wordpress.com/2013/04/29/memo-on-fresnel-equations) for interactions between a dielectric and a metal. For example, clear-coat- to metal, glass to metal, or water to metal.
**Note:** if the **IORMediumK** value is 0, **DielectricGeneric** behaves in the same way as the **Dielectric** mode. | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Gradient-Node.md b/Packages/com.unity.shadergraph/Documentation~/Gradient-Node.md index 5e0f92d1a7b..1c1ab010eaa 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Gradient-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Gradient-Node.md @@ -6,15 +6,15 @@ Defines a constant **Gradient** for use in [Shader Graph](index.md), although in ## Ports -| Name | Direction | Type | Description | -|:------------ |:-------------|:-----|:---| -| Out | Output | Gradient | Output value | +| Name | Direction | Type | Description | +|:--- |:---|:---|:---| +| Out | Output | Gradient | Output value | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Gradient Field | | Defines the gradient. | +| Control | Description | +|:---|:---| +| (Gradient Field) | Defines the gradient. | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Graph-Target.md b/Packages/com.unity.shadergraph/Documentation~/Graph-Target.md index 05e4feb18b6..d843d493b6f 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Graph-Target.md +++ b/Packages/com.unity.shadergraph/Documentation~/Graph-Target.md @@ -2,8 +2,6 @@ A Target determines the end point compatibility of a shader you generate using Shader Graph. You can select Targets for each Shader Graph asset, and use the [Graph Settings Menu](Graph-Settings-Tab.md) to change the Targets. -![image](images/GraphSettings_Menu.png) - Targets hold information such as the required generation format, and variables that allow compatibility with different render pipelines or integration features like [Visual Effect Graph](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@latest). You can select any number of Targets for each Shader Graph asset. If a Target you select isn't compatible with other Targets you've already selected, an error message that explains the problem appears. Target Settings are specific to each Target, and can vary between assets depending on which Targets you've selected. Be aware that Universal Render Pipeline (URP) Target Settings and High Definition Render Pipeline (HDRP) Target Settings might change in future versions. diff --git a/Packages/com.unity.shadergraph/Documentation~/Integer-Node.md b/Packages/com.unity.shadergraph/Documentation~/Integer-Node.md index 017eacec8d6..e4a5dbff735 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Integer-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Integer-Node.md @@ -6,15 +6,15 @@ Defines a constant **Float** value in the shader using an **Integer** field. Can ## Ports -| Name | Direction | Type | Binding | Description | -|:------------ |:-------------|:-----|:---|:---| -| Out | Output | Float | None | Output value | +| Name | Direction | Type | Binding | Description | +|:--- |:---|:---|:---|:---| +| Out | Output | Float | None | Output value | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Integer | | Defines the output value. | +| Control | Description | +|:---|:---| +| (Integer) | Defines the output value. | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Internal-Inspector.md b/Packages/com.unity.shadergraph/Documentation~/Internal-Inspector.md index afd823e5887..54f4c97a9d6 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Internal-Inspector.md +++ b/Packages/com.unity.shadergraph/Documentation~/Internal-Inspector.md @@ -10,29 +10,29 @@ When you open a Shader Graph, the **Graph Inspector** displays the **[Graph Sett Select a node in the graph to display settings available for that node in the **Graph Inspector**. Settings available for that node appear in the **Node Settings** tab of the Graph Inspector. For example, if you select a Property node either in the graph or the [Blackboard](Blackboard.md), the **Node Settings** tab displays attributes of the Property that you can edit. -![](images/InternalInspectorBlackboardProperty.png) +![The Blackboard with a property selected, and the Graph Inspector showing the property settings.](images/InternalInspectorBlackboardProperty.png) Graph elements that currently work with the Graph Inspector: - [Properties](https://docs.unity3d.com/Manual/SL-Properties.html) - ![](images/InternalInspectorGraphProperty.png) + ![A property selected in the workspace, and the Graph Inspector showing the property settings.](images/InternalInspectorGraphProperty.png) - [Keywords](Keywords.md) - ![](images/keywords_enum.png) + ![The Blackboard with a keyword selected, and the Graph Inspector showing the keyword settings.](images/keywords_enum.png) - [Custom Function nodes](Custom-Function-Node.md) - ![](images/Custom-Function-Node-File.png) + ![A Custom Function node selected in the workspace, and the Graph Inspector showing the node settings.](images/Custom-Function-Node-File.png) - [Subgraph Output nodes](Sub-graph.md) - ![](images/Inspector-SubgraphOutput.png) + ![A subgraph output node selected in the workspace, and the Graph Inspector showing the node settings.](images/Inspector-SubgraphOutput.png) - [Per-node precision](Precision-Modes.md) - ![](images/Inspector-PerNodePrecision.png) + ![A node selected in the workspace, and the Graph Inspector showing the Precision setting.](images/Inspector-PerNodePrecision.png) Graph elements that currently do not work with the Graph Inspector: @@ -44,7 +44,3 @@ Graph elements that currently do not work with the Graph Inspector: ## Material Override Enabling the [Allow Material Override](surface-options.md) option in the Graph Settings makes it possible for you to override certain graph properties via the Material Inspector. - -![](images/materialoverride1.PNG) - -![](images/materialoverride2.PNG) diff --git a/Packages/com.unity.shadergraph/Documentation~/Master-Stack.md b/Packages/com.unity.shadergraph/Documentation~/Master-Stack.md index b0ffbb52f4f..442f31fa5e8 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Master-Stack.md +++ b/Packages/com.unity.shadergraph/Documentation~/Master-Stack.md @@ -4,12 +4,10 @@ The Master Stack is the end point of a Shader Graph that defines the final surface appearance of a shader. Your Shader Graph should always contain only one Master Stack. -![image](images/MasterStack_Populated.png) - The content of the Master Stack might change depending on the [Graph Settings](Graph-Settings-Tab.md) you select. The Master Stack is made up of Contexts, which contain [Block nodes](Block-Node.md). -## Contexts +![The Master Stack display, showing the Vertex and Fragment contexts populated with Block nodes.](images/MasterStack_Populated.png) -![image](images/MasterStack_Empty.png) +## Contexts The Master Stack contains two Contexts: Vertex and Fragment. These represent the two stages of a shader. Nodes that you connect to Blocks in the Vertex Context become part of the final shader's vertex function. Nodes that you connect to Blocks in the Fragment Context become part of the final shader's fragment (or pixel) function. If you connect any nodes to both Contexts, they are executed twice, once in the vertex function and then again in the fragment function. You can't cut, copy, or paste Contexts. diff --git a/Packages/com.unity.shadergraph/Documentation~/Matrix-2x2-Node.md b/Packages/com.unity.shadergraph/Documentation~/Matrix-2x2-Node.md index e796a580c14..b5fed26f801 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Matrix-2x2-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Matrix-2x2-Node.md @@ -6,15 +6,15 @@ Defines a constant **Matrix 2x2** value in the shader. ## Ports -| Name | Direction | Type | Binding | Description | -|:------------ |:-------------|:-----|:---|:---| -| Out | Output | Matrix 2 | None | Output value | +| Name | Direction | Type | Binding | Description | +|:--- |:---|:---|:---|:---| +| Out | Output | Matrix 2 | None | Output value | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Matrix 2x2 | | Sets output value | +| Control | Description | +|:---|:---| +| (Matrix 2x2) | Sets the matrix 2x2 output value. | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Matrix-3x3-Node.md b/Packages/com.unity.shadergraph/Documentation~/Matrix-3x3-Node.md index 03284e6b3f4..071fd6ac21b 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Matrix-3x3-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Matrix-3x3-Node.md @@ -6,15 +6,15 @@ Defines a constant **Matrix 3x3** value in the shader. ## Ports -| Name | Direction | Type | Binding | Description | -|:------------ |:-------------|:-----|:---|:---| -| Out | Output | Matrix 3 | None | Output value | +| Name | Direction | Type | Binding | Description | +|:--- |:---|:---|:---|:---| +| Out | Output | Matrix 3 | None | Output value | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Matrix 3x3 | | Sets output value | +| Control | Description | +|:---|:---| +| (Matrix 3x3) | Sets the matrix 3x3 output value. | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Matrix-4x4-Node.md b/Packages/com.unity.shadergraph/Documentation~/Matrix-4x4-Node.md index cd33295a17c..4d1ba1d3766 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Matrix-4x4-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Matrix-4x4-Node.md @@ -6,15 +6,15 @@ Defines a constant **Matrix 4x4** value in the shader. ## Ports -| Name | Direction | Type | Binding | Description | -|:------------ |:-------------|:-----|:---|:---| -| Out | Output | Matrix 4 | None | Output value | +| Name | Direction | Type | Binding | Description | +|:--- |:---|:---|:---|:---| +| Out | Output | Matrix 4 | None | Output value | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Matrix 4x4 | | Sets output value | +| Control | Description | +|:---|:---| +| (Matrix 4x4) | Sets the matrix 4x4 output value. | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Matrix-Construction-Node.md b/Packages/com.unity.shadergraph/Documentation~/Matrix-Construction-Node.md index b7a639342e2..42b2e7403fe 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Matrix-Construction-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Matrix-Construction-Node.md @@ -15,21 +15,21 @@ For example, connecting **Vector 2** type values to inputs **M0** and **M1** wil ## Ports -| Name | Direction | Type | Description | -|:------------ |:-------------|:-----|:---| -| M0 | Input | Vector 4 | First row or column | -| M1 | Input | Vector 4 | Second row or column | -| M2 | Input | Vector 4 | Third row or column | -| M3 | Input | Vector 4 | Fourth row or column | -| 4x4 | Output | Matrix 4x4 | Output as Matrix 4x4 | -| 3x3 | Output | Matrix 3x3 | Output as Matrix 3x3 | -| 2x2 | Output | Matrix 2x2 | Output as Matrix 2x2 | +| Name | Direction | Type | Description | +|:--- |:---|:---|:---| +| M0 | Input | Vector 4 | First row or column | +| M1 | Input | Vector 4 | Second row or column | +| M2 | Input | Vector 4 | Third row or column | +| M3 | Input | Vector 4 | Fourth row or column | +| 4x4 | Output | Matrix 4x4 | Output as Matrix 4x4 | +| 3x3 | Output | Matrix 3x3 | Output as Matrix 3x3 | +| 2x2 | Output | Matrix 2x2 | Output as Matrix 2x2 | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Dropdown | Row, Column | Selects how the output matrix should be filled | +| Control | Description | +|:---|:---| +| (Dropdown) | Selects how the output matrix should be filled. The options are:
  • **Row**: Input vectors specify matrix rows from top to bottom.
  • **Column**: Input vectors specify matrix columns from left to right.
| ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Matrix-Split-Node.md b/Packages/com.unity.shadergraph/Documentation~/Matrix-Split-Node.md index a0836b235d6..d0b82c8a50b 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Matrix-Split-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Matrix-Split-Node.md @@ -15,19 +15,19 @@ For example, connecting **Matrix 2x2** type to input **In** will return the corr ## Ports -| Name | Direction | Type | Description | -|:------------ |:-------------|:-----|:---| -| In | Input | Dynamic Matrix | Input value | -| M0 | Output | Dynamic Vector | First row or column | -| M1 | Output | Dynamic Vector | Second row or column | -| M2 | Output | Dynamic Vector | Third row or column | -| M3 | Output | Dynamic Vector | Fourth row or column | +| Name | Direction | Type | Description | +|:--- |:---|:---|:---| +| In | Input | Dynamic Matrix | Input value | +| M0 | Output | Dynamic Vector | First row or column | +| M1 | Output | Dynamic Vector | Second row or column | +| M2 | Output | Dynamic Vector | Third row or column | +| M3 | Output | Dynamic Vector | Fourth row or column | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Dropdown | Row, Column | Selects how the output vectors should be filled | +| Control | Description | +|:---|:---| +| (Dropdown) | Selects how the output vectors should be filled. The options are:
  • **Row**: Output vectors are composed of matrix rows from top to bottom.
  • **Column**: Output vectors are composed of matrix columns from left to right.
| ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Port-Bindings.md b/Packages/com.unity.shadergraph/Documentation~/Port-Bindings.md index c441a319273..7f48676d22f 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Port-Bindings.md +++ b/Packages/com.unity.shadergraph/Documentation~/Port-Bindings.md @@ -8,15 +8,15 @@ In practice this means that if no [Edge](Edge.md) is connected to the [Port](Por ## Port Bindings List -| Name | Data Type | Options | Description | -|:------------|:----------|:------------------|:------------| -| Bitangent | Vector 3 | | Vertex or fragment bitangent, label describes expected transform space | -| Color | Vector 4 | |RGBA Color picker | -| ColorRGB | Vector 3 | | RGB Color picker | -| Normal | Vector 3 | | Vertex or fragment normal vector, label describes expected transform space | -| Position | Vector 3 | | Vertex or fragment position, label describes expected transform space | -| Screen Position | Vector 4 | | Default, Raw, Center, Tiled | Vertex or fragment position in screen space. Dropdown selects mode. See [Screen Position Node](Screen-Position-Node.md) for details | -| Tangent | Vector 3 | | Vertex or fragment tangent vector, label describes expected transform space | -| UV | Vector 2 | | UV0, UV1, UV2, UV3 | Mesh UV coordinates. Dropdown selects UV channel. | -| Vertex Color | Vector 4 | | RGBA vertex color value. | -| View Direction | Vector 3 | | Vertex or fragment view direction vector, label describes expected transform space | +| Name | Data Type | Description | +|:---|:---|:---| +| Bitangent | Vector 3 | Vertex or fragment bitangent, label describes expected transform space | +| Color | Vector 4 |RGBA Color picker | +| ColorRGB | Vector 3 | RGB Color picker | +| Normal | Vector 3 | Vertex or fragment normal vector, label describes expected transform space | +| Position | Vector 3 | Vertex or fragment position, label describes expected transform space | +| Screen Position | Vector 4 | Default, Raw, Center, Tiled | Vertex or fragment position in screen space. Dropdown selects mode. See [Screen Position Node](Screen-Position-Node.md) for details | +| Tangent | Vector 3 | Vertex or fragment tangent vector, label describes expected transform space | +| UV | Vector 2 | UV0, UV1, UV2, UV3 | Mesh UV coordinates. Dropdown selects UV channel. | +| Vertex Color | Vector 4 | RGBA vertex color value. | +| View Direction | Vector 3 | Vertex or fragment view direction vector, label describes expected transform space | diff --git a/Packages/com.unity.shadergraph/Documentation~/Precision-Modes.md b/Packages/com.unity.shadergraph/Documentation~/Precision-Modes.md index 88a30a7003c..50cc3676d9c 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Precision-Modes.md +++ b/Packages/com.unity.shadergraph/Documentation~/Precision-Modes.md @@ -23,7 +23,7 @@ To visualize data precision in a graph, set the [**Color Mode**](Color-Modes.md) * **Half** nodes are red * **Switchable** nodes are Green. -![](images/Color-Mode-Precision.png) +![A graph showing nodes with different colors according to their data precision.](images/Color-Mode-Precision.png) ### Setting graph Precision To set the default precision for the entire graph to **Single** or **Half**, open the **Graph Settings** and set the Precision property. Newly-created nodes in a graph default to the **Inherit** precision mode, and inherit the graph's precision. @@ -51,7 +51,7 @@ Simple inheritance refers to the inheritance behaviour of a node with only one p In the figure below, Node A has the **Inherit** mode. Because it has no incoming edge, it takes the **Graph Precision**, which is **Half**. Node B also has the **Inherit** mode, so it inherits the **Half** precision mode from Node A. -![](images/precisionmodes1.png) +![Diagram showing a simple precision inheritance.](images/precisionmodes1.png) #### Complex inheritance @@ -61,7 +61,7 @@ A node reads precision settings from each input port. If you connect a node to s In the figure below, node D has the **Inherit** mode. It receives input from the adjacent edges via inputs 1 and 2. Node B passes the **Half** mode through input 1. Node C passes the **Single** mode through input 2. Because **Single** is 32-bit and **Half** only 16-bit, **Single** takes precedence, so Node D uses **Single** precision. -![](images/precisionmodes2.png) +![Diagram showing a complex precision inheritance.](images/precisionmodes2.png) #### Mixed inheritance @@ -69,13 +69,13 @@ Mixed inheritance refers to the inheritance behaviour on a node with both simple Nodes with no input ports, such as [Input nodes](Input-Nodes.md), inherit the **Graph Precision**. However, complex inheritance rules still affect other nodes in the same group, as illustrated in the figure below. -![](images/precisionmodes3.png) +![Diagram showing a mixed precision inheritance.](images/precisionmodes3.png) ### Switchable precision The **Switchable** mode overrides **Half** mode but not **Single**. -![](images/precisionmodes4.png) +![Diagram showing precision inheritance with the Switchable mode.](images/precisionmodes4.png) ### Sub Graph precision diff --git a/Packages/com.unity.shadergraph/Documentation~/Preview-Mode-Control.md b/Packages/com.unity.shadergraph/Documentation~/Preview-Mode-Control.md index a84d8c4d489..bf896cfda4f 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Preview-Mode-Control.md +++ b/Packages/com.unity.shadergraph/Documentation~/Preview-Mode-Control.md @@ -13,16 +13,16 @@ This mode control functionality also applies to Sub Graph previews. See [Graph S ## How to use For nodes: + 1. Add a node which includes a preview. 2. Select the node. 3. In the Graph Inspector or Node Settings, find the Preview control. 4. Select an option. - For SubGraphs: + * Select a mode in the [Sub Graph](Sub-graph.md) [Graph Settings](Graph-Settings-Tab.md) menu. -![](images/previewmodecontrol.png) +## Additional resources -Related -[Preview node](Preview-Node.md) +* [Preview node](Preview-Node.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Rectangle-Node.md b/Packages/com.unity.shadergraph/Documentation~/Rectangle-Node.md index 08ae33abe4d..b453bd94122 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Rectangle-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Rectangle-Node.md @@ -8,18 +8,18 @@ NOTE: This [Node](Node.md) can only be used in the **Fragment** [Shader Stage](S ## Ports -| Name | Direction | Type | Binding | Description | -|:------------ |:-------------|:-----|:---|:---| -| UV | Input | Vector 2 | UV | Input UV value | -| Width | Input | Float | None | Rectangle width | -| Height | Input | Float | None | Rectangle height | -| Out | Output | Float | None | Output value | +| Name | Direction | Type | Binding | Description | +|:--- |:---|:---|:---|:---| +| UV | Input | Vector 2 | UV | Input UV value | +| Width | Input | Float | None | Rectangle width | +| Height | Input | Float | None | Rectangle height | +| Out | Output | Float | None | Output value | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Dropdown | Fastest, Nicest | Robustness of computation | +| Control | Description | +|:---|:---| +| (Dropdown) | Select the robustness of computation. The options are:
  • **Fastest**
  • **Nicest**
| ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Refract-Node.md b/Packages/com.unity.shadergraph/Documentation~/Refract-Node.md index 8cb41cadb4d..f39b0b57576 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Refract-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Refract-Node.md @@ -25,9 +25,9 @@ The Refract node uses the principles described in [Snell's Law](https://en.wikip ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| Mode | Dropdown | • **Safe:** Returns a null vector result instead of a NaN result at the point of critical angle refraction.
• **CriticalAngle:** Avoids the **Safe** check for a potential NaN result. || +| Control | Description | +|:---|:---| +| **Mode** | Select a mode to handle results at the point of critical angle refraction. The options are:
  • **Safe:** Returns a null vector result instead of a NaN result at the point of critical angle refraction.
  • **CriticalAngle:** Avoids the **Safe** check for a potential NaN result.
| ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Window.md b/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Window.md index d49036d4740..c4f124860b7 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Window.md +++ b/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Window.md @@ -21,18 +21,16 @@ To access the **Shader Graph Window**, you must first create a [Shader Graph Ass Use the **Shader Graph Window** toolbar to manage the shader graph asset, display elements in the window, and more. -| Icon | Item | Description | -|:--------------------|:--------------------|:------------| -| ![Image](images/sg-save-icon.png) | **Save Asset** | Save the graph to update the [Shader Graph Asset](index.md). | -| ![Image](images/sg-dropdown-icon.png) | **Save As** | Save the [Shader Graph Asset](index.md) under a new name. | -| | **Show In Project** | Highlight the [Shader Graph Asset](index.md) in the [Project Window](https://docs.unity3d.com/Manual/ProjectView.html). | -| | **Check Out** | If version control is enabled, check out the [Shader Graph Asset](index.md) from the source control provider. | -| ![Image](images/sg-color-mode-selector.png) | **Color Mode Selector** | Select a [Color Mode](Color-Modes.md) for the graph. | -| ![Image](images/sg-blackboard-icon.png) | **Blackboard** | Toggle the visibility of the [Blackboard](Blackboard.md). | -| ![Image](images/sg-graph-inspector-icon.png) | **Graph Inspector** | Toggle the visibility of the [Graph Inspector](Internal-Inspector.md). | -| ![Image](images/sg-main-preview-icon.png) | **Main Preview** | Toggle the visibility of the [Main Preview](Main-Preview.md). | -| ![Image](images/sg-help_icon.png) | **Help** | Open the Shader Graph documentation in the browser. | -| ![Image](images/sg-dropdown-icon.png) | **Resources** | Contains links to Shader Graph resources (like samples and User forums). | +| Icon | Item | Description | +|:---|:---|:---| +| ![The Save Asset icon](images/sg-save-icon.png) | **Save Asset** | Save the graph to update the [Shader Graph Asset](index.md). | +| ![The asset file management icon](images/sg-dropdown-icon.png) | **Asset file management** | Use additional options to manage the graph asset file. The options are:
  • **Save As**: Save the [Shader Graph Asset](index.md) under a new name.
  • **Show In Project**: Highlight the [Shader Graph Asset](index.md) in the [Project Window](https://docs.unity3d.com/Manual/ProjectView.html).
  • **Check Out**: If version control is enabled, check out the [Shader Graph Asset](index.md) from the source control provider.
| +| ![The Color Mode Selector icon](images/sg-color-mode-selector.png) | **Color Mode Selector** | Select a [Color Mode](Color-Modes.md) for the graph. | +| ![The Blackboard icon](images/sg-blackboard-icon.png) | **Blackboard** | Toggle the visibility of the [Blackboard](Blackboard.md). | +| ![The Graph Inspector icon](images/sg-graph-inspector-icon.png) | **Graph Inspector** | Toggle the visibility of the [Graph Inspector](Internal-Inspector.md). | +| ![The Main Preview icon](images/sg-main-preview-icon.png) | **Main Preview** | Toggle the visibility of the [Main Preview](Main-Preview.md). | +| ![The Help icon](images/sg-help_icon.png) | **Help** | Open the Shader Graph documentation in the browser. | +| ![The Resources icon](images/sg-dropdown-icon.png) | **Resources** | Contains links to Shader Graph resources (like samples and User forums). | ## Workspace diff --git a/Packages/com.unity.shadergraph/Documentation~/ShaderGraph-Samples.md b/Packages/com.unity.shadergraph/Documentation~/ShaderGraph-Samples.md index 430755a769c..7dc00155b2d 100644 --- a/Packages/com.unity.shadergraph/Documentation~/ShaderGraph-Samples.md +++ b/Packages/com.unity.shadergraph/Documentation~/ShaderGraph-Samples.md @@ -22,41 +22,41 @@ The following samples are currently available for Shader Graph. | Procedural Patterns | |:--------------------| -|![](images/Patterns_Page.png) | +|![A visual overview of Procedural Patterns](images/Patterns_Page.png) | | This collection of Assets showcases various procedural techniques possible with Shader Graph. Use them directly in your Project, or edit them to create other procedural patterns. The patterns in this collection are: Bacteria, Brick, Dots, Grid, Herringbone, Hex Lattice, Houndstooth, Smooth Wave, Spiral, Stripes, Truchet, Whirl, Zig Zag. | | Node Reference | |:--------------------| -|![](images/NodeReferenceSamples.png) | +|![A visual overview of Node Reference](images/NodeReferenceSamples.png) | | This set of Shader Graph assets provides reference material for the nodes available in the Shader Graph node library. Each graph contains a description for a specific node, examples of how it can be used, and useful tips. Some example assets also show a break-down of the math that the node is doing. You can use these samples along with the documentation to learn more about the behavior of individual nodes. | | [Feature Examples](Shader-Graph-Sample-Feature-Examples.md) | |:--------------------| -|![](images/FeatureExamplesSample.png) | +|![A visual overview of Feature Examples](images/FeatureExamplesSample.png) | | This is a collection of over 30 Shader Graph files. Each file demonstrates a specific shader technique such as angle blending, triplanar projection, parallax mapping, and custom lighting. While you won’t use these shaders directly in your project, you can use them to quickly learn and understand the various techniques, and recreate them into your own work. Each file contains notes that describe what the shader is doing, and most of the shaders are set up with the core functionality contained in a subgraph that’s easy to copy and paste directly into your own shader. The sample also has extensive documentation describing each of the samples to help you learn. | [Production Ready Shaders](Shader-Graph-Sample-Production-Ready.md) | |:--------------------| -|![](images/ProductionReadySample.png) | +|![A visual example of Production Ready Shaders](images/ProductionReadySample.png) | | The Shader Graph Production Ready Shaders sample is a collection of Shader Graph shader assets that are ready to be used out of the box or modified to suit your needs. You can take them apart and learn from them, or just drop them directly into your project and use them as they are. The sample includes the Shader Graph versions of the HDRP and URP Lit shaders. It also includes a step-by-step tutorial for how to combine several of the shaders to create a forest stream environment. | [UGUI Shaders](Shader-Graph-Sample-UGUI-Shaders.md) | |:--------------------| -|![](images/UIToolsSample.png) | +|![A visual example of UGUI Shaders](images/UIToolsSample.png) | | The Shader Graph UGUI Shaders sample is a collection of Shader Graph subgraphs that you can use to build user interface elements. They speed up the process of building widgets, buttons, and backgrounds for the user interface of your project. With these tools, you can build dynamic, procedural UI elements that don’t require any texture memory and scale correctly for any resolution screen. In addition to the subgraphs, the sample also includes example buttons, indicators, and backgrounds built with the subgraphs. The examples show how the subgraphs function in context and help you learn how to use them. | Custom Material Property Drawers | |:--------------------| -|![](images/CustomMaterialPropertySample.png) | +|![An example result of Custom Material Property Drawers in a material's Inspector](images/CustomMaterialPropertySample.png) | | This sample contains an example of a Custom Material Property Drawer that allows using a Min/Max Slider to control a Vector2 x and y values, often used for range remapping. It comes with a documented Shader Graph example. | | [Custom Lighting](Shader-Graph-Sample-Custom-Lighting.md) | |:--------------------| -|![](images/CustomLightingSample.png) | +|![A visual example of Custom Lighting](images/CustomLightingSample.png) | | The Shader Graph Custom Lighting sample shows how you can create your own custom lighting model in Shader Graph and provides dozens of example templates, shaders, and subgraphs to help you get started with your own custom lighting. | [Terrain Shaders](Shader-Graph-Sample-Terrain-Shaders.md) | |:--------------------| -|![](images/TerrainSample.png) | +|![A visual overview of Terrain Shaders](images/TerrainSample.png) | | The Shader Graph Terrain Sample provides example shaders to learn from and subgraphs that you can use to build your own terrain shaders. Custom terrain shaders can use more advanced features like hexagon tile break-up, parallax occlusion mapping, or triplanar projection. Or you can use techniques like array texture sampling or alternate texture packing methods to make the shader cheaper to render than the default one. Whether you're making faster or more advanced terrain shaders, this sample will help you get the results you're looking for. | diff --git a/Packages/com.unity.shadergraph/Documentation~/Slider-Node.md b/Packages/com.unity.shadergraph/Documentation~/Slider-Node.md index 593c76aebad..7cd0030551c 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Slider-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Slider-Node.md @@ -6,17 +6,17 @@ Defines a constant **Float** value in the shader using a **Slider** field. Can b ## Ports -| Name | Direction | Type | Binding | Description | -|:------------ |:-------------|:-----|:---|:---| -| Out | Output | Float | None | Output value | +| Name | Direction | Type | Binding | Description | +|:--- |:---|:---|:---|:---| +| Out | Output | Float | None | Output value | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Slider | | Defines the output value. | -| Min | Float | | Defines the slider parameter's minimum value. | -| Max | Float | | Defines the slider parameter's maximum value. | +| Name | Type | Options | Description | +|:--- |:---|:---|:---| +| | Slider | | Defines the output value. | +| Min | Float | | Defines the slider parameter's minimum value. | +| Max | Float | | Defines the slider parameter's maximum value. | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Split-Texture-Transform-Node.md b/Packages/com.unity.shadergraph/Documentation~/Split-Texture-Transform-Node.md index e63a7294c5c..6a619f89c58 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Split-Texture-Transform-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Split-Texture-Transform-Node.md @@ -7,7 +7,7 @@ This node outputs the texture with its tiling set to (0,0) and scale set to (1,1 Another term you may hear for tiling in this context is scale. Both terms refer to the size of the texture tiles. -![](images/node-splittexturetransform.png) +![The Split Texture Transform node](images/node-splittexturetransform.png) ### Ports diff --git a/Packages/com.unity.shadergraph/Documentation~/Sticky-Notes.md b/Packages/com.unity.shadergraph/Documentation~/Sticky-Notes.md index bb391f76915..ab0f3ffb3f2 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Sticky-Notes.md +++ b/Packages/com.unity.shadergraph/Documentation~/Sticky-Notes.md @@ -13,8 +13,6 @@ To create a Sticky Note, right-click an empty space in the graph view and, in th * **Title**: The text area at the top of the Sticky Note is the title. You can use it to concisely describe what information the Sticky Note contains. * **Body**: The larger text area below the title area is the body. You can write the full contents of the note here. -![](images/StickyNote.png) - ### Editing text To edit text on a Sticky Note, double-click on a text area. This also selects the entire text area, so be sure to move the cursor before you edit the text. diff --git a/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md b/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md index 17083ee1ac5..93467ed6904 100644 --- a/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md +++ b/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md @@ -121,7 +121,7 @@ * [Gradient](Gradient-Node.md) * [Sample Gradient](Sample-Gradient-Node.md) * High Definition Render Pipeline - * [Custom Color Buffer](HD-Custom-Color-Node.md) + * [Custom Color Buffer](Custom-Color-Buffer-Node.md) * [Custom Depth Buffer](HD-Custom-Depth-Node.md) * [Diffusion Profile](Diffusion-Profile-Node.md) * [Exposure](Exposure-Node.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Texture-2D-Array-Asset-Node.md b/Packages/com.unity.shadergraph/Documentation~/Texture-2D-Array-Asset-Node.md index 37120cce91a..b9eda3a25ff 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Texture-2D-Array-Asset-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Texture-2D-Array-Asset-Node.md @@ -6,15 +6,15 @@ Defines a constant **Texture 2D Array Asset** for use in the shader. To sample t ## Ports -| Name | Direction | Type | Description | -|:------------ |:-------------|:-----|:---| -| Out | Output | Texture 2D Array | Output value | +| Name | Direction | Type | Description | +|:--- |:---|:---|:---| +| Out | Output | Texture 2D Array | Output value | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Object Field (Texture 2D Array) | | Defines the texture 2D array asset from the project. | +| Control | Description | +|:--- |:---| +| (Texture 2D Array) | Defines the texture 2D array asset from the project. | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Texture-2D-Asset-Node.md b/Packages/com.unity.shadergraph/Documentation~/Texture-2D-Asset-Node.md index 76f924e8b40..8868ed3c05b 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Texture-2D-Asset-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Texture-2D-Asset-Node.md @@ -6,15 +6,15 @@ Defines a constant **Texture 2D Asset** for use in the shader. To sample the **T ## Ports -| Name | Direction | Type | Description | -|:------------ |:-------------|:-----|:---| -| Out | Output | Texture 2D | Output value | +| Name | Direction | Type | Description | +|:--- |:---|:---|:---| +| Out | Output | Texture 2D | Output value | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Object Field (Texture) | | Defines the texture 3D asset from the project. | +| Control | Description | +|:--- |:---| +| (Texture) | Defines the texture 3D asset from the project. | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Texture-3D-Asset-Node.md b/Packages/com.unity.shadergraph/Documentation~/Texture-3D-Asset-Node.md index 82bbddd03b9..efa5a10b0b7 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Texture-3D-Asset-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Texture-3D-Asset-Node.md @@ -6,15 +6,15 @@ Defines a constant **Texture 3D Asset** for use in the shader. To sample the **T ## Ports -| Name | Direction | Type | Description | -|:------------ |:-------------|:-----|:---| -| Out | Output | Texture 3D | Output value | +| Name | Direction | Type | Description | +|:--- |:---|:---|:---| +| Out | Output | Texture 3D | Output value | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Object Field (Texture 3D) | | Defines the texture 3D asset from the project. | +| Control | Description | +|:--- |:---| +| (Texture 3D) | Defines the texture 3D asset from the project. | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/ThreadMapDetail-Node.md b/Packages/com.unity.shadergraph/Documentation~/ThreadMapDetail-Node.md index 2594ce32ebf..c765cd3af94 100644 --- a/Packages/com.unity.shadergraph/Documentation~/ThreadMapDetail-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/ThreadMapDetail-Node.md @@ -26,131 +26,30 @@ The ThreadMapDetail node is under the **Utility** > **High Definition Render [!include[nodes-inputs](./snippets/nodes-inputs.md)] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeBindingDescription
Use Thread MapBooleanNoneUse the port's default input to enable or disable the ThreadMapDetail node. You can also connect a node that outputs a Boolean to choose when to enable or disable the thread map.
ThreadMapTexture 2DNoneThe texture that contains the detailed information of a fabric's thread pattern. The texture should contain 4 channels: -
    -
  • R - The ambient occlusion
  • -
  • G - The normal Y-axis
  • -
  • B - The smoothness
  • -
  • A - The normal X-axis
  • -
-
UVVector 2UVThe UV coordinates the ThreadMapDetail node should use to map the ThreadMap texture on the geometry.
NormalsVector 3NoneThe base normal map that you want your Shader Graph to apply to the geometry before it applies the thread map.
SmoothnessFloatNoneThe base smoothness value that you want your Shader Graph to apply to the geometry before it applies the thread map.
AlphaFloatNoneThe base alpha value that you want your Shader Graph to apply to the geometry before it applies the thread map.
Ambient OcclusionFloatNoneThe base ambient occlusion value that you want your Shader Graph to apply to the geometry before it applies the thread map.
Thread AO StrengthFloatNoneSpecify a value of 0 or 1 to determine how the ThreadMap's ambient occlusion should impact the final shader result: -
    -
  • If you provide a value of 0, the ThreadMap's ambient occlusion has no effect on the final output of the shader.
  • -
  • If you provide a value of 1, Shader Graph multiplies your base Ambient Occlusion value by the ambient occlusion value specified in your ThreadMap to determine the final output of the shader.
Thread Normal StrengthFloatNoneSpecify a value of 0 or 1 to determine how the ThreadMap's normal should impact the final shader result: -
    -
  • If you provide a value of 0, the ThreadMap's normal has no effect on the final output of the shader.
  • -
  • If you provide a value of 1, Shader Graph blends the values from your base Normals with the normal specified in your ThreadMap to determine the final output of the shader.
Thread Smoothness StrengthFloatNoneSpecify a value of 0 or 1 to determine how the ThreadMap's smoothness should impact the final shader result: -
    -
  • If you provide a value of 0, the ThreadMap's smoothness value has no effect on the final output of the shader.
  • -
  • If you provide a value of 1, Shader Graph adds the smoothness value specified in your ThreadMap to your base Smoothness value to determine the final output of the shader. For this calculation, Shader Graph remaps the value of your ThreadMap's smoothness from (0,1) to (-1, 1).
+| **Name** | **Type** | **Binding** | **Description** | +| :--- | :--- | :--- | :--- | +| **Use Thread Map** | Boolean | None | Use the port's default input to enable or disable the ThreadMapDetail node. You can also connect a node that outputs a Boolean to choose when to enable or disable the thread map. | +| **ThreadMap** | Texture 2D | None | The texture that contains the detailed information of a fabric's thread pattern. The texture should contain 4 channels:
  • R - The ambient occlusion
  • G - The normal Y-axis
  • B - The smoothness
  • A - The normal X-axis | +| **UV** | Vector 2 | UV | The UV coordinates the ThreadMapDetail node should use to map the ThreadMap texture on the geometry. | +| **Normals** | Vector 3 | None | The base normal map that you want your Shader Graph to apply to the geometry before it applies the thread map. | +| **Smoothness** | Float | None | The base smoothness value that you want your Shader Graph to apply to the geometry before it applies the thread map. | +| **Alpha** | Float | None | The base alpha value that you want your Shader Graph to apply to the geometry before it applies the thread map. | +| **Ambient Occlusion** | Float | None | The base ambient occlusion value that you want your Shader Graph to apply to the geometry before it applies the thread map. | +| **Thread AO Strength** | Float | None | Specify a value of `0` or `1` to determine how the **ThreadMap**'s ambient occlusion should impact the final shader result:
    • If you provide a value of `0`, the **ThreadMap**'s ambient occlusion has no effect on the final output of the shader.
    • If you provide a value of `1`, Shader Graph multiplies your base **Ambient Occlusion** value by the ambient occlusion value specified in your **ThreadMap** to determine the final output of the shader.
    | +| **Thread Normal Strength** | Float | None | Specify a value of `0` or `1` to determine how the **ThreadMap**'s normal should impact the final shader result:
    • If you provide a value of `0`, the **ThreadMap**'s normal has no effect on the final output of the shader.
    • If you provide a value of `1`, Shader Graph blends the values from your base **Normals** with the normal specified in your **ThreadMap** to determine the final output of the shader.
    | +| **Thread Smoothness Strength** | Float | None | Specify a value of `0` or `1` to determine how the **ThreadMap**'s smoothness should impact the final shader result:
    • If you provide a value of `0`, the **ThreadMap**'s smoothness value has no effect on the final output of the shader.
    • If you provide a value of `1`, Shader Graph adds the smoothness value specified in your **ThreadMap** to your base **Smoothness** value to determine the final output of the shader. For this calculation, Shader Graph remaps the value of your **ThreadMap**'s smoothness from (0,1) to (-1, 1).
    | + ## Outputs [!include[nodes-outputs](./snippets/nodes-outputs.md)] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    NormalVector 3The final normal output of the thread map.
    SmoothnessFloatThe final smoothness output of the thread map.
    Ambient OcclusionFloatThe final ambient occlusion output of the thread map.
    AlphaFloatThe final alpha output of the thread map. Shader Graph calculates this alpha value by multiplying the input Alpha value by the Thread AO Strength value.
    - +| **Name** | **Type** | **Description** | +| :--- | :--- | :--- | +| **Normal** | Vector 3 | The final normal output of the thread map. | +| **Smoothness** | Float | The final smoothness output of the thread map. | +| **Ambient Occlusion** | Float | The final ambient occlusion output of the thread map. | +| **Alpha** | Float | The final alpha output of the thread map. Shader Graph calculates this alpha value by multiplying the input **Alpha** value by the **Thread AO Strength** value. | ## Example graph usage diff --git a/Packages/com.unity.shadergraph/Documentation~/Transformation-Matrix-Node.md b/Packages/com.unity.shadergraph/Documentation~/Transformation-Matrix-Node.md index ee997ec2e0c..6031cfed947 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Transformation-Matrix-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Transformation-Matrix-Node.md @@ -9,15 +9,15 @@ Two output value options for this node, **Inverse Projection** and **Inverse Vie ## Ports -| Name | Direction | Type | Binding | Description | -|:------------ |:-------------|:-----|:---|:---| -| Out | Output | Matrix 4 | None | Output value | +| Name | Direction | Type | Binding | Description | +|:--- |:---|:---|:---|:---| +| Out | Output | Matrix 4 | None | Output value | ## Controls -| Name | Type | Options | Description | -|:------------ |:-------------|:-----|:---| -| | Dropdown | Model, InverseModel, View, InverseView, Projection, InverseProjection, ViewProjection, InverseViewProjection | Sets output value | +| Control | Description | +|:--- |:---| +| (Dropdown) | Sets the output value. The options are:
    • **Model**
    • **InverseModel**
    • **View**
    • **InverseView**
    • **Projection**
    • **InverseProjection**
    • **ViewProjection**
    • **InverseViewProjection**
    | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/UVCombine-Node.md b/Packages/com.unity.shadergraph/Documentation~/UVCombine-Node.md index 2765c04641e..0382d1ecc90 100644 --- a/Packages/com.unity.shadergraph/Documentation~/UVCombine-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/UVCombine-Node.md @@ -22,63 +22,18 @@ The UVCombine node is under the **Utility** > **High Definition Render Pipeli [!include[nodes-inputs](./snippets/nodes-inputs.md)] - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    UV Channel MaskVector 4Select which UV channel you want to use for your UV coordinates by entering a 1 in the corresponding default input on the port: -
      -
    • X: UV channel 0
    • -
    • Y: UV channel 1
    • -
    • Z: UV channel 2
    • -
    • W: UV channel 3
    • -
    -Set all other default inputs to 0. You can also connect a node that outputs a Vector 4.
    UV Tile and OffsetVector 4Use the port's default input to specify the amount of offset or tiling that you want to apply to your shader's UV coordinates: -
      -
    • Use X and Y to specify the tiling.
    • -
    • Use W and Z to specify the offset.
    • -
    -You can also connect a node that outputs a Vector 4.
    - +| **Name** | **Type** | **Description** | +| :--- | :--- | :--- | +| **UV Channel Mask** | Vector 4 | Select which UV channel you want to use for your UV coordinates by entering a `1` in the corresponding default input on the port:
    • **X**: UV channel 0
    • **Y**: UV channel 1
    • **Z**: UV channel 2
    • **W**: UV channel 3
    Set all other default inputs to `0`. You can also connect a node that outputs a Vector 4. | +| **UV Tile and Offset** | Vector 4 | Use the port's default input to specify the amount of offset or tiling that you want to apply to your shader's UV coordinates:
    • Use **X** and **Y** to specify the tiling.
    • Use **W** and **Z** to specify the offset.
    You can also connect a node that outputs a Vector 4. | ## Outputs [!include[nodes-single-output](./snippets/nodes-single-output.md)] - - - - - - - - - - - - - - - - - -
    NameTypeBindingDescription
    UVVector 2UVThe final UV output, after selecting a UV channel and, if specified, any tiling or offset.
    +| **Name** | **Type** | **Binding** | **Description** | +| :--- | :--- | :--- | :--- | +| **UV** | Vector 2 | UV | The final UV output, after selecting a UV channel and, if specified, any tiling or offset. | ## Example graph usage diff --git a/Packages/com.unity.shadergraph/Documentation~/Upgrade-Guide-10-0-x.md b/Packages/com.unity.shadergraph/Documentation~/Upgrade-Guide-10-0-x.md index 279ad68de72..58970b742a8 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Upgrade-Guide-10-0-x.md +++ b/Packages/com.unity.shadergraph/Documentation~/Upgrade-Guide-10-0-x.md @@ -47,7 +47,7 @@ In HDRP, settings from the PBR and Unlit Master Nodes are not the same as the HD Previously, you could right-click the Master Node to bring up a context menu, and select **View Generated Shader** to preview the generated shader. In 10.0, you must now use the Unity Inspector, and click the **View Generated Shader** button on the Shader Graph asset. -![image](images/GeneratedShaderButton.png) +![The Inspector window showing the View Generated Shader button among other options.](images/GeneratedShaderButton.png) ## Settings in Graph Inspector @@ -89,14 +89,14 @@ Previously, some nodes and properties such as the [Color Node](Color-Node.md) di For deprecated nodes, **(Deprecated)** appears after the node title in the main graph view. -![image](images/DeprecatedColorNode.png) +![The deprecated Color node, as an example.](images/DeprecatedColorNode.png) For deprecated properties, **(Deprecated)** appears after the property name in the [Blackboard](Blackboard.md). -![image](images/DeprecatedColorProperty.png) +![The deprecated Color property in the blackboard, as an example.](images/DeprecatedColorProperty.png) -When you select a deprecated node or property, a warning appears in the [Internal Inspector](Internal-Inspector.md) along with an **Update** button that allows you to upgrade the selection. You can use undo/redo to reverse this upgrade process. +When you select a deprecated node or property, a warning appears in the [Graph Inspector](Internal-Inspector.md) along with an **Update** button that allows you to upgrade the selection. You can use undo/redo to reverse this upgrade process. -![image](images/DeprecatedWarning.png) +![The deprecation message as it appears in the Graph Inspector.](images/DeprecatedWarning.png) If you enable **Allow Deprecated Behaviors** in [Shader Graph Preferences](Shader-Graph-Preferences.md), Shader Graph displays the version of the deprecated node or property, and doesn't display any warnings even though the **Update** button appears. You can also use the Blackboard or Searcher to create deprecated nodes and properties. diff --git a/Packages/com.unity.shadergraph/Documentation~/images/Active-Inactive-Blocks.PNG b/Packages/com.unity.shadergraph/Documentation~/images/Active-Inactive-Blocks.PNG deleted file mode 100644 index a2ecc44f2d1..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/Active-Inactive-Blocks.PNG and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MasterStack_Empty.png b/Packages/com.unity.shadergraph/Documentation~/images/MasterStack_Empty.png deleted file mode 100644 index 499a568793b..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MasterStack_Empty.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/StickyNote.png b/Packages/com.unity.shadergraph/Documentation~/images/StickyNote.png deleted file mode 100644 index 6a875d27f3b..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/StickyNote.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/blackboardcategories2.png b/Packages/com.unity.shadergraph/Documentation~/images/blackboardcategories2.png deleted file mode 100644 index 75b2c782696..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/blackboardcategories2.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/blackboardcategories3.png b/Packages/com.unity.shadergraph/Documentation~/images/blackboardcategories3.png deleted file mode 100644 index e98f64db601..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/blackboardcategories3.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/materialoverride1.PNG b/Packages/com.unity.shadergraph/Documentation~/images/materialoverride1.PNG deleted file mode 100644 index aaccae4879a..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/materialoverride1.PNG and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/materialoverride2.PNG b/Packages/com.unity.shadergraph/Documentation~/images/materialoverride2.PNG deleted file mode 100644 index 4f6b6d33b3a..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/materialoverride2.PNG and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/previewmodecontrol.png b/Packages/com.unity.shadergraph/Documentation~/images/previewmodecontrol.png deleted file mode 100644 index 8c26980f2ac..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/previewmodecontrol.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/snippets/nodes-compatibility-hdrp.md b/Packages/com.unity.shadergraph/Documentation~/snippets/nodes-compatibility-hdrp.md index c184ee0ce72..0bbeaad507d 100644 --- a/Packages/com.unity.shadergraph/Documentation~/snippets/nodes-compatibility-hdrp.md +++ b/Packages/com.unity.shadergraph/Documentation~/snippets/nodes-compatibility-hdrp.md @@ -4,19 +4,6 @@ title: nodes-compatibility-hdrp node is supported on the following render pipelines: - - - - - - - - - - - - - - - -
    Built-in Render PipelineUniversal Render Pipeline (URP)High Definition Render Pipeline (HDRP)
    NoNoYes
    +| **Built-in Render Pipeline** | **Universal Render Pipeline (URP)** | **High Definition Render Pipeline (HDRP)** | +| :--- | :--- | :--- | +| No | No | Yes | diff --git a/Packages/com.unity.shadergraph/Documentation~/surface-options.md b/Packages/com.unity.shadergraph/Documentation~/surface-options.md index e1df7e53e70..6c668cef842 100644 --- a/Packages/com.unity.shadergraph/Documentation~/surface-options.md +++ b/Packages/com.unity.shadergraph/Documentation~/surface-options.md @@ -4,56 +4,17 @@ Enable **Allow Material Override** to modify a specific set of properties for Universal Render Pipeline Lit and Unlit Shader Graphs and for Built-In Render Pipeline Shader Graphs in the Material Inspector. - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyURP LitURP UnlitBuilt-In Render Pipeline
    Workflow ModeSee the URP documentation for the Lit URP Shader.Not applicable.Not applicable.
    Receive Shadows
    Cast ShadowsThis property is only exposed if Allow Material Override is enabled for this Shader Graph. Enable this property to make it possible for a GameObject using this shader to cast shadows onto itself and other GameObjects. This corresponds to the SubShader Tag ForceNoShadowCasting.Not applicable.
    Surface TypeSee the URP documentation for the Lit and Unlit Shaders.In the Built-In Render Pipeline, this feature has the same behavior as in URP. Consult the URP documentation.
    Render FaceIn the Built-In Render Pipeline, this feature has the same behavior as in URP. Consult the URP documentation.
    Alpha ClippingIn the Built-In Render Pipeline, this feature has the same behavior as in URP. Consult the URP documentation.
    Depth Write -This property is only exposed if Allow Material Override is enabled for this Shader Graph.
    -Use this property to determine whether the GPU writes pixels to the depth buffer when it uses this shader to render geometry.

    -Options:
    -
      -
    • Auto (default): Unity writes pixels to the depth buffer for opaque materials, but not for transparent materials.
    • -
    • Force Enabled Unity always writes pixels to the depth buffer.
    • -
    • Force Disabled Unity never writes pixels to the depth buffer.
    -This option's functionality corresponds to the command ZWrite in ShaderLab. To override this setting in a RenderStateBlock, set the depthState. -
    Depth TestThis property is only exposed if Allow Material Override is enabled for this Shader Graph.
    Use this property to set the conditions under which pixels pass or fail depth testing. The GPU does not draw pixels that fail a depth test. If you choose anything other than LEqual (the default setting for this property), consider also changing the rendering order of this material.

    Options: -
      -
    • LEqual (default): Unity draws the pixel, if its depth value is less than or equal to the value on the depth texture. Less: Unity draws pixels of the affected surface if their coordinates are less than the current depth buffer value.
    • -
    • Never: Unity never draws the pixels of the affected surface.
    • -
    • Less: Unity draws pixels of the affected surface if their coordinates are less than the current depth buffer value.
    • -
    • Greater: Unity draws pixels of the affected surface if their coordinates are greater than the current depth buffer value.
    • -
    • GEqual: Unity draws pixels of the affected surface if their coordinates are greater than or equal to the current depth buffer value.
    • -
    • Equal: Unity draws pixels of the affected surface if their coordinates are equal to the current depth buffer value.
    • -
    • NotEqual: Unity draws pixels of the affected surface if their coordinates are not the same as the current depth buffer value.
    • -
    • Always: Unity draws this surface to your screen regardless of its z-coordinate.
    -This option's functionality corresponds to the command ZTest in ShaderLab. To override this setting in a RenderStateBlock, set the depthState property. -
    Support VFX GraphThis property is only available if the Visual Effect Graph package is installed. Indicates whether this Shader Graph supports the Visual Effect Graph. If you enable this property, output contexts can use this Shader Graph to render particles. The internal setup that Shader Graph does to support visual effects happens when Unity imports the Shader Graph. This means that if you enable this property, but don't use the Shader Graph in a visual effect, there is no impact on performance. It only affects the Shader Graph import time.Not applicable.
    - +| Property | Behavior | +| :--- | :--- | +| **Workflow Mode** | Refer to the URP documentation for the [Lit URP](https://docs.unity3d.com/Manual/urp/lit-shader) Shader.
    **Note**: Not applicable to URP Unlit and the Built-In Render Pipeline. | +| **Receive Shadows** | Refer to the URP documentation for the [Lit URP](https://docs.unity3d.com/Manual/urp/lit-shader) Shader.
    **Note**: Not applicable to URP Unlit and the Built-In Render Pipeline. | +| **Cast Shadows** | This property is only exposed if **Allow Material Override** is enabled for this Shader Graph. Enable this property to make it possible for a GameObject using this shader to cast shadows onto itself and other GameObjects. This corresponds to the [SubShader Tag ForceNoShadowCasting](https://docs.unity3d.com/Manual/SL-SubShaderTags.html).
    **Note**: Not applicable to the Built-In Render Pipeline. | +| **Surface Type** | Refer to the URP documentation for the [Lit URP](https://docs.unity3d.com/Manual/urp/lit-shader.html) and [Unlit URP](https://docs.unity3d.com/Manual/urp/unlit-shader.html) shaders.
    **Note**: In the Built-In Render Pipeline, this feature has the same behavior as in URP. | +| **Render Face** | Refer to the URP documentation for the [Lit URP](https://docs.unity3d.com/Manual/urp/lit-shader.html) and [Unlit URP](https://docs.unity3d.com/Manual/urp/unlit-shader.html) shaders.
    **Note**: In the Built-In Render Pipeline, this feature has the same behavior as in URP. | +| **Alpha Clipping** | Refer to the URP documentation for the [Lit URP](https://docs.unity3d.com/Manual/urp/lit-shader.html) and [Unlit URP](https://docs.unity3d.com/Manual/urp/unlit-shader.html) shaders.
    **Note**: In the Built-In Render Pipeline, this feature has the same behavior as in URP. | +| **Depth Write** | This property is only exposed if **Allow Material Override** is enabled for this Shader Graph.
    Use this property to determine whether the GPU writes pixels to the [depth buffer](https://en.wikipedia.org/wiki/Z-buffering) when it uses this shader to render geometry. The options are:
    • **Auto** (default): Unity writes pixels to the depth buffer for opaque materials, but not for transparent materials.
    • **Force Enabled** Unity always writes pixels to the depth buffer.
    • **Force Disabled** Unity never writes pixels to the depth buffer.
    This option's functionality corresponds to the command [ZWrite](https://docs.unity3d.com/Manual/SL-ZWrite.html) in [ShaderLab](https://docs.unity3d.com/Manual/SL-Reference.html). To override this setting in a [RenderStateBlock](https://docs.unity3d.com/ScriptReference/Rendering.RenderStateBlock.html), set the [depthState](https://docs.unity3d.com/ScriptReference/Rendering.RenderStateBlock-depthState.html). | +| **Depth Test** | This property is only exposed if **Allow Material Override** is enabled for this Shader Graph.
    Use this property to set the conditions under which pixels pass or fail depth testing. The GPU does not draw pixels that fail a depth test. If you choose anything other than **LEqual** (the default setting for this property), consider also changing the rendering order of this material. The options are:
    • **LEqual** (default): Unity draws the pixel, if its depth value is less than or equal to the value on the depth texture. Less: Unity draws pixels of the affected surface if their coordinates are less than the current depth buffer value.
    • **Never**: Unity never draws the pixels of the affected surface.
    • **Less**: Unity draws pixels of the affected surface if their coordinates are less than the current depth buffer value.
    • **Greater**: Unity draws pixels of the affected surface if their coordinates are greater than the current depth buffer value.
    • **GEqual**: Unity draws pixels of the affected surface if their coordinates are greater than or equal to the current depth buffer value.
    • **Equal**: Unity draws pixels of the affected surface if their coordinates are equal to the current depth buffer value.
    • **NotEqual**: Unity draws pixels of the affected surface if their coordinates are not the same as the current depth buffer value.
    • **Always**: Unity draws this surface to your screen regardless of its z-coordinate.
    This option's functionality corresponds to the command [ZTest](https://docs.unity3d.com/Manual/SL-ZTest.html) in [ShaderLab](https://docs.unity3d.com/Manual/SL-Reference.html). To override this setting in a [RenderStateBlock](https://docs.unity3d.com/ScriptReference/Rendering.RenderStateBlock.html), set the [depthState](https://docs.unity3d.com/ScriptReference/Rendering.RenderStateBlock-depthState.html) property. | +| **Support VFX Graph** | This property is only available if the [Visual Effect Graph package](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@latest) is installed.
    Indicates whether this Shader Graph supports the Visual Effect Graph. If you enable this property, output contexts can use this Shader Graph to render particles. The internal setup that Shader Graph does to support visual effects happens when Unity imports the Shader Graph. This means that if you enable this property, but don't use the Shader Graph in a visual effect, there is no impact on performance. It only affects the Shader Graph import time.
    **Note**: Not applicable to the Built-In Render Pipeline. | ## How to use diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Channel/SwizzleNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Channel/SwizzleNode.cs index 210b7c7604a..ba02cc7ff4a 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Channel/SwizzleNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Channel/SwizzleNode.cs @@ -36,7 +36,7 @@ public string maskInput get { return _maskInput; } set { - if (_maskInput.Equals(value)) + if (value == null || _maskInput.Equals(value)) return; _maskInput = value; UpdateNodeAfterDeserialization(); diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/SampleElementTextureNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/SampleElementTextureNode.cs index bde8e644819..24f2be454ac 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/SampleElementTextureNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/SampleElementTextureNode.cs @@ -1,3 +1,4 @@ +using System; using UnityEditor.Graphing; using UnityEditor.Rendering.UITK.ShaderGraph; using UnityEngine; @@ -6,7 +7,7 @@ namespace UnityEditor.ShaderGraph { [Title("UI", "Sample Element Texture")] [SubTargetFilter(typeof(IUISubTarget))] - class SampleElementTextureNode : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireUITK + class SampleElementTextureNode : AbstractMaterialNode, IGeneratesFunction, IGeneratesBodyCode, IMayRequireUITK { public const int UV0Id = 0; @@ -61,6 +62,24 @@ public override void UpdateNodeAfterDeserialization() }); } + public void GenerateNodeFunction(FunctionRegistry registry, GenerationMode generationMode) + { + registry.ProvideFunction("UIE_SAMPLE4", sb => + { + sb.AppendLine(@"#define UIE_SAMPLE4(index) \"); + sb.AppendLine(@" c0 = UNITY_SAMPLE_TEX2D(_Texture##index, uv0); \"); + sb.AppendLine(@" c1 = UNITY_SAMPLE_TEX2D(_Texture##index, uv1); \"); + sb.AppendLine(@" c2 = UNITY_SAMPLE_TEX2D(_Texture##index, uv2); \"); + sb.AppendLine(@" c3 = UNITY_SAMPLE_TEX2D(_Texture##index, uv3);"); + sb.AppendLine(""); + sb.AppendLine("void SampleTextureSlot4(half index, float2 uv0, float2 uv1, float2 uv2, float2 uv3, out float4 c0, out float4 c1, out float4 c2, out float4 c3)"); + using (sb.BlockScope()) + { + sb.AppendLine("UIE_BRANCH(UIE_SAMPLE4)"); + } + }); + } + public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMode) { sb.AppendLine("$precision4 {0};", GetVariableNameForSlot(Color0SlotId)); @@ -68,15 +87,19 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo sb.AppendLine("$precision4 {0};", GetVariableNameForSlot(Color2SlotId)); sb.AppendLine("$precision4 {0};", GetVariableNameForSlot(Color3SlotId)); - sb.Append("#define UIE_SAMPLEX(index) "); - sb.Append("{0} = UNITY_SAMPLE_TEX2D(_Texture##index, {1});", GetVariableNameForSlot(Color0SlotId), GetSlotValue(UV0Id, generationMode)); - sb.Append("{0} = UNITY_SAMPLE_TEX2D(_Texture##index, {1});", GetVariableNameForSlot(Color1SlotId), GetSlotValue(UV1Id, generationMode)); - sb.Append("{0} = UNITY_SAMPLE_TEX2D(_Texture##index, {1});", GetVariableNameForSlot(Color2SlotId), GetSlotValue(UV2Id, generationMode)); - sb.Append("{0} = UNITY_SAMPLE_TEX2D(_Texture##index, {1});", GetVariableNameForSlot(Color3SlotId), GetSlotValue(UV3Id, generationMode)); - sb.AppendLine(""); - - sb.AppendLine("half index = IN.typeTexSettings.y;"); - sb.AppendLine("UIE_BRANCH(UIE_SAMPLEX)"); + using (sb.BlockScope()) + { + sb.AppendLine("half Unity_UIE_TextureSlotIndex = IN.typeTexSettings.y;"); + sb.AppendLine("SampleTextureSlot4(Unity_UIE_TextureSlotIndex, {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7});", + GetSlotValue(UV0Id, generationMode), + GetSlotValue(UV1Id, generationMode), + GetSlotValue(UV2Id, generationMode), + GetSlotValue(UV3Id, generationMode), + GetVariableNameForSlot(Color0SlotId), + GetVariableNameForSlot(Color1SlotId), + GetVariableNameForSlot(Color2SlotId), + GetVariableNameForSlot(Color3SlotId)); + } } public bool RequiresUITK(ShaderStageCapability stageCapability) diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/KeywordNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/KeywordNode.cs index b1d7a4e873e..f3810ccf737 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/KeywordNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/KeywordNode.cs @@ -154,8 +154,9 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo sb.AppendLine(string.Format($"{outputSlot.concreteValueType.ToShaderString()} {GetVariableNameForSlot(OutputSlotId)};")); for(int i = 0; i < keyword.entries.Count; ++i) { - string keywordName = $"{keyword.referenceName}_{keyword.entries[i].referenceName}"; - var value = GetSlotValue(i + 1, generationMode); + var keywordEntry = keyword.entries[i]; + string keywordName = $"{keyword.referenceName}_{keywordEntry.referenceName}"; + var value = GetSlotValue(keywordEntry.id, generationMode); sb.AppendLine(string.Format($"{(i != 0 ? "else" : "")} if({keywordName}) {GetVariableNameForSlot(OutputSlotId)} = {value};")); } break; diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/RedirectNodeView.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/RedirectNodeView.cs index d495c88ca16..0159928d54b 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/RedirectNodeView.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/RedirectNodeView.cs @@ -141,8 +141,7 @@ public bool FindPort(SlotReference slot, out ShaderPort port) public void AttachMessage(string errString, ShaderCompilerMessageSeverity severity) { ClearMessage(); - IconBadge badge; - badge = IconBadge.CreateComment(errString); + IconBadge badge = InternalBridge.IconBadge.CreateComment(errString); Add(badge); badge.AttachTo(outputContainer, SpriteAlignment.RightCenter); diff --git a/Packages/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs b/Packages/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs index c95ef75217a..ebcbd57a960 100644 --- a/Packages/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs +++ b/Packages/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs @@ -1604,7 +1604,8 @@ void BuildKeywordFields(PropertySheet propertySheet, ShaderInput shaderInput) return; keyword.keywordDefinition = (KeywordDefinition)newValue; UpdateEnableState(); - this._postChangeValueCallback(true, ModificationScope.Nothing); + this._postChangeValueCallback(true); + this._keywordChangedCallback(); }, keyword.keywordDefinition, "Definition", @@ -1964,6 +1965,7 @@ void KeywordAddCallbacks() keyword.entries[index] = new KeywordEntry(entry.id, displayName, referenceName); this._postChangeValueCallback(true); + this._keywordChangedCallback(); } }; @@ -2070,6 +2072,8 @@ void KeywordReorderEntries(ReorderableList list) { this._preChangeValueCallback("Reorder Keyword Entry"); this._postChangeValueCallback(true); + this._keywordChangedCallback(); + } public string GetDuplicateSafeEnumDisplayName(int id, string name) diff --git a/Packages/com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs b/Packages/com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs index 830d0220222..8cd8cc5387a 100644 --- a/Packages/com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs +++ b/Packages/com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs @@ -195,11 +195,11 @@ public void AttachMessage(string errString, ShaderCompilerMessageSeverity severi IconBadge badge; if (severity == ShaderCompilerMessageSeverity.Error) { - badge = IconBadge.CreateError(errString); + badge = InternalBridge.IconBadge.CreateError(errString); } else { - badge = IconBadge.CreateComment(errString); + badge = InternalBridge.IconBadge.CreateComment(errString); } Add(badge); diff --git a/Packages/com.unity.shadergraph/Editor/Drawing/Views/PropertyNodeView.cs b/Packages/com.unity.shadergraph/Editor/Drawing/Views/PropertyNodeView.cs index dcfd38e5ab8..8a0a2a2d1e1 100644 --- a/Packages/com.unity.shadergraph/Editor/Drawing/Views/PropertyNodeView.cs +++ b/Packages/com.unity.shadergraph/Editor/Drawing/Views/PropertyNodeView.cs @@ -326,11 +326,11 @@ public void AttachMessage(string errString, ShaderCompilerMessageSeverity severi IconBadge badge; if (severity == ShaderCompilerMessageSeverity.Error) { - badge = IconBadge.CreateError(errString); + badge = InternalBridge.IconBadge.CreateError(errString); } else { - badge = IconBadge.CreateComment(errString); + badge = InternalBridge.IconBadge.CreateComment(errString); } Add(badge); diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Processors/Generator.cs b/Packages/com.unity.shadergraph/Editor/Generation/Processors/Generator.cs index d2d4dc4bfc9..3d0b2919f94 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Processors/Generator.cs +++ b/Packages/com.unity.shadergraph/Editor/Generation/Processors/Generator.cs @@ -33,6 +33,32 @@ struct GeneratedShader class Generator { + #region ProfileMarkers + //UUM-117133; + //static readonly ProfilerMarker s_profileGenerateShaderPass = new ProfilerMarker("GenerateShaderPass"); + //static readonly ProfilerMarker s_profileCollectShaderKeywords = new ProfilerMarker("CollectShaderKeywords"); + //static readonly ProfilerMarker s_profileGetCurrentTargetActiveBlocks = new ProfilerMarker("GetCurrentTargetActiveBlocks"); + //static readonly ProfilerMarker s_profileProcessStackForPass = new ProfilerMarker("ProcessStackForPass"); + //static readonly ProfilerMarker s_profileGetActiveFieldsFromUpstreamNodes = new ProfilerMarker("GetActiveFieldsFromUpstreamNodes"); + //static readonly ProfilerMarker s_profileGetActiveFieldsFromPass = new ProfilerMarker("GetActiveFieldsFromPass"); + //static readonly ProfilerMarker s_profilePropagateActiveFieldReqs = new ProfilerMarker("PropagateActiveFieldReqs"); + //static readonly ProfilerMarker s_profileRenderState = new ProfilerMarker("RenderState"); + //static readonly ProfilerMarker s_profilePragmas = new ProfilerMarker("Pragmas"); + //static readonly ProfilerMarker s_profileKeywords = new ProfilerMarker("Keywords"); + //static readonly ProfilerMarker s_profileStructsAndPacking = new ProfilerMarker("StructsAndPacking"); + //static readonly ProfilerMarker s_profileStructTypes = new ProfilerMarker("StructTypes"); + //static readonly ProfilerMarker s_profileGraphVertex = new ProfilerMarker("GraphVertex"); + //static readonly ProfilerMarker s_profileGenerateVertexDescriptionStruct = new ProfilerMarker("GenerateVertexDescriptionStruct"); + //static readonly ProfilerMarker s_profileGenerateVertexDescriptionFunction = new ProfilerMarker("GenerateVertexDescriptionFunction"); + //static readonly ProfilerMarker s_profileGraphPixel = new ProfilerMarker("GraphPixel"); + //static readonly ProfilerMarker s_profileGraphFunctions = new ProfilerMarker("GraphFunctions"); + //static readonly ProfilerMarker s_profileGraphKeywords = new ProfilerMarker("GraphKeywords"); + //static readonly ProfilerMarker s_profileGraphProperties = new ProfilerMarker("GraphProperties"); + //static readonly ProfilerMarker s_profileGraphDefines = new ProfilerMarker("GraphDefines"); + //static readonly ProfilerMarker s_profileProcessTemplate = new ProfilerMarker("ProcessTemplate"); + #endregion + + const string kDebugSymbol = "SHADERGRAPH_DEBUG"; // readonly data setup in constructor @@ -544,7 +570,8 @@ void GenerateShaderPass(int targetIndex, PassDescriptor pass, ActiveFields activ if (m_Mode == GenerationMode.Preview && !pass.useInPreview) return; - Profiler.BeginSample("GenerateShaderPass"); + // using (s_profileGenerateShaderPass.Auto()) + { // -------------------------------------------------- // Debug @@ -571,11 +598,10 @@ void GenerateShaderPass(int targetIndex, PassDescriptor pass, ActiveFields activ CustomInterpSubGen customInterpSubGen = new CustomInterpSubGen(m_OutputNode != null); // Initiailize Collectors - Profiler.BeginSample("CollectShaderKeywords"); var propertyCollector = new PropertyCollector(); var keywordCollector = new KeywordCollector(); - m_GraphData.CollectShaderKeywords(keywordCollector, m_Mode); - Profiler.EndSample(); + // using (s_profileCollectShaderKeywords.Auto()) + m_GraphData.CollectShaderKeywords(keywordCollector, m_Mode); // Get upstream nodes from ShaderPass port mask List vertexNodes; @@ -588,21 +614,17 @@ void GenerateShaderPass(int targetIndex, PassDescriptor pass, ActiveFields activ if (m_OutputNode == null) { // Update supported block list for current target implementation - Profiler.BeginSample("GetCurrentTargetActiveBlocks"); var activeBlockContext = new TargetActiveBlockContext(currentBlockDescriptors, pass); - m_Targets[targetIndex].GetActiveBlocks(ref activeBlockContext); - Profiler.EndSample(); + // using (s_profileGetCurrentTargetActiveBlocks.Auto()) + m_Targets[targetIndex].GetActiveBlocks(ref activeBlockContext); void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlockMask, List nodeList, List slotList) { if (passBlockMask == null) - { - Profiler.EndSample(); return; - } - Profiler.BeginSample("ProcessStackForPass"); + // using (s_profileProcessStackForPass.Auto()) foreach (var blockFieldDescriptor in passBlockMask) { // Mask blocks on active state @@ -632,7 +654,6 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo slotList.Add(block.FindSlot(0)); activeFields.baseInstance.Add(block.descriptor); } - Profiler.EndSample(); } // Mask blocks per pass @@ -674,11 +695,9 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo List[] pixelNodePermutations = new List[pixelNodes.Count]; // Get active fields from upstream Node requirements - Profiler.BeginSample("GetActiveFieldsFromUpstreamNodes"); ShaderGraphRequirementsPerKeyword graphRequirements; - GenerationUtils.GetActiveFieldsAndPermutationsForNodes(pass, keywordCollector, vertexNodes, pixelNodes, new bool[ShaderGeneratorNames.UVCount], - vertexNodePermutations, pixelNodePermutations, activeFields, out graphRequirements); - Profiler.EndSample(); + // using(s_profileGetActiveFieldsFromUpstreamNodes.Auto()) + GenerationUtils.GetActiveFieldsAndPermutationsForNodes(pass, keywordCollector, vertexNodes, pixelNodes, new bool[ShaderGeneratorNames.UVCount], vertexNodePermutations, pixelNodePermutations, activeFields, out graphRequirements); // Moved this up so that we can reuse the information to figure out which struct Descriptors // should be populated by custom interpolators. @@ -691,9 +710,8 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo passStructs = customInterpSubGen.CopyModifyExistingPassStructs(passStructs, activeFields.baseInstance); // Get active fields from ShaderPass - Profiler.BeginSample("GetActiveFieldsFromPass"); - GenerationUtils.AddRequiredFields(pass.requiredFields, activeFields.baseInstance); - Profiler.EndSample(); + // using (s_profileGetActiveFieldsFromPass.Auto()) + GenerationUtils.AddRequiredFields(pass.requiredFields, activeFields.baseInstance); // Function Registry var functionBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); @@ -715,12 +733,11 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo // Propagate active field requirements using dependencies // Must be executed before types are built - Profiler.BeginSample("PropagateActiveFieldReqs"); + // using(s_profilePropagateActiveFieldReqs.Auto()) foreach (var instance in activeFields.all.instances) { GenerationUtils.ApplyFieldDependencies(instance, pass.fieldDependencies); } - Profiler.EndSample(); // -------------------------------------------------- // Pass Setup @@ -749,7 +766,7 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo // Pass Code // Render State - Profiler.BeginSample("RenderState"); + // using (s_profileRenderState.Auto()) using (var renderStateBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable)) { // Render states need to be separated by RenderState.Type @@ -777,9 +794,8 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo string command = GenerationUtils.GetSpliceCommand(renderStateBuilder.ToCodeBlock(), "RenderState"); spliceCommands.Add("RenderState", command); } - Profiler.EndSample(); // Pragmas - Profiler.BeginSample("Pragmas"); + // using (s_profilePragmas.Auto()) using (var passPragmaBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable)) { if (pass.pragmas != null) @@ -801,9 +817,8 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo string command = GenerationUtils.GetSpliceCommand(passPragmaBuilder.ToCodeBlock(), "PassPragmas"); spliceCommands.Add("PassPragmas", command); } - Profiler.EndSample(); // Keywords - Profiler.BeginSample("Keywords"); + // using (s_profileKeywords.Auto()) using (var passKeywordBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable)) { if (pass.keywords != null) @@ -821,7 +836,6 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo string command = GenerationUtils.GetSpliceCommand(passKeywordBuilder.ToCodeBlock(), "PassKeywords"); spliceCommands.Add("PassKeywords", command); } - Profiler.EndSample(); List originalPassStructs = new List(passStructs); @@ -830,9 +844,9 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo // ----------------------------- // Generated structs and Packing code - Profiler.BeginSample("StructsAndPacking"); var interpolatorBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); - + // using (s_profileStructsAndPacking.Auto()) + { if (passStructs != null) { var packedStructs = new List(); @@ -893,11 +907,12 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo else interpolatorBuilder.AppendLine("//Interpolator Packs: "); spliceCommands.Add("InterpolatorPack", interpolatorBuilder.ToCodeBlock()); - Profiler.EndSample(); + } // Generated String Builders for all struct types - Profiler.BeginSample("StructTypes"); var passStructBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); + // using (s_profileStructTypes.Auto()) + { if (passStructs != null) { var structBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); @@ -911,17 +926,18 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo if (passStructBuilder.length == 0) passStructBuilder.AppendLine("//Pass Structs: "); spliceCommands.Add("PassStructs", passStructBuilder.ToCodeBlock()); - Profiler.EndSample(); + } // Note: End of code copy/pasted into GeneratePassStructsAndInterpolators() in GeneratorDerivativeUtils.cs. // -------------------------------------------------- // Graph Vertex - Profiler.BeginSample("GraphVertex"); var vertexBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); // If vertex modification enabled + // using (s_profileGraphVertex.Auto()) + { if (activeFields.baseInstance.Contains(Fields.GraphVertex) && vertexSlots != null) { // Setup @@ -933,12 +949,11 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo // Build vertex graph outputs // Add struct fields to active fields - Profiler.BeginSample("GenerateVertexDescriptionStruct"); + // using(s_profileGenerateVertexDescriptionStruct.Auto()) GenerationUtils.GenerateVertexDescriptionStruct(vertexGraphOutputBuilder, vertexSlots, vertexGraphOutputName, activeFields.baseInstance); - Profiler.EndSample(); // Build vertex graph functions from ShaderPass vertex port mask - Profiler.BeginSample("GenerateVertexDescriptionFunction"); + // using(s_profileGenerateVertexDescriptionFunction.Auto()) GenerationUtils.GenerateVertexDescriptionFunction( m_GraphData, vertexGraphFunctionBuilder, @@ -953,7 +968,6 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo vertexGraphInputName, vertexGraphFunctionName, vertexGraphOutputName); - Profiler.EndSample(); // Generate final shader strings if (m_HumanReadable) @@ -974,18 +988,18 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo if (vertexBuilder.length == 0) vertexBuilder.AppendLine("// GraphVertex: "); spliceCommands.Add("GraphVertex", vertexBuilder.ToCodeBlock()); - Profiler.EndSample(); + } // -------------------------------------------------- // Graph Pixel - Profiler.BeginSample("GraphPixel"); // Setup string pixelGraphInputName = "SurfaceDescriptionInputs"; string pixelGraphOutputName = "SurfaceDescription"; string pixelGraphFunctionName = "SurfaceDescriptionFunction"; var pixelGraphOutputBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); var pixelGraphFunctionBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); - + // using (s_profileGraphPixel.Auto()) + { // Build pixel graph outputs // Add struct fields to active fields GenerationUtils.GenerateSurfaceDescriptionStruct(pixelGraphOutputBuilder, pixelSlots, pixelGraphOutputName, activeFields.baseInstance, m_OutputNode is SubGraphOutputNode, pass.virtualTextureFeedback); @@ -1020,18 +1034,19 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo pixelBuilder.AppendLine("// GraphPixel: "); spliceCommands.Add("GraphPixel", pixelBuilder.ToCodeBlock()); } - Profiler.EndSample(); + } // -------------------------------------------------- // Graph Functions - Profiler.BeginSample("GraphFunctions"); + // using (s_profileGraphFunctions.Auto()) + { if (functionBuilder.length == 0) functionBuilder.AppendLine("// GraphFunctions: "); spliceCommands.Add("GraphFunctions", functionBuilder.ToCodeBlock()); - Profiler.EndSample(); + } // -------------------------------------------------- // Graph Keywords - Profiler.BeginSample("GraphKeywords"); + // using (s_profileGraphKeywords.Auto()) using (var keywordBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable)) { keywordCollector.GetKeywordsDeclaration(keywordBuilder, m_Mode); @@ -1039,11 +1054,10 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo keywordBuilder.AppendLine("// GraphKeywords: "); spliceCommands.Add("GraphKeywords", keywordBuilder.ToCodeBlock()); } - Profiler.EndSample(); // -------------------------------------------------- // Graph Properties - Profiler.BeginSample("GraphProperties"); + // using (s_profileGraphProperties.Auto()) using (var propertyBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable)) { subShaderProperties.GetPropertiesDeclaration(propertyBuilder, m_Mode, m_GraphData.graphDefaultConcretePrecision); @@ -1066,11 +1080,10 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo propertyBuilder.AppendLine("// GraphProperties: "); spliceCommands.Add("GraphProperties", propertyBuilder.ToCodeBlock()); } - Profiler.EndSample(); // -------------------------------------------------- // Graph Defines - Profiler.BeginSample("GraphDefines"); + // using(s_profileGraphDefines.Auto()) using (var graphDefines = new ShaderStringBuilder(humanReadable: m_HumanReadable)) { graphDefines.AppendLine("#define SHADERPASS {0}", pass.referenceName); @@ -1129,7 +1142,6 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo // Add to splice commands spliceCommands.Add("GraphDefines", graphDefines.ToCodeBlock()); } - Profiler.EndSample(); // -------------------------------------------------- // Includes @@ -1235,23 +1247,19 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo string[] sharedTemplateDirectories = pass.sharedTemplateDirectories; if (!File.Exists(passTemplatePath)) - { - Profiler.EndSample(); return; - } // Process Template - Profiler.BeginSample("ProcessTemplate"); var templatePreprocessor = new ShaderSpliceUtil.TemplatePreprocessor(activeFields, spliceCommands, isDebug, sharedTemplateDirectories, m_AssetCollection, m_HumanReadable, m_IncludeCache); - templatePreprocessor.ProcessTemplateFile(passTemplatePath); + // using (s_profileProcessTemplate.Auto()) + templatePreprocessor.ProcessTemplateFile(passTemplatePath); m_Builder.Concat(templatePreprocessor.GetShaderCode()); - Profiler.EndSample(); // Turn off the skip flag so other passes behave correctly correctly. CustomInterpolatorUtils.generatorSkipFlag = false; CustomInterpolatorUtils.generatorNodeOnly = false; - Profiler.EndSample(); + } } } } 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 27b5d3eba3a..9afdfcea44b 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 @@ -16,12 +16,19 @@ #define SHADOWS_NATIVE +#undef fixed #define fixed real +#undef fixed2 #define fixed2 real2 +#undef fixed3 #define fixed3 real3 +#undef fixed4 #define fixed4 real4 +#undef fixed4x4 #define fixed4x4 real4x4 +#undef fixed3x3 #define fixed3x3 real3x3 +#undef fixed2x2 #define fixed2x2 real2x2 #define UNITY_INITIALIZE_OUTPUT(type,name) ZERO_INITIALIZE(type, name) diff --git a/Packages/com.unity.shadergraph/Editor/InternalBridge/IconBadge.cs b/Packages/com.unity.shadergraph/Editor/InternalBridge/IconBadge.cs new file mode 100644 index 00000000000..1e442d850b9 --- /dev/null +++ b/Packages/com.unity.shadergraph/Editor/InternalBridge/IconBadge.cs @@ -0,0 +1,24 @@ +using GraphViewIconBadge = UnityEditor.Experimental.GraphView.IconBadge; + +namespace UnityEditor.ShaderGraph.InternalBridge +{ + // Wrapper class for internal access to GraphView's IconBadge. + // Allows for creation of badges which don't manually layout their label's dimensions. Works around + // a GraphView bug. + internal static class IconBadge + { + public static GraphViewIconBadge CreateError(string message) + { + var result = GraphViewIconBadge.CreateError(message); + result.m_ComputeTextBoundingBox = false; + return result; + } + + public static GraphViewIconBadge CreateComment(string message) + { + var result = GraphViewIconBadge.CreateComment(message); + result.m_ComputeTextBoundingBox = false; + return result; + } + } +} diff --git a/Packages/com.unity.shadergraph/Editor/InternalBridge/IconBadge.cs.meta b/Packages/com.unity.shadergraph/Editor/InternalBridge/IconBadge.cs.meta new file mode 100644 index 00000000000..c1cc195fd6a --- /dev/null +++ b/Packages/com.unity.shadergraph/Editor/InternalBridge/IconBadge.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 5c787299c2fabe242bc0bd089105b90e \ No newline at end of file diff --git a/Packages/com.unity.shadergraph/Editor/Resources/Styles/Controls/MultiFloatControlView.uss b/Packages/com.unity.shadergraph/Editor/Resources/Styles/Controls/MultiFloatControlView.uss index f3bc0a75a82..a7d25350758 100644 --- a/Packages/com.unity.shadergraph/Editor/Resources/Styles/Controls/MultiFloatControlView.uss +++ b/Packages/com.unity.shadergraph/Editor/Resources/Styles/Controls/MultiFloatControlView.uss @@ -14,8 +14,7 @@ MultiFloatControlView > #dummy > Label { .unity-base-field { - min-width: 30px; - flex-grow: 1; + width: 30px; margin-top: 1px; margin-bottom: 1px; margin-left: 0; diff --git a/Packages/com.unity.shadergraph/Editor/Resources/Styles/MaterialNodeView.uss b/Packages/com.unity.shadergraph/Editor/Resources/Styles/MaterialNodeView.uss index 61fd43930c3..4d9c8d83077 100644 --- a/Packages/com.unity.shadergraph/Editor/Resources/Styles/MaterialNodeView.uss +++ b/Packages/com.unity.shadergraph/Editor/Resources/Styles/MaterialNodeView.uss @@ -41,6 +41,11 @@ MaterialNodeView #controls > #items { padding-bottom: 4px; } +/* Stop dropdown properties from overflowing the node's container */ +MaterialNodeView PropertyRow > #container > #label { + min-width: 92px; +} + MaterialNodeView #title { padding-top: 8px; border-bottom-width: 8px; diff --git a/Packages/com.unity.shadergraph/Editor/ShaderGraphPreferences.cs b/Packages/com.unity.shadergraph/Editor/ShaderGraphPreferences.cs index 85ecf506b75..7742d3a3ea8 100644 --- a/Packages/com.unity.shadergraph/Editor/ShaderGraphPreferences.cs +++ b/Packages/com.unity.shadergraph/Editor/ShaderGraphPreferences.cs @@ -35,6 +35,22 @@ static class Keys internal const string newNodesPreview = "UnityEditor.ShaderGraph.NewNodesPreview"; } + // Note that GUIContent in this class is used to generate search keywords for the preferences window + class Labels + { + public static GUIContent previewVariantLimit = new GUIContent("Preview Variant Limit"); + public static GUIContent autoAddRemoveBlocks = new GUIContent("Automatically Add and Remove Block Nodes"); + public static GUIContent allowDeprecatedBehaviors = new GUIContent("Enable Deprecated Nodes"); + public static GUIContent zoomStepSize = new GUIContent("Zoom Step Size", "Default is 0.5"); + public static GUIContent graphTemplateWorkflow = new GUIContent("Graph Template Workflow", + "When creating a new Shadergraph asset from specific menu items, determine if a reference should use a" + + " variant of the newly created material sub-asset or the shader itself."); + public static GUIContent openNewGraphOnCreation = new GUIContent("Open new Shader Graphs automatically", + "Choose whether new ShaderGraph assets should automatically open for editing."); + public static GUIContent newNodesPreview = new GUIContent("Expand Node Preview on Node creation", + "Choose whether newly added Nodes' Previews should be expanded."); + } + static bool m_Loaded = false; internal delegate void PreferenceChangedDelegate(); @@ -142,7 +158,8 @@ static SettingsProvider PreferenceGUI() { return new SettingsProvider("Preferences/Shader Graph", SettingsScope.User) { - guiHandler = searchContext => OpenGUI() + guiHandler = searchContext => OpenGUI(), + keywords = SettingsProvider.GetSearchKeywordsFromGUIContentProperties(), }; } @@ -159,8 +176,8 @@ static void OpenGUI() var willPreviewVariantBeIgnored = ShaderGraphPreferences.previewVariantLimit > actualLimit || ShaderGraphProjectSettings.instance.overrideShaderVariantLimit; var variantLimitLabel = willPreviewVariantBeIgnored - ? new GUIContent("Preview Variant Limit", EditorGUIUtility.IconContent("console.infoicon").image, $"The Preview Variant Limit is higher than the Shader Variant Limit in Project Settings: {actualLimit}. The Preview Variant Limit will be ignored.") - : new GUIContent("Preview Variant Limit"); + ? new GUIContent(Labels.previewVariantLimit.text, EditorGUIUtility.IconContent("console.infoicon").image, $"The Preview Variant Limit is higher than the Shader Variant Limit in Project Settings: {actualLimit}. The Preview Variant Limit will be ignored.") + : Labels.previewVariantLimit; EditorGUI.BeginChangeCheck(); var variantLimitValue = EditorGUILayout.DelayedIntField(variantLimitLabel, previewVariantLimit); @@ -171,42 +188,42 @@ static void OpenGUI() } EditorGUI.BeginChangeCheck(); - var autoAddRemoveBlocksValue = EditorGUILayout.Toggle("Automatically Add and Remove Block Nodes", autoAddRemoveBlocks); + var autoAddRemoveBlocksValue = EditorGUILayout.Toggle(Labels.autoAddRemoveBlocks, autoAddRemoveBlocks); if (EditorGUI.EndChangeCheck()) { autoAddRemoveBlocks = autoAddRemoveBlocksValue; } EditorGUI.BeginChangeCheck(); - var allowDeprecatedBehaviorsValue = EditorGUILayout.Toggle("Enable Deprecated Nodes", allowDeprecatedBehaviors); + var allowDeprecatedBehaviorsValue = EditorGUILayout.Toggle(Labels.allowDeprecatedBehaviors, allowDeprecatedBehaviors); if (EditorGUI.EndChangeCheck()) { allowDeprecatedBehaviors = allowDeprecatedBehaviorsValue; } EditorGUI.BeginChangeCheck(); - var zoomStepSizeValue = EditorGUILayout.Slider(new GUIContent("Zoom Step Size", $"Default is 0.5"), zoomStepSize, 0.0f, 1f); + var zoomStepSizeValue = EditorGUILayout.Slider(Labels.zoomStepSize.text, zoomStepSize, 0.0f, 1f); if (EditorGUI.EndChangeCheck()) { zoomStepSize = zoomStepSizeValue; } EditorGUI.BeginChangeCheck(); - var graphTemplateWorkflowValue = EditorGUILayout.EnumPopup(new GUIContent("Graph Template Workflow", "When creating a new Shadergraph asset from specific menu items, determine if a reference should use a variant of the newly created material sub-asset or the shader itself."), graphTemplateWorkflow); + var graphTemplateWorkflowValue = EditorGUILayout.EnumPopup(Labels.graphTemplateWorkflow, graphTemplateWorkflow); if (EditorGUI.EndChangeCheck()) { graphTemplateWorkflow = (GraphTemplateWorkflow)graphTemplateWorkflowValue; } EditorGUI.BeginChangeCheck(); - var openNewGraphOnCreationValue = EditorGUILayout.Toggle(new GUIContent("Open new Shader Graphs automatically", "Choose whether new ShaderGraph assets should automatically open for editing."), openNewGraphOnCreation); + var openNewGraphOnCreationValue = EditorGUILayout.Toggle(Labels.openNewGraphOnCreation, openNewGraphOnCreation); if (EditorGUI.EndChangeCheck()) { openNewGraphOnCreation = openNewGraphOnCreationValue; } EditorGUI.BeginChangeCheck(); - var newNodesPreviewValue = EditorGUILayout.Toggle(new GUIContent("Expand Node Preview on Node creation", "Choose whether newly added Nodes' Previews should be expanded."), newNodesPreview); + var newNodesPreviewValue = EditorGUILayout.Toggle(Labels.newNodesPreview, newNodesPreview); if (EditorGUI.EndChangeCheck()) { newNodesPreview = newNodesPreviewValue; diff --git a/Packages/com.unity.shadergraph/Samples~/CustomLighting/Components/Debug/DebugMaterials.shadersubgraph b/Packages/com.unity.shadergraph/Samples~/CustomLighting/Components/Debug/DebugMaterials.shadersubgraph index 36f2d17785c..1c10d09d34f 100644 --- a/Packages/com.unity.shadergraph/Samples~/CustomLighting/Components/Debug/DebugMaterials.shadersubgraph +++ b/Packages/com.unity.shadergraph/Samples~/CustomLighting/Components/Debug/DebugMaterials.shadersubgraph @@ -2048,7 +2048,7 @@ "m_FunctionName": "DebugMaterialSwitch", "m_FunctionSource": "", "m_FunctionSourceUsePragmas": true, - "m_FunctionBody": "Out = None;\n#if !defined(SHADERGRAPH_PREVIEW) && defined(DEBUG_DISPLAY)\n[branch] switch(int(_DebugMaterialMode))\r\n{\r\n case 0:\r\n Out = None; break;\r\n case 1:\r\n Out = Albedo; break;\r\n case 2:\r\n Out = Specular; break;\n case 3:\r\n Out = Alpha; break;\n case 4:\r\n Out = Smoothness; break;\n case 5:\r\n Out = AmbientOcclusion; break;\n case 6:\r\n Out = Emission; break;\n case 7:\r\n Out = NormalWS * 0.5 + 0.5; break;\n case 8:\r\n Out = NormalTS * 0.5 + 0.5; break;\n case 9:\r\n Out = LightComplexity; break;\n case 10:\r\n Out = Metallic; break;\n case 11:\r\n Out = SpriteMask; break;\n case 12:\r\n Out = RenderingLayerMasks; break;\r\n default:\r\n Out = None; break;\r\n}\n#endif" + "m_FunctionBody": "Out = None;\n#if !defined(SHADERGRAPH_PREVIEW) && defined(DEBUG_DISPLAY)\n[branch] switch(int(_DebugMaterialMode))\r\n{\r\n case 0:\r\n Out = None; break;\r\n case 1:\r\n Out = Albedo; break;\r\n case 2:\r\n Out = Specular; break;\n case 3:\r\n Out = Alpha; break;\n case 4:\r\n Out = Smoothness; break;\n case 5:\r\n Out = AmbientOcclusion; break;\n case 6:\r\n Out = Emission; break;\n case 7:\r\n Out = NormalWS * 0.5 + 0.5; break;\n case 8:\r\n Out = NormalTS * 0.5 + 0.5; break;\n case 9:\r\n Out = LightComplexity; break;\n case 10:\r\n Out = Metallic; break;\n case 11:\r\n Out = SpriteMask; break;\n case 12:\r\n Out = RenderingLayerMasks; break;\r\n default:\r\n Out = None; break;\r\n}\n#endif\n\n// Disable this define to prevent the global unlit\n// fragment pass to override the color output again.\n#undef DEBUG_DISPLAY" } { diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderGraph.asset b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderGraph.asset deleted file mode 100644 index 3205ff3c52a..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderGraph.asset +++ /dev/null @@ -1,15 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 19dda12d58f1fbb4e9ef172721391ff2, type: 3} - m_Name: CustomRenderGraph - m_EditorClassIdentifier: - m_RendererFeatures: [] diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderGraph.asset.meta b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderGraph.asset.meta deleted file mode 100644 index 50e353b4a73..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderGraph.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e46834cadfc4eb241bd46a362765a390 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderGraphData.cs b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderGraphData.cs deleted file mode 100644 index 46822c13fa9..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderGraphData.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace UnityEngine.Rendering.Universal -{ - //[CreateAssetMenu()] - public class CustomRenderGraphData : ScriptableRendererData - { - protected override ScriptableRenderer Create() - { - return new CustomRenderer(this); - } - } -} diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderGraphData.cs.meta b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderGraphData.cs.meta deleted file mode 100644 index c8591e6eca1..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderGraphData.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 19dda12d58f1fbb4e9ef172721391ff2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderer.cs b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderer.cs deleted file mode 100644 index 3dcfc7b1019..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderer.cs +++ /dev/null @@ -1,31 +0,0 @@ -using UnityEngine.Rendering.Universal.Internal; - -namespace UnityEngine.Rendering.Universal -{ - public class CustomRenderer : ScriptableRenderer - { - private DrawObjectsPass m_RenderOpaqueForwardPass; - - ForwardLights m_ForwardLights; - - public CustomRenderer(CustomRenderGraphData data) : base(data) - { - m_RenderOpaqueForwardPass = new DrawObjectsPass("Render Opaques", true, RenderPassEvent.BeforeRenderingOpaques + 1, RenderQueueRange.opaque, -1, StencilState.defaultValue, 0); - m_ForwardLights = new ForwardLights(); - } - - public override void Setup(ScriptableRenderContext context, ref RenderingData renderingData) - { - ConfigureCameraTarget(k_CameraTarget, k_CameraTarget); - - foreach (var feature in rendererFeatures) - feature.AddRenderPasses(this, ref renderingData); - EnqueuePass(m_RenderOpaqueForwardPass); - } - - public override void SetupLights(ScriptableRenderContext context, ref RenderingData renderingData) - { - m_ForwardLights.Setup(context, ref renderingData); - } - } -} diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderer.cs.meta b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderer.cs.meta deleted file mode 100644 index aabda3faa95..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Assets/Test/Runtime/CustomRenderPipeline/CustomRenderer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7e0da365be9e44c3bae8da691ccd8de6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Packages/manifest.json b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Packages/manifest.json index 863b00605bc..f97dc94589d 100644 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Packages/manifest.json +++ b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Packages/manifest.json @@ -5,6 +5,7 @@ "com.unity.2d.sprite": "1.0.0", "com.unity.2d.tilemap": "1.0.0", "com.unity.ext.nunit": "1.0.0", + "com.unity.ide.rider": "3.0.38", "com.unity.ide.visualstudio": "2.0.7", "com.unity.ide.vscode": "1.1.3", "com.unity.nuget.newtonsoft-json": "2.0.1-preview.1", @@ -51,4 +52,4 @@ "testables": [ "com.unity.testing.xr" ] -} \ No newline at end of file +} diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT.meta b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT.meta deleted file mode 100644 index 38455b115ae..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 310323cd2c241407fb820d4f12bee4e8 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/CopyToViewportRenderPass.cs b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/CopyToViewportRenderPass.cs deleted file mode 100644 index 26087c289f4..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/CopyToViewportRenderPass.cs +++ /dev/null @@ -1,49 +0,0 @@ -using UnityEngine; -using UnityEngine.Rendering; -using UnityEngine.Rendering.Universal; - -// Same as CopyColorPass but downsampling is not supported, while viewport can be specified -internal class CopyToViewportRenderPass : ScriptableRenderPass -{ - const string m_ProfilerTag = "Copy To Viewport"; - - static readonly int m_SrcTexShaderPropertyId = Shader.PropertyToID("_SrcTex"); - - RTHandle m_Source; - RTHandle m_Destination; - - Material m_CopyToViewportMaterial; - - Rect m_Viewport; - - public CopyToViewportRenderPass(Material copyToViewportMaterial) - { - m_CopyToViewportMaterial = copyToViewportMaterial; - renderPassEvent = RenderPassEvent.BeforeRenderingTransparents; - } - - public void Setup(RTHandle source, RTHandle destination, Rect viewport) - { - m_Source = source; - m_Destination = destination; - m_Viewport = viewport; - } - - public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor) - { - RenderingUtils.ReAllocateHandleIfNeeded(ref m_Destination, cameraTextureDescriptor, FilterMode.Point, TextureWrapMode.Clamp, name: m_Destination.name); - } - - public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) - { - CommandBuffer cmd = CommandBufferPool.Get(m_ProfilerTag); - - cmd.SetRenderTarget(m_Destination.nameID); - cmd.SetGlobalTexture(m_SrcTexShaderPropertyId, m_Source); - cmd.SetViewport(m_Viewport); // cmd.Blit would override SetViewport with the Rect of m_Destination - cmd.DrawMesh(RenderingUtils.fullscreenMesh, Matrix4x4.identity, m_CopyToViewportMaterial); - - context.ExecuteCommandBuffer(cmd); - CommandBufferPool.Release(cmd); - } -} diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/CopyToViewportRenderPass.cs.meta b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/CopyToViewportRenderPass.cs.meta deleted file mode 100644 index 06343db3b32..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/CopyToViewportRenderPass.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8fd9965681daae7418a01d950a01cce2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/OutputColorsToMRTs.shader b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/OutputColorsToMRTs.shader deleted file mode 100644 index ebe7924aa80..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/OutputColorsToMRTs.shader +++ /dev/null @@ -1,54 +0,0 @@ -Shader "Test/OutputColorsToMRTs" -{ - Properties - { - } - SubShader - { - // No culling or depth - Cull Off ZWrite Off ZTest Always - - Pass - { - HLSLPROGRAM - #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl" - - struct Attributes - { - float4 positionOS : POSITION; - }; - - struct Varyings - { - float4 vertex : SV_POSITION; - }; - - struct FragmentOutput - { - half4 dest0 : SV_Target0; - half4 dest1 : SV_Target1; - }; - - Varyings vert(Attributes input) - { - Varyings output = (Varyings)0; - VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz); - output.vertex = vertexInput.positionCS; - return output; - } - - FragmentOutput frag(Varyings input) - { - FragmentOutput o; - o.dest0 = half4(0, 0, 1, 1); - o.dest1 = half4(1, 0, 0, 1); - return o; - } - - #pragma vertex vert - #pragma fragment frag - - ENDHLSL - } - } -} diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/OutputColorsToMRTs.shader.meta b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/OutputColorsToMRTs.shader.meta deleted file mode 100644 index ec2a3f19693..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/OutputColorsToMRTs.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 19eba126951878a4caf1e3fbecdaa299 -ShaderImporter: - externalObjects: {} - defaultTextures: [] - nonModifiableTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/OutputColorsToMRTsRenderPass.cs b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/OutputColorsToMRTsRenderPass.cs deleted file mode 100644 index 615fa88eee0..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/OutputColorsToMRTsRenderPass.cs +++ /dev/null @@ -1,61 +0,0 @@ -using UnityEngine; -using UnityEngine.Rendering; -using UnityEngine.Rendering.Universal; - -// Copy input color buffer's channel to several output color buffers -// Used to test MRT support -internal class OutputColorsToMRTsRenderPass : ScriptableRenderPass -{ - private RTHandle source { get; set; } - private RTHandle[] destination { get; set; } - public RenderTextureDescriptor destDescriptor; - - string profilerTag = "Split Color"; - Material colorToMrtMaterial; - - public OutputColorsToMRTsRenderPass(Material colorToMrtMaterial) - { - renderPassEvent = RenderPassEvent.AfterRenderingSkybox; - - destination = new RTHandle[2]; - - destDescriptor = new RenderTextureDescriptor(1920, 1080, UnityEngine.Experimental.Rendering.GraphicsFormat.R8G8B8A8_SRGB, 0); - - this.colorToMrtMaterial = colorToMrtMaterial; - } - - // Configure the pass with the source and destination to execute on. - public void Setup(ref RenderingData renderingData, RTHandle source, RTHandle[] destination) - { - this.source = source; - this.destination[0] = destination[0]; - this.destination[1] = destination[1]; - destDescriptor.width = renderingData.cameraData.cameraTargetDescriptor.width; - destDescriptor.height = renderingData.cameraData.cameraTargetDescriptor.height; - } - - public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor) - { - cmd.SetGlobalTexture(destination[0].name, destination[0].nameID); - cmd.SetGlobalTexture(destination[1].name, destination[1].nameID); - - ConfigureTarget(destination); - //ConfigureClear(m_HasDepthPrepass ? ClearFlag.None : ClearFlag.Depth, Color.black); - - ConfigureClear(ClearFlag.Color, Color.yellow); - } - - Matrix4x4 scaleMatrix = Matrix4x4.Scale(new Vector3(0.85f, 0.85f, 0.85f)); - - public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) - { - CommandBuffer cmd = CommandBufferPool.Get(profilerTag); - - cmd.SetViewProjectionMatrices(Matrix4x4.identity, Matrix4x4.identity); - // cmd.SetGlobalTexture(shaderPropertyId_srcTex, source); - cmd.DrawMesh(RenderingUtils.fullscreenMesh, scaleMatrix, colorToMrtMaterial); - - context.ExecuteCommandBuffer(cmd); - CommandBufferPool.Release(cmd); - } -} diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/OutputColorsToMRTsRenderPass.cs.meta b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/OutputColorsToMRTsRenderPass.cs.meta deleted file mode 100644 index 5589fe22a1a..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/OutputColorsToMRTsRenderPass.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8675f8656e91c4f41a2452b5d8ce16b7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105Renderer.cs b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105Renderer.cs deleted file mode 100644 index 24948970ab6..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105Renderer.cs +++ /dev/null @@ -1,106 +0,0 @@ -using UnityEngine.Rendering.Universal.Internal; - -namespace UnityEngine.Rendering.Universal -{ - // This test illustrates that ScriptableRenderer.ExecuteRenderPass will also use the clearFlag defined as renderPass.clearFlag when the renderPass target is an MRT setup. - // See also test 106. - public sealed class Test105Renderer : ScriptableRenderer - { - RTHandle m_CameraColor; - RTHandle m_CameraDepth; - - OutputColorsToMRTsRenderPass m_ColorsToMrtsPass; - RTHandle[] m_ColorToMrtOutputs; // outputs of render pass "OutputColorsToMRTs" - - CopyToViewportRenderPass[] m_CopyToViewportPasses; - Rect m_Viewport = new Rect(660, 200, 580, 320); // viewport to copy the results into - - FinalBlitPass m_FinalBlitPass; - - Material m_ColorToMrtMaterial; - Material m_CopyToViewportMaterial; - Material m_BlitMaterial; - - string m_profilerTag = "Test 105 Renderer"; - - public Test105Renderer(Test105RendererData data) : base(data) - { - m_ColorToMrtMaterial = CoreUtils.CreateEngineMaterial(data.shaders.colorToMrtPS); - m_ColorsToMrtsPass = new OutputColorsToMRTsRenderPass(m_ColorToMrtMaterial); - - // Create and declare the render targets used in the pass - m_ColorToMrtOutputs = new RTHandle[2]; - m_ColorToMrtOutputs[0] = RTHandles.Alloc(m_ColorsToMrtsPass.destDescriptor, FilterMode.Point, TextureWrapMode.Clamp, name: "_ColorToMrtOutput0"); - m_ColorToMrtOutputs[1] = RTHandles.Alloc(m_ColorsToMrtsPass.destDescriptor, FilterMode.Point, TextureWrapMode.Clamp, name: "_ColorToMrtOutput1"); - - m_CopyToViewportMaterial = CoreUtils.CreateEngineMaterial(data.shaders.copyToViewportPS); - m_CopyToViewportPasses = new CopyToViewportRenderPass[2]; - m_CopyToViewportPasses[0] = new CopyToViewportRenderPass(m_CopyToViewportMaterial); - m_CopyToViewportPasses[1] = new CopyToViewportRenderPass(m_CopyToViewportMaterial); - - m_BlitMaterial = CoreUtils.CreateEngineMaterial(data.shaders.blitPS); - m_FinalBlitPass = new FinalBlitPass(RenderPassEvent.AfterRendering, m_BlitMaterial, null); - } - - /// - public override void Setup(ScriptableRenderContext context, ref RenderingData renderingData) - { - CommandBuffer cmd = CommandBufferPool.Get(m_profilerTag); - - int width = renderingData.cameraData.cameraTargetDescriptor.width; - int height = renderingData.cameraData.cameraTargetDescriptor.height; - - var colorDescriptor = new RenderTextureDescriptor(width, height); - var depthDescriptor = new RenderTextureDescriptor(width, height, RenderTextureFormat.Depth, 16); - RenderingUtils.ReAllocateHandleIfNeeded(ref m_CameraColor, colorDescriptor, FilterMode.Point, TextureWrapMode.Clamp, name: "_CameraColor"); - RenderingUtils.ReAllocateHandleIfNeeded(ref m_CameraDepth, depthDescriptor, FilterMode.Point, TextureWrapMode.Clamp, name: "_CameraDepth"); - - context.ExecuteCommandBuffer(cmd); - CommandBufferPool.Release(cmd); - - ConfigureCameraTarget(m_CameraColor, m_CameraDepth); - - // 1) Render different colors to the MRT outputs (render a blue quad to output#0 and a red quad to output#1) - - //m_ColorToMrtOutputs[0] = m_CameraColor; - m_ColorsToMrtsPass.Setup(ref renderingData, cameraColorTargetHandle, m_ColorToMrtOutputs); - EnqueuePass(m_ColorsToMrtsPass); - // Notice that the renderPass clearColor (yellow) is applied. - - - // 2) Copy results to the camera target - - // layout (margin/blit/margin/..) - // x: <-0.04-><-0.44-><-0.04-><-0.44-><-0.04-> - // y: <-0.25-><-0.50-><-0.25-> - - m_Viewport.x = 0.04f * width; - m_Viewport.width = 0.44f * width; - m_Viewport.y = 0.25f * height; - m_Viewport.height = 0.50f * height; - - m_CopyToViewportPasses[0].Setup(m_ColorToMrtOutputs[0], m_CameraColor, m_Viewport); - EnqueuePass(m_CopyToViewportPasses[0]); - - m_Viewport.x = (0.04f + 0.44f + 0.04f) * width; - m_CopyToViewportPasses[1].Setup(m_ColorToMrtOutputs[1], m_CameraColor, m_Viewport); - EnqueuePass(m_CopyToViewportPasses[1]); - - - // 3) Final blit to the backbuffer - m_FinalBlitPass.Setup(renderingData.cameraData.cameraTargetDescriptor, m_CameraColor); - EnqueuePass(m_FinalBlitPass); - } - - protected override void Dispose(bool disposing) - { - m_ColorToMrtOutputs[0]?.Release(); - m_ColorToMrtOutputs[1]?.Release(); - m_CameraColor?.Release(); - m_CameraDepth?.Release(); - CoreUtils.Destroy(m_ColorToMrtMaterial); - CoreUtils.Destroy(m_CopyToViewportMaterial); - CoreUtils.Destroy(m_BlitMaterial); - } - } -} diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105Renderer.cs.meta b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105Renderer.cs.meta deleted file mode 100644 index 822d402f9ea..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105Renderer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5345e6d1aa197a848aab02971a9e1c86 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105RendererData.cs b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105RendererData.cs deleted file mode 100644 index 9dbfeb18c0e..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105RendererData.cs +++ /dev/null @@ -1,87 +0,0 @@ -#if UNITY_EDITOR -using UnityEditor; -using UnityEditor.ProjectWindowCallback; -#endif -using System; -using UnityEngine.Scripting.APIUpdating; - -namespace UnityEngine.Rendering.Universal -{ - [Serializable, ReloadGroup] - public class Test105RendererData : ScriptableRendererData - { -#if UNITY_EDITOR - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812")] - internal class CreateTest105RendererAsset : EndNameEditAction - { - public override void Action(int instanceId, string pathName, string resourceFile) - { - var instance = CreateInstance(); - AssetDatabase.CreateAsset(instance, pathName); - ResourceReloader.ReloadAllNullIn(instance, UniversalRenderPipelineAsset.packagePath); - Selection.activeObject = instance; - } - } - - [MenuItem("Assets/Create/Rendering/Universal Render Pipeline/Tests/Test 105 Renderer", priority = CoreUtils.assetCreateMenuPriority1)] - static void CreateTest105RendererData() - { - ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, CreateInstance(), "Test105RendererData.asset", null, null); - } - -#endif - - [Serializable, ReloadGroup] - public sealed class ShaderResources - { - //[Reload("TestProjects/UniversalGraphicsTest/Assets/Scenes/105_MRT/OutputColorsToMRTs.shader")] - // Path outside of scope supported by ResourceReloader - we manually load this one - public Shader colorToMrtPS; - - //[Reload("TestProjects/UniversalGraphicsTest/Assets/Scenes/105_MRT/CopyToViewport.shader")] - // Path outside of scope supported by ResourceReloader - we manually load this one - public Shader copyToViewportPS; - - [Reload("Shaders/Utils/Blit.shader")] - public Shader blitPS; - } - - public ShaderResources shaders = null; - - protected override ScriptableRenderer Create() - { -#if UNITY_EDITOR - if (!Application.isPlaying) - { - ResourceReloader.ReloadAllNullIn(this, UniversalRenderPipelineAsset.packagePath); - } -#endif - shaders.colorToMrtPS = Shader.Find("Test/OutputColorsToMRTs"); - shaders.copyToViewportPS = Shader.Find("Test/CopyToViewport"); - - return new Test105Renderer(this); - } - - protected override void OnEnable() - { - base.OnEnable(); - - // Upon asset creation, OnEnable is called and `shaders` reference is not yet initialized - // We need to call the OnEnable for data migration when updating from old versions of LWRP that - // serialized resources in a different format. Early returning here when OnEnable is called - // upon asset creation is fine because we guarantee new assets get created with all resources initialized. - if (shaders == null) - return; - -#if UNITY_EDITOR - try - { - ResourceReloader.ReloadAllNullIn(this, UniversalRenderPipelineAsset.packagePath); - shaders.colorToMrtPS = Shader.Find("Test/OutputColorsToMRTs"); - shaders.copyToViewportPS = Shader.Find("Test/CopyToViewport"); - } - catch {} -#endif - } - } -} diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105RendererData.cs.meta b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105RendererData.cs.meta deleted file mode 100644 index 9f27faadad0..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105RendererData.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 70e5bd97224ace04996a22cc46a3e23d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105RendererDataAsset.asset b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105RendererDataAsset.asset deleted file mode 100644 index 14232a04997..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105RendererDataAsset.asset +++ /dev/null @@ -1,19 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 70e5bd97224ace04996a22cc46a3e23d, type: 3} - m_Name: Test105RendererDataAsset - m_EditorClassIdentifier: - m_RendererFeatures: [] - shaders: - splitColorPS: {fileID: 4800000, guid: 19eba126951878a4caf1e3fbecdaa299, type: 3} - samplingPS: {fileID: 4800000, guid: 04c410c9937594faa893a11dceb85f7e, type: 3} - blitPS: {fileID: 4800000, guid: c17132b1f77d20942aa75f8429c0f8bc, type: 3} diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105RendererDataAsset.asset.meta b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105RendererDataAsset.asset.meta deleted file mode 100644 index c855a4ca40b..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/105_MRT/Test105RendererDataAsset.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f384dd0947066cc4486f0444a39bf749 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag.meta b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag.meta deleted file mode 100644 index 21f876c44a1..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 64cc6db32ac424fc0a956b6810b688b5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106Renderer.cs b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106Renderer.cs deleted file mode 100644 index 5779feaa765..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106Renderer.cs +++ /dev/null @@ -1,100 +0,0 @@ -using UnityEngine.Rendering.Universal.Internal; - -namespace UnityEngine.Rendering.Universal -{ - // This tests is a variation of test 105. - // It illustrates that ScriptableRenderer.ExecuteRenderPass will use the camera clearFlag if the camera target is one of the renderTargets in the MRT setup - public sealed class Test106Renderer : ScriptableRenderer - { - RTHandle m_CameraColor; - RTHandle m_CameraDepth; - - OutputColorsToMRTsRenderPass m_ColorsToMrtsPass; - RTHandle[] m_ColorToMrtOutputs; // outputs of render pass "OutputColorsToMRTs" - - CopyToViewportRenderPass[] m_CopyToViewportPasses; - Rect m_Viewport = new Rect(660, 200, 580, 320); // viewport to copy the results into - - FinalBlitPass m_FinalBlitPass; - - public Test106Renderer(Test106RendererData data) : base(data) - { - Material colorToMrtMaterial = CoreUtils.CreateEngineMaterial(data.shaders.colorToMrtPS); - m_ColorsToMrtsPass = new OutputColorsToMRTsRenderPass(colorToMrtMaterial); - - m_ColorToMrtOutputs = new RTHandle[2]; - // m_ColorToMrtOutputs[0] = RTHandles.Alloc(m_ColorsToMrtsPass.destDescriptor, FilterMode.Point, TextureWrapMode.Clamp, name: "_ColorToMrtOutput0"); - m_ColorToMrtOutputs[1] = RTHandles.Alloc(m_ColorsToMrtsPass.destDescriptor, FilterMode.Point, TextureWrapMode.Clamp, name: "_ColorToMrtOutput1"); - - Material copyToViewportMaterial = CoreUtils.CreateEngineMaterial(data.shaders.copyToViewportPS); - m_CopyToViewportPasses = new CopyToViewportRenderPass[2]; - //m_CopyToViewportPasses[0] = new CopyToViewportRenderPass(copyToViewportMaterial); - m_CopyToViewportPasses[1] = new CopyToViewportRenderPass(copyToViewportMaterial); - - Material blitMaterial = CoreUtils.CreateEngineMaterial(data.shaders.blitPS); - m_FinalBlitPass = new FinalBlitPass(RenderPassEvent.AfterRendering, blitMaterial, null); - } - - string m_profilerTag = "Test 106 Renderer"; - - /// - public override void Setup(ScriptableRenderContext context, ref RenderingData renderingData) - { - CommandBuffer cmd = CommandBufferPool.Get(m_profilerTag); - - int width = renderingData.cameraData.cameraTargetDescriptor.width; - int height = renderingData.cameraData.cameraTargetDescriptor.height; - - var colorDescriptor = new RenderTextureDescriptor(width, height); - var depthDescriptor = new RenderTextureDescriptor(width, height, RenderTextureFormat.Depth, 16); - RenderingUtils.ReAllocateHandleIfNeeded(ref m_CameraColor, colorDescriptor, FilterMode.Point, TextureWrapMode.Clamp, name: "_CameraColor"); - RenderingUtils.ReAllocateHandleIfNeeded(ref m_CameraDepth, depthDescriptor, FilterMode.Point, TextureWrapMode.Clamp, name: "_CameraDepth"); - - context.ExecuteCommandBuffer(cmd); - CommandBufferPool.Release(cmd); - - ConfigureCameraTarget(m_CameraColor, m_CameraDepth); - - - // 1) Render different colors to the MRT outputs (render a blue quad to output#0 and a red quad to output#1) - m_ColorToMrtOutputs[0] = m_CameraColor; - m_ColorsToMrtsPass.Setup(ref renderingData, cameraColorTargetHandle, m_ColorToMrtOutputs); - EnqueuePass(m_ColorsToMrtsPass); - // Notice that the renderPass clearColor (yellow) is applied for output#1 - // Notice that the camera clearColor (green) is applied for output#0 (because output#0 is the camera target) - - - // 2) Copy results to the camera target - - // layout (margin/blit/margin/..) - // x: <-0.04-><-0.44-><-0.04-><-0.44-><-0.04-> - // y: <-0.25-><-0.50-><-0.25-> - - //m_Viewport.x = 0.04f * width; - m_Viewport.width = 0.44f * width; - m_Viewport.y = 0.25f * height; - m_Viewport.height = 0.50f * height; - - //m_CopyToViewportPasses[0].Setup(m_ColorToMrtOutputs[0].Identifier(), m_CameraColor, m_Viewport); - //EnqueuePass(m_CopyToViewportPasses[0]); - - m_Viewport.x = (0.04f + 0.44f + 0.04f) * width; - m_CopyToViewportPasses[1].Setup(m_ColorToMrtOutputs[1], m_CameraColor, m_Viewport); - EnqueuePass(m_CopyToViewportPasses[1]); - - - // 3) Final blit to the backbuffer - m_FinalBlitPass.Setup(renderingData.cameraData.cameraTargetDescriptor, m_CameraColor); - EnqueuePass(m_FinalBlitPass); - } - - protected override void Dispose(bool disposing) - { - // m_ColorToMrtOutputs[0]?.Release(); - m_ColorToMrtOutputs[1]?.Release(); - m_CameraColor?.Release(); - m_CameraDepth?.Release(); - m_FinalBlitPass.Dispose(); - } - } -} diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106Renderer.cs.meta b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106Renderer.cs.meta deleted file mode 100644 index 440a14e4a19..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106Renderer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0df98b0ce1b3d3c48a1b2b7e612631a2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106RendererData.cs b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106RendererData.cs deleted file mode 100644 index 52e3cb1e0d6..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106RendererData.cs +++ /dev/null @@ -1,87 +0,0 @@ -#if UNITY_EDITOR -using UnityEditor; -using UnityEditor.ProjectWindowCallback; -#endif -using System; -using UnityEngine.Scripting.APIUpdating; - -namespace UnityEngine.Rendering.Universal -{ - [Serializable, ReloadGroup] - public class Test106RendererData : ScriptableRendererData - { -#if UNITY_EDITOR - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812")] - internal class CreateTest106RendererAsset : EndNameEditAction - { - public override void Action(int instanceId, string pathName, string resourceFile) - { - var instance = CreateInstance(); - AssetDatabase.CreateAsset(instance, pathName); - ResourceReloader.ReloadAllNullIn(instance, UniversalRenderPipelineAsset.packagePath); - Selection.activeObject = instance; - } - } - - [MenuItem("Assets/Create/Rendering/Universal Render Pipeline/Tests/Test 106 Renderer", priority = CoreUtils.assetCreateMenuPriority1)] - static void CreateTest106RendererData() - { - ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, CreateInstance(), "Test106RendererData.asset", null, null); - } - -#endif - - [Serializable, ReloadGroup] - public sealed class ShaderResources - { - //[Reload("TestProjects/UniversalGraphicsTest/Assets/Scenes/105_MRT/OutputColorsToMRTs.shader")] - // Path outside of scope supported by ResourceReloader - we manually load this one - public Shader colorToMrtPS; - - //[Reload("TestProjects/UniversalGraphicsTest/Assets/Scenes/105_MRT/CopyToViewport.shader")] - // Path outside of scope supported by ResourceReloader - we manually load this one - public Shader copyToViewportPS; - - [Reload("Shaders/Utils/Blit.shader")] - public Shader blitPS; - } - - public ShaderResources shaders = null; - - protected override ScriptableRenderer Create() - { -#if UNITY_EDITOR - if (!Application.isPlaying) - { - ResourceReloader.ReloadAllNullIn(this, UniversalRenderPipelineAsset.packagePath); - } -#endif - shaders.colorToMrtPS = Shader.Find("Test/OutputColorsToMRTs"); - shaders.copyToViewportPS = Shader.Find("Test/CopyToViewport"); - - return new Test106Renderer(this); - } - - protected override void OnEnable() - { - base.OnEnable(); - - // Upon asset creation, OnEnable is called and `shaders` reference is not yet initialized - // We need to call the OnEnable for data migration when updating from old versions of LWRP that - // serialized resources in a different format. Early returning here when OnEnable is called - // upon asset creation is fine because we guarantee new assets get created with all resources initialized. - if (shaders == null) - return; - -#if UNITY_EDITOR - try - { - ResourceReloader.ReloadAllNullIn(this, UniversalRenderPipelineAsset.packagePath); - shaders.colorToMrtPS = Shader.Find("Test/OutputColorsToMRTs"); - shaders.copyToViewportPS = Shader.Find("Test/CopyToViewport"); - } - catch {} -#endif - } - } -} diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106RendererData.cs.meta b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106RendererData.cs.meta deleted file mode 100644 index a989e114402..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106RendererData.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 13db91318120ded488cfb39bae256bd3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106RendererDataAsset.asset b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106RendererDataAsset.asset deleted file mode 100644 index 4d2679545e6..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106RendererDataAsset.asset +++ /dev/null @@ -1,20 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 13db91318120ded488cfb39bae256bd3, type: 3} - m_Name: Test106RendererDataAsset - m_EditorClassIdentifier: - m_RendererFeatures: [] - shaders: - splitColorPS: {fileID: 0} - scaledCopyColorPS: {fileID: 0} - samplingPS: {fileID: 4800000, guid: 04c410c9937594faa893a11dceb85f7e, type: 3} - blitPS: {fileID: 4800000, guid: c17132b1f77d20942aa75f8429c0f8bc, type: 3} diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106RendererDataAsset.asset.meta b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106RendererDataAsset.asset.meta deleted file mode 100644 index 58366f78970..00000000000 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Assets/Scenes/106_MRT_CameraClearFlag/Test106RendererDataAsset.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: fe9d770af9e3d124d88e918ce9b153be -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Packages/manifest.json b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Packages/manifest.json index 863b00605bc..f97dc94589d 100644 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Packages/manifest.json +++ b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Packages/manifest.json @@ -5,6 +5,7 @@ "com.unity.2d.sprite": "1.0.0", "com.unity.2d.tilemap": "1.0.0", "com.unity.ext.nunit": "1.0.0", + "com.unity.ide.rider": "3.0.38", "com.unity.ide.visualstudio": "2.0.7", "com.unity.ide.vscode": "1.1.3", "com.unity.nuget.newtonsoft-json": "2.0.1-preview.1", @@ -51,4 +52,4 @@ "testables": [ "com.unity.testing.xr" ] -} \ No newline at end of file +}