PostProcessData.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #if UNITY_EDITOR
  2. using UnityEditor;
  3. using UnityEditor.ProjectWindowCallback;
  4. #endif
  5. using System;
  6. namespace UnityEngine.Rendering.Universal
  7. {
  8. [Serializable]
  9. public class PostProcessData : ScriptableObject
  10. {
  11. #if UNITY_EDITOR
  12. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812")]
  13. internal class CreatePostProcessDataAsset : EndNameEditAction
  14. {
  15. public override void Action(int instanceId, string pathName, string resourceFile)
  16. {
  17. var instance = CreateInstance<PostProcessData>();
  18. AssetDatabase.CreateAsset(instance, pathName);
  19. ResourceReloader.ReloadAllNullIn(instance, UniversalRenderPipelineAsset.packagePath);
  20. Selection.activeObject = instance;
  21. }
  22. }
  23. [MenuItem("Assets/Create/Rendering/URP Post-process Data", priority = CoreUtils.Sections.section5 + CoreUtils.Priorities.assetsCreateRenderingMenuPriority)]
  24. static void CreatePostProcessData()
  25. {
  26. ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, CreateInstance<CreatePostProcessDataAsset>(), "CustomPostProcessData.asset", null, null);
  27. }
  28. internal static PostProcessData GetDefaultPostProcessData()
  29. {
  30. var path = System.IO.Path.Combine(UniversalRenderPipelineAsset.packagePath, "Runtime/Data/PostProcessData.asset");
  31. return AssetDatabase.LoadAssetAtPath<PostProcessData>(path);
  32. }
  33. #endif
  34. [Serializable, ReloadGroup]
  35. public sealed class ShaderResources
  36. {
  37. [Reload("Shaders/PostProcessing/StopNaN.shader")]
  38. public Shader stopNanPS;
  39. [Reload("Shaders/PostProcessing/SubpixelMorphologicalAntialiasing.shader")]
  40. public Shader subpixelMorphologicalAntialiasingPS;
  41. [Reload("Shaders/PostProcessing/GaussianDepthOfField.shader")]
  42. public Shader gaussianDepthOfFieldPS;
  43. [Reload("Shaders/PostProcessing/BokehDepthOfField.shader")]
  44. public Shader bokehDepthOfFieldPS;
  45. [Reload("Shaders/PostProcessing/CameraMotionBlur.shader")]
  46. public Shader cameraMotionBlurPS;
  47. [Reload("Shaders/PostProcessing/PaniniProjection.shader")]
  48. public Shader paniniProjectionPS;
  49. [Reload("Shaders/PostProcessing/LutBuilderLdr.shader")]
  50. public Shader lutBuilderLdrPS;
  51. [Reload("Shaders/PostProcessing/LutBuilderHdr.shader")]
  52. public Shader lutBuilderHdrPS;
  53. [Reload("Shaders/PostProcessing/Bloom.shader")]
  54. public Shader bloomPS;
  55. [Reload("Shaders/PostProcessing/LensFlareDataDriven.shader")]
  56. public Shader LensFlareDataDrivenPS;
  57. [Reload("Shaders/PostProcessing/ScalingSetup.shader")]
  58. public Shader scalingSetupPS;
  59. [Reload("Shaders/PostProcessing/EdgeAdaptiveSpatialUpsampling.shader")]
  60. public Shader easuPS;
  61. [Reload("Shaders/PostProcessing/UberPost.shader")]
  62. public Shader uberPostPS;
  63. [Reload("Shaders/PostProcessing/FinalPost.shader")]
  64. public Shader finalPostPassPS;
  65. }
  66. [Serializable, ReloadGroup]
  67. public sealed class TextureResources
  68. {
  69. // Pre-baked noise
  70. [Reload("Textures/BlueNoise16/L/LDR_LLL1_{0}.png", 0, 32)]
  71. public Texture2D[] blueNoise16LTex;
  72. // Post-processing
  73. [Reload(new[]
  74. {
  75. "Textures/FilmGrain/Thin01.png",
  76. "Textures/FilmGrain/Thin02.png",
  77. "Textures/FilmGrain/Medium01.png",
  78. "Textures/FilmGrain/Medium02.png",
  79. "Textures/FilmGrain/Medium03.png",
  80. "Textures/FilmGrain/Medium04.png",
  81. "Textures/FilmGrain/Medium05.png",
  82. "Textures/FilmGrain/Medium06.png",
  83. "Textures/FilmGrain/Large01.png",
  84. "Textures/FilmGrain/Large02.png"
  85. })]
  86. public Texture2D[] filmGrainTex;
  87. [Reload("Textures/SMAA/AreaTex.tga")]
  88. public Texture2D smaaAreaTex;
  89. [Reload("Textures/SMAA/SearchTex.tga")]
  90. public Texture2D smaaSearchTex;
  91. }
  92. public ShaderResources shaders;
  93. public TextureResources textures;
  94. }
  95. }