Skip to content

Commit 26da2f2

Browse files
committed
Merge remote-tracking branch 'origin/URP-10.2.2'
2 parents 29403f7 + faf39d2 commit 26da2f2

19 files changed

Lines changed: 35 additions & 356 deletions

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [1.1.0] - 2021-01-23
88
### Added
99
- Added a Scene Transparent Depth PrePass.
10+
- Added support for URP's ScriptableRenderPassInput to pick which scene textures are needed for each effect.
1011

1112
### Changed
1213
- Gradient Fog can now be used before or after the transparent pass.
@@ -16,6 +17,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1617
- Fixed scene shifting on the screen to the left with the Glitch effect.
1718
- Removed some visual artifacts from Edge Detection by making the depth threshold relative to the center pixel depth.
1819

20+
### Removed
21+
- Removed the scene normal texture renderer feature since it is no longer needed with URP 10.
22+
1923
## [1.0.0] - 2020-09-17
2024
### Added
2125
- Added the main functionality for custom post-processing as renderer future for URP.

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,15 @@ Other custom effects in samples but not used in screenshots:
2929

3030
## Compatibility
3131

32-
* Unity 2020.1
33-
* URP 8.2.0
32+
* Unity 2020.2
33+
* URP 10.2.2
3434

3535
## Features
3636

3737
* Conveniently add custom post processing effects à la [PPSv2](https://github.com/Unity-Technologies/PostProcessing) and [HDRP's Custom Post Process](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@8.2/manual/Custom-Post-Process.html).
3838
* Reorder effects from the editor like HDRP's [Custom Post Process Orders Settings](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@8.2/manual/Custom-Post-Process.html#effect-ordering).
3939
* Use legacy `Image Effect Shaders` and `Unlit Shader Graphs` if you wish. It worked out of the box; No work was done by me.
4040
* Use it with `Camera Stacking`.
41-
* Use the `SceneNormals` feature (adapted from [Outline Study](https://github.com/chrisloop/outlinestudy) by [Christopher Sims](https://github.com/chrisloop)) to grab the scene normals onto a texture.
4241

4342
### Features that are almost untested:
4443
* It should be compatible with **MultiPass XR** but it is tested with **Mock HMD Loader** only so I can't guarantee that it works on an actual headset.
@@ -47,7 +46,6 @@ Other custom effects in samples but not used in screenshots:
4746
## Known Issues
4847

4948
* It failed with **Single-Pass Instanced** on **Mock HMD Loader**.
50-
* The `SceneNormals` renderer feature uses the override material in the drawing settings so it doesn't copy the original materials' parameters (e.g. normal maps and alpha clipping) and doesn't respect custom vertex shaders. This should be solved in URP 10.0 with the release of the `DepthNormalsPass` made for the SSAO feature.
5149

5250
## Features I hope to implement
5351

@@ -58,7 +56,11 @@ Other custom effects in samples but not used in screenshots:
5856
## How To Install
5957

6058
Follow the instructions from the Unity manual on [Installing from a Git URL](https://docs.unity3d.com/Manual/upm-ui-giturl.html) and insert the url:
59+
<<<<<<< HEAD
6160
> https://github.com/yahiaetman/URPCustomPostProcessingStack.git#v1.1.0
61+
=======
62+
> https://github.com/yahiaetman/URPCustomPostProcessingStack.git#URP-10.2.2
63+
>>>>>>> origin/URP-10.2.2
6264
6365
The package also contains 8 example effects included as a sample.
6466

@@ -237,7 +239,8 @@ We didn't explain some stuff here but you can see more in the samples:
237239
* Create temporary render targets inside the renderer (see [StreakEffect.cs](Samples~/Examples/Scripts/PostProcessing/StreakEffect.cs)).
238240
* Create persistent render targets inside the renderer (see [AfterImageEffect.cs](Samples~/Examples/Scripts/PostProcessing/AfterImageEffect.cs)).
239241
* Use a shader graph `Unlit shader` to create a post processing effect (see [GlitchEffect.cs](Samples~/Examples/Scripts/PostProcessing/GlitchEffect.cs)).
240-
* Use a renderer at multiple injection points (see [GradientFogEffect.cs](Samples~/Examples/Scripts/PostProcessing/GradientFogEffect.cs) and [GradientFog.shader](Samples~/Examples/Resources/Shaders/PostProcessing/GradientFog.shader)).
242+
* Use a renderer at multiple injection points (see [GradientFogEffect.cs](Samples~/Examples/Scripts/PostProcessing/GradientFogEffect.cs) and [GradientFog.shader](Samples~/Examples/Resources/Shaders/PostProcessing/GradientFog.shader)).
243+
* Requesting Depth and/or Normal Textures for a post processing effect (see [GradientFogEffect.cs](Samples~/Examples/Scripts/PostProcessing/GradientFogEffect.cs) and [EdgeDetectionEffect.cs](Samples~/Examples/Scripts/PostProcessing/EdgeDetectionEffect.cs))
241244

242245
## Issues & Pull Requests
243246

Runtime/RenderFeatures/CustomPostProcess.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,18 +267,25 @@ public bool PrepareRenderers(ref RenderingData renderingData){
267267
// See if current camera is a scene view camera to skip renderers with "visibleInSceneView" = false.
268268
bool isSceneView = renderingData.cameraData.cameraType == CameraType.SceneView;
269269

270+
// Here, we will collect the inputs needed by all the custom post processing effects
271+
ScriptableRenderPassInput passInput = ScriptableRenderPassInput.None;
272+
270273
// Collect the active renderers
271274
m_ActivePostProcessRenderers.Clear();
272275
for(int index = 0; index < m_PostProcessRenderers.Count; index++){
273276
var ppRenderer = m_PostProcessRenderers[index];
274277
// Skips current renderer if "visibleInSceneView" = false and the current camera is a scene view camera.
275278
if(isSceneView && !ppRenderer.visibleInSceneView) continue;
276-
// Setup the camera for the renderer and if it will render anything, add to active renderers
279+
// Setup the camera for the renderer and if it will render anything, add to active renderers and get its required inputs
277280
if(ppRenderer.Setup(ref renderingData, injectionPoint)){
278281
m_ActivePostProcessRenderers.Add(index);
282+
passInput |= ppRenderer.input;
279283
}
280284
}
281285

286+
// Configure the pass to tell the renderer what inputs we need
287+
ConfigureInput(passInput);
288+
282289
// return if no renderers are active
283290
return m_ActivePostProcessRenderers.Count != 0;
284291
}

Runtime/RenderFeatures/CustomPostProcessRenderer.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ public abstract class CustomPostProcessRenderer : IDisposable
2828
/// </summary>
2929
public virtual bool visibleInSceneView => true;
3030

31+
/// <summary>
32+
/// Specifies the input needed by this custom post process. Default is Color only.
33+
/// </summary>
34+
public virtual ScriptableRenderPassInput input => ScriptableRenderPassInput.Color;
35+
3136
/// <summary>
3237
/// Whether the function initialize has already been called
3338
/// </summary>

Runtime/RenderFeatures/SceneNormals.cs

Lines changed: 0 additions & 156 deletions
This file was deleted.

Runtime/RenderFeatures/SceneNormals.cs.meta

Lines changed: 0 additions & 12 deletions
This file was deleted.

Runtime/RenderFeatures/SceneTransparentDepth.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ public override void Execute(ScriptableRenderContext context, ref RenderingData
102102

103103
ref CameraData cameraData = ref renderingData.cameraData;
104104
Camera camera = cameraData.camera;
105-
if (cameraData.isStereoEnabled)
106-
context.StartMultiEye(camera);
107105

108106
m_FilteringSettings.layerMask = camera.cullingMask;
109107

Samples~/Examples/Resources/Shaders/PostProcessing/EdgeDetection.shader

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
{
33
HLSLINCLUDE
44
#include "Packages/com.yetman.render-pipelines.universal.postprocess/ShaderLibrary/Core.hlsl"
5-
// In URP 10, this should be replaced by the same file from URP's ShaderLibrary
6-
#include "Packages/com.yetman.render-pipelines.universal.postprocess/ShaderLibrary/DeclareNormalsTexture.hlsl"
5+
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl"
76
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
87

98
TEXTURE2D_X(_MainTex);

Samples~/Examples/Scripts/PostProcessing/EdgeDetectionEffect.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ static class ShaderIDs {
4646

4747
// By default, the effect is visible in the scene view, but we can change that here.
4848
public override bool visibleInSceneView => true;
49+
50+
// We need Color, Depth and Normal textures to apply edge detection.
51+
public override ScriptableRenderPassInput input => ScriptableRenderPassInput.Color | ScriptableRenderPassInput.Depth | ScriptableRenderPassInput.Normal;
4952

5053
// Initialized is called only once before the first render call
5154
// so we use it to create our material

Samples~/Examples/Scripts/PostProcessing/GradientFogEffect.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ static class ShaderIDs {
5252
// By default, the effect is visible in the scene view, but we can change that here.
5353
public override bool visibleInSceneView => true;
5454

55+
// We need depth to compute the pixel distance from the camera which is required to calculate the fog
56+
public override ScriptableRenderPassInput input => ScriptableRenderPassInput.Color | ScriptableRenderPassInput.Depth;
57+
5558
// Initialized is called only once before the first render call
5659
// so we use it to create our material
5760
public override void Initialize()

0 commit comments

Comments
 (0)