暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

NewPostProcessVolumeComponent.cs.txt 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using UnityEngine;
  2. using UnityEngine.Rendering;
  3. using UnityEngine.Rendering.Universal;
  4. // This defines a custom VolumeComponent to be used with the Core VolumeFramework
  5. // (see core API docs https://docs.unity3d.com/Packages/com.unity.render-pipelines.core@latest/index.html?subfolder=/api/UnityEngine.Rendering.VolumeComponent.html)
  6. // (see URP docs https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@latest/index.html?subfolder=/manual/Volumes.html)
  7. //
  8. // After implementing this class you can:
  9. // * Tweak the default values for this VolumeComponent in the URP GlobalSettings
  10. // * Add overrides for this VolumeComponent to any local or global scene volume profiles
  11. // (see URP docs https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@latest/index.html?subfolder=/manual/Volume-Profile.html)
  12. // (see URP docs https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@latest/index.html?subfolder=/manual/VolumeOverrides.html)
  13. // * Access the blended values of this VolumeComponent from your ScriptableRenderPasses or scripts using the VolumeManager API
  14. // (see core API docs https://docs.unity3d.com/Packages/com.unity.render-pipelines.core@latest/index.html?subfolder=/api/UnityEngine.Rendering.VolumeManager.html)
  15. // * Override the values for this volume per-camera by placing a VolumeProfile in a dedicated layer and setting the camera's "Volume Mask" to that layer
  16. //
  17. // Things to keep in mind:
  18. // * Be careful when renaming, changing types or removing public fields to not break existing instances of this class (note that this class inherits from ScriptableObject so the same serialization rules apply)
  19. // * The 'IPostProcessComponent' interface adds the 'IsActive()' method, which is currently not strictly necessary and is for your own convenience
  20. // * It is recommended to only expose fields that are expected to change. Fields which are constant such as shaders, materials or LUT textures
  21. // should likely be in AssetBundles or referenced by serialized fields of your custom ScriptableRendererFeatures on used renderers so they would not get stripped during builds
  22. [VolumeComponentMenu("Post-processing Custom/#DISPLAY_NAME#")]
  23. [VolumeRequiresRendererFeatures(typeof(#FEATURE_TYPE#))]
  24. [SupportedOnRenderPipeline(typeof(UniversalRenderPipelineAsset))]
  25. public sealed class #VOLUME_TYPE# : VolumeComponent, IPostProcessComponent
  26. {
  27. public #VOLUME_TYPE#()
  28. {
  29. displayName = "#DISPLAY_NAME#";
  30. }
  31. [Tooltip("Enter the description for the property that is shown when hovered")]
  32. public ClampedFloatParameter intensity = new ClampedFloatParameter(1f, 0f, 1f);
  33. public bool IsActive()
  34. {
  35. return intensity.GetValue<float>() > 0.0f;
  36. }
  37. }