浏览代码

Upgrade: 2019.3.13. Added Gradient Fog Render Pass

/demo-webinar-unitenow
andytouch 5 年前
当前提交
83bb51a8
共有 31 个文件被更改,包括 680 次插入92 次删除
  1. 2
      Assets/Data/UniversalRP/BoatDemoRenderer.asset
  2. 43
      Assets/Data/UniversalRP/BoatRetroRenderer.asset
  3. 3
      Assets/Data/UniversalRP/PipelineAsset_High.asset
  4. 2
      Assets/Data/UniversalRP/PipelineAsset_Low.asset
  5. 2
      Assets/Data/UniversalRP/PipelineAsset_Medium.asset
  6. 6
      Assets/Objects/Levels/Island/Terrain_0_0.asset
  7. 9
      Assets/Objects/Levels/Island/Terrain_1_0.asset
  8. 2
      Assets/Objects/misc/checkpoint.prefab
  9. 2
      Assets/ScriptableRenderFeatures/RetroPass/Mat_Pass_Retro.mat
  10. 2
      Assets/ScriptableRenderFeatures/RetroPass/ShaderGraph_Retro.shadergraph
  11. 2
      Assets/ScriptableRenderFeatures/SobelOutlinePass/Mat_Pass_OutlineSobel.mat
  12. 161
      Assets/scenes/demo_Island.unity
  13. 4
      Packages/manifest.json
  14. 4
      ProjectSettings/ProjectVersion.txt
  15. 4
      ProjectSettings/QualitySettings.asset
  16. 2
      Assets/ScriptableRenderFeatures/GradientFog/ShaderGraph_GradientFog.shadergraph.meta
  17. 77
      Assets/Data/UniversalRP/BoatGradientFogRenderer.asset
  18. 8
      Assets/Data/UniversalRP/BoatGradientFogRenderer.asset.meta
  19. 8
      Assets/ScriptableRenderFeatures/GradientFog.meta
  20. 102
      Assets/ScriptableRenderFeatures/RenderPasses/GradientFog.cs
  21. 11
      Assets/ScriptableRenderFeatures/RenderPasses/GradientFog.cs.meta
  22. 15
      ProjectSettings/URPProjectSettings.asset
  23. 16
      Assets/ScriptableRenderFeatures/GradientFog/GradientFogFunction.hlsl
  24. 9
      Assets/ScriptableRenderFeatures/GradientFog/GradientFogFunction.hlsl.meta
  25. 224
      Assets/ScriptableRenderFeatures/GradientFog/ShaderGraph_GradientFog.shadergraph
  26. 36
      Assets/Data/UniversalRP/BoatXRayRenderer.asset
  27. 8
      Assets/Data/UniversalRP/BoatXRayRenderer.asset.meta
  28. 8
      Assets/ScriptableRenderFeatures/DitherPass.meta
  29. 0
      /Assets/ScriptableRenderFeatures/GradientFog/ShaderGraph_GradientFog.shadergraph.meta

2
Assets/Data/UniversalRP/BoatDemoRenderer.asset


m_EditorClassIdentifier:
m_RendererFeatures:
- {fileID: 1493603568523985814}
m_RendererFeatureMap:
postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2}
shaders:
blitPS: {fileID: 4800000, guid: c17132b1f77d20942aa75f8429c0f8bc, type: 3}

m_Script: {fileID: 11500000, guid: adbe377f4f72c497faee64bc3f0580b9, type: 3}
m_Name: WaterSystem
m_EditorClassIdentifier:
m_Active: 1
settings:
causticScale: 0.25
debug: 0

43
Assets/Data/UniversalRP/BoatRetroRenderer.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-4878736563600351927
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: 804bf49869d3b4315a850958d8530433, type: 3}
m_Name: NewBlit
m_EditorClassIdentifier:
settings:
Event: 500
blitMaterial: {fileID: 2100000, guid: 03d7b241c3fee9946a8c70aa8ffc18f1, type: 2}
blitMaterialPassIndex: -1
destination: 0
textureId: _BlitPassTexture
--- !u!114 &-3189639346213710365
MonoBehaviour:
m_ObjectHideFlags: 0

m_Script: {fileID: 11500000, guid: 804bf49869d3b4315a850958d8530433, type: 3}
m_Name: Toon Pass
m_EditorClassIdentifier:
m_Active: 1
settings:
Event: 500
blitMaterial: {fileID: 2100000, guid: bb822321860d6af44a4abeb570b648d1, type: 2}

m_Script: {fileID: 11500000, guid: 804bf49869d3b4315a850958d8530433, type: 3}
m_Name: Outline Pass
m_EditorClassIdentifier:
m_Active: 1
settings:
Event: 500
blitMaterial: {fileID: 2100000, guid: 40085b480ff98a944af12796f052956e, type: 2}

- {fileID: 4860357971611268930}
- {fileID: -3189639346213710365}
- {fileID: -1317020491931952740}
- {fileID: -4878736563600351927}
- {fileID: 1874220897329291617}
m_RendererFeatureMap: 6121eddff991021a7a7cc98701d146a2
postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2}
shaders:
blitPS: {fileID: 4800000, guid: c17132b1f77d20942aa75f8429c0f8bc, type: 3}

failOperation: 0
zFailOperation: 0
m_ShadowTransparentReceive: 1
--- !u!114 &1874220897329291617
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: 804bf49869d3b4315a850958d8530433, type: 3}
m_Name: Retro Pass
m_EditorClassIdentifier:
m_Active: 1
settings:
Event: 500
blitMaterial: {fileID: 2100000, guid: 03d7b241c3fee9946a8c70aa8ffc18f1, type: 2}
blitMaterialPassIndex: -1
destination: 0
textureId: _BlitPassTexture
--- !u!114 &4860357971611268930
MonoBehaviour:
m_ObjectHideFlags: 0

m_Script: {fileID: 11500000, guid: adbe377f4f72c497faee64bc3f0580b9, type: 3}
m_Name: NewWaterSystemFeature
m_EditorClassIdentifier:
m_Active: 1
settings:
causticScale: 0.25
debug: 0

3
Assets/Data/UniversalRP/PipelineAsset_High.asset


m_RendererDataList:
- {fileID: 11400000, guid: fa301df1a78cf4a9ebe2a3139dc8be8f, type: 2}
- {fileID: 11400000, guid: 74177b577927ace4798a79666640ab41, type: 2}
m_DefaultRendererIndex: 0
- {fileID: 11400000, guid: f06a214f7c2afa545ab1295a706adaa4, type: 2}
m_DefaultRendererIndex: 2
m_RequireDepthTexture: 1
m_RequireOpaqueTexture: 1
m_OpaqueDownsampling: 0

2
Assets/Data/UniversalRP/PipelineAsset_Low.asset


m_RendererData: {fileID: 11400000, guid: fa301df1a78cf4a9ebe2a3139dc8be8f, type: 2}
m_RendererDataList:
- {fileID: 11400000, guid: fa301df1a78cf4a9ebe2a3139dc8be8f, type: 2}
- {fileID: 11400000, guid: da5d03fd77333493b9b9d22f90c457ef, type: 2}
m_DefaultRendererIndex: 0
m_RequireDepthTexture: 1
m_RequireOpaqueTexture: 1

m_SupportsDynamicBatching: 0
m_MixedLightingSupported: 1
m_DebugLevel: 0
m_PostProcessingFeatureSet: 0
m_ColorGradingMode: 0
m_ColorGradingLutSize: 16
m_ShadowType: 1

2
Assets/Data/UniversalRP/PipelineAsset_Medium.asset


m_RendererData: {fileID: 11400000, guid: fa301df1a78cf4a9ebe2a3139dc8be8f, type: 2}
m_RendererDataList:
- {fileID: 11400000, guid: fa301df1a78cf4a9ebe2a3139dc8be8f, type: 2}
- {fileID: 11400000, guid: da5d03fd77333493b9b9d22f90c457ef, type: 2}
m_DefaultRendererIndex: 0
m_RequireDepthTexture: 1
m_RequireOpaqueTexture: 1

m_SupportsDynamicBatching: 0
m_MixedLightingSupported: 1
m_DebugLevel: 0
m_PostProcessingFeatureSet: 0
m_ColorGradingMode: 0
m_ColorGradingLutSize: 16
m_ShadowType: 1

6
Assets/Objects/Levels/Island/Terrain_0_0.asset
文件差异内容过多而无法显示
查看文件

9
Assets/Objects/Levels/Island/Terrain_1_0.asset
文件差异内容过多而无法显示
查看文件

2
Assets/Objects/misc/checkpoint.prefab


- component: {fileID: 7010558061549940322}
- component: {fileID: 2022547064098935892}
- component: {fileID: 5705232510240925869}
m_Layer: 16
m_Layer: 0
m_Name: checkpoint
m_TagString: Untagged
m_Icon: {fileID: 0}

2
Assets/ScriptableRenderFeatures/RetroPass/Mat_Pass_Retro.mat


m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- Vector1_A02E52BC: 443.8
- Vector1_A02E52BC: 312
m_Colors: []

2
Assets/ScriptableRenderFeatures/RetroPass/ShaderGraph_Retro.shadergraph
文件差异内容过多而无法显示
查看文件

2
Assets/ScriptableRenderFeatures/SobelOutlinePass/Mat_Pass_OutlineSobel.mat


m_Offset: {x: 0, y: 0}
m_Floats:
- _Delta: 0.000824
- _DepthIntensity: 59
- _DepthIntensity: 668
- _Raw: 0
- _Value: 0.4
m_Colors:

161
Assets/scenes/demo_Island.unity


m_PositionOffset: 0
m_SearchRadius: 2
m_SearchResolution: 5
--- !u!1 &672498205
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 672498207}
- component: {fileID: 672498206}
m_Layer: 0
m_Name: CM vcam1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!114 &672498206
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 672498205}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 45e653bab7fb20e499bda25e1b646fea, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ExcludedPropertiesInInspector:
- m_Script
m_LockStageInInspector:
m_StreamingVersion: 20170927
m_Priority: 1000000
m_StandbyUpdate: 2
m_LookAt: {fileID: 0}
m_Follow: {fileID: 0}
m_Lens:
FieldOfView: 50
OrthographicSize: 10
NearClipPlane: 3
FarClipPlane: 1600
Dutch: 0
LensShift: {x: 0, y: 0}
m_Transitions:
m_BlendHint: 0
m_InheritPosition: 0
m_OnCameraLive:
m_PersistentCalls:
m_Calls: []
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 1748439518}
--- !u!4 &672498207
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 672498205}
m_LocalRotation: {x: 0.013050183, y: 0.80751055, z: -0.018709857, w: 0.5894118}
m_LocalPosition: {x: -103.59747, y: 4.534314, z: 71.04256}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1748439518}
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &674622423
GameObject:
m_ObjectHideFlags: 0

m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!1 &1748439517
GameObject:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1748439518}
- component: {fileID: 1748439521}
- component: {fileID: 1748439520}
- component: {fileID: 1748439519}
m_Layer: 0
m_Name: cm
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1748439518
Transform:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1748439517}
m_LocalRotation: {x: 0.03814487, y: -0.77241904, z: -0.045870308, w: 0.63230515}
m_LocalPosition: {x: 49.198013, y: -18.23489, z: 114.2276}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 672498207}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1748439519
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1748439517}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fa7155796051b734daa718462081dc5f, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BindingMode: 1
m_FollowOffset: {x: 0, y: 0, z: -10}
m_XDamping: 1
m_YDamping: 1
m_ZDamping: 1
m_AngularDampingMode: 0
m_PitchDamping: 0
m_YawDamping: 0
m_RollDamping: 0
m_AngularDamping: 0
--- !u!114 &1748439520
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1748439517}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4044717213e31446939f7bd49c896ea, type: 3}
m_Name:
m_EditorClassIdentifier:
m_TrackedObjectOffset: {x: 0, y: 0, z: 0}
m_LookaheadTime: 0
m_LookaheadSmoothing: 10
m_LookaheadIgnoreY: 0
m_HorizontalDamping: 0.5
m_VerticalDamping: 0.5
m_ScreenX: 0.5
m_ScreenY: 0.5
m_DeadZoneWidth: 0
m_DeadZoneHeight: 0
m_SoftZoneWidth: 0.8
m_SoftZoneHeight: 0.8
m_BiasX: 0
m_BiasY: 0
m_CenterOnActivate: 1
--- !u!114 &1748439521
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1748439517}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ac0b09e7857660247b1477e93731de29, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1819032311
GameObject:
m_ObjectHideFlags: 0

4
Packages/manifest.json


"com.unity.cinemachine": "2.5.0",
"com.unity.ide.rider": "1.2.1",
"com.unity.ide.visualstudio": "2.0.0",
"com.unity.ide.vscode": "1.1.4",
"com.unity.ide.vscode": "1.2.0",
"com.unity.render-pipelines.universal": "7.2.1",
"com.unity.render-pipelines.universal": "7.3.1",
"com.unity.terrain-tools": "3.0.1-preview",
"com.unity.textmeshpro": "2.1.0-preview.4",
"com.unity.timeline": "1.2.11",

4
ProjectSettings/ProjectVersion.txt


m_EditorVersion: 2019.3.0f6
m_EditorVersionWithRevision: 2019.3.0f6 (27ab2135bccf)
m_EditorVersion: 2019.3.13f1
m_EditorVersionWithRevision: 2019.3.13f1 (d4ddf0d95db9)

4
ProjectSettings/QualitySettings.asset


realtimeReflectionProbes: 1
billboardsFaceCameraPosition: 0
vSyncCount: 1
lodBias: 4
maximumLODLevel: 0
lodBias: 1
maximumLODLevel: 1
streamingMipmapsActive: 1
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512

2
Assets/ScriptableRenderFeatures/GradientFog/ShaderGraph_GradientFog.shadergraph.meta


fileFormatVersion: 2
guid: 64ba0e3339da2724cafd2e3f093a3449
guid: 5455f8e6f300a3d4c9d7118d43ecac15
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}

77
Assets/Data/UniversalRP/BoatGradientFogRenderer.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-8245398564993106213
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: 1386573b276c54a468778c523d829e91, type: 3}
m_Name: Gradient Fog
m_EditorClassIdentifier:
m_Active: 1
settings:
Event: 500
StartDistance: -8.7
EndDistance: 58
NearColor: {r: 0.42866677, g: 0.5183965, b: 0.5377358, a: 0.31764707}
MiddleColor: {r: 0.5566038, g: 0.42360774, b: 0.31243324, a: 0.72156864}
FarColor: {r: 0.40650585, g: 0.5703295, b: 0.8207547, a: 0.4117647}
--- !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: de640fe3d0db1804a85f9fc8f5cadab6, type: 3}
m_Name: BoatGradientFogRenderer
m_EditorClassIdentifier:
m_RendererFeatures:
- {fileID: 1999314579490882026}
- {fileID: -8245398564993106213}
m_RendererFeatureMap: ea41d06804febe1bdbfe11eeb075928d
postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2}
shaders:
blitPS: {fileID: 4800000, guid: c17132b1f77d20942aa75f8429c0f8bc, type: 3}
copyDepthPS: {fileID: 4800000, guid: d6dae50ee9e1bfa4db75f19f99355220, type: 3}
screenSpaceShadowPS: {fileID: 4800000, guid: 0f854b35a0cf61a429bd5dcfea30eddd,
type: 3}
samplingPS: {fileID: 4800000, guid: 04c410c9937594faa893a11dceb85f7e, type: 3}
fallbackErrorPS: {fileID: 4800000, guid: e6e9a19c3678ded42a3bc431ebef7dbd, type: 3}
m_OpaqueLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_TransparentLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_DefaultStencilState:
overrideStencilState: 0
stencilReference: 0
stencilCompareFunction: 8
passOperation: 0
failOperation: 0
zFailOperation: 0
m_ShadowTransparentReceive: 1
--- !u!114 &1999314579490882026
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: adbe377f4f72c497faee64bc3f0580b9, type: 3}
m_Name: NewWaterSystemFeature
m_EditorClassIdentifier:
m_Active: 1
settings:
causticScale: 0.25
debug: 0
causticShader: {fileID: 4800000, guid: 90939d2e4b62841d29c136c866715501, type: 3}

8
Assets/Data/UniversalRP/BoatGradientFogRenderer.asset.meta


fileFormatVersion: 2
guid: f06a214f7c2afa545ab1295a706adaa4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

8
Assets/ScriptableRenderFeatures/GradientFog.meta


fileFormatVersion: 2
guid: bf17ba41c2bec0641bd728b0ddffc92a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

102
Assets/ScriptableRenderFeatures/RenderPasses/GradientFog.cs


using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class GradientFog : ScriptableRendererFeature
{
[System.Serializable]
public class GradientFogSettings
{
public RenderPassEvent Event = RenderPassEvent.AfterRenderingOpaques;
public float StartDistance = 0;
public float EndDistance = 50;
public Color NearColor = new Color(0, 0.2f, 0.35f, 1);
public Color MiddleColor = new Color(0.62f, 0.86f, 1, 1);
public Color FarColor = new Color(0.85f, 0.96f, 1, 1);
}
class GradientFogPass : ScriptableRenderPass
{
public GradientFogSettings settings;
private Material fogMaterial;
private RenderTargetIdentifier source { get; set; }
private RenderTargetHandle m_TempTex;
public GradientFogPass()
{
m_TempTex.Init("_TempTex");
fogMaterial = new Material(Shader.Find("Shader Graphs/ShaderGraph_GradientFog"));
}
public void Setup(RenderTargetIdentifier cameraColorTarget)
{
source = cameraColorTarget;
fogMaterial.SetFloat("_StartDist", settings.StartDistance);
fogMaterial.SetFloat("_EndDist", settings.EndDistance);
fogMaterial.SetColor("_NearCol", settings.NearColor);
fogMaterial.SetColor("_MidCol", settings.MiddleColor);
fogMaterial.SetColor("_FarCol", settings.FarColor);
}
// This method is called before executing the render pass.
// It can be used to configure render targets and their clear state. Also to create temporary render target textures.
// When empty this render pass will render to the active camera render target.
// You should never call CommandBuffer.SetRenderTarget. Instead call <c>ConfigureTarget</c> and <c>ConfigureClear</c>.
// The render pipeline will ensure target setup and clearing happens in an performance manner.
public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor)
{
}
// Here you can implement the rendering logic.
// Use <c>ScriptableRenderContext</c> to issue drawing commands or execute command buffers
// https://docs.unity3d.com/ScriptReference/Rendering.ScriptableRenderContext.html
// You don't have to call ScriptableRenderContext.submit, the render pipeline will call it at specific points in the pipeline.
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
{
CommandBuffer cmd = CommandBufferPool.Get("Gradient Fog");
RenderTextureDescriptor opaqueDesc = renderingData.cameraData.cameraTargetDescriptor;
opaqueDesc.depthBufferBits = 0;
cmd.GetTemporaryRT(m_TempTex.id, opaqueDesc);
Blit(cmd, source, m_TempTex.Identifier(), fogMaterial);
Blit(cmd, m_TempTex.Identifier(), source);
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
}
/// Cleanup any allocated resources that were created during the execution of this render pass.
public override void FrameCleanup(CommandBuffer cmd)
{
cmd.ReleaseTemporaryRT(m_TempTex.id);
}
}
GradientFogPass m_GradientFogPass;
public GradientFogSettings settings = new GradientFogSettings();
public override void Create()
{
m_GradientFogPass = new GradientFogPass();
m_GradientFogPass.settings = settings;
// Configures where the render pass should be injected.
m_GradientFogPass.renderPassEvent = settings.Event;
}
// Here you can inject one or multiple render passes in the renderer.
// This method is called when setting up the renderer once per-camera.
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
var src = renderer.cameraColorTarget;
m_GradientFogPass.Setup(src);
renderer.EnqueuePass(m_GradientFogPass);
}
}

11
Assets/ScriptableRenderFeatures/RenderPasses/GradientFog.cs.meta


fileFormatVersion: 2
guid: 1386573b276c54a468778c523d829e91
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

15
ProjectSettings/URPProjectSettings.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &1
MonoBehaviour:
m_ObjectHideFlags: 61
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: 247994e1f5a72c2419c26a37e9334c01, type: 3}
m_Name:
m_EditorClassIdentifier:
m_LastMaterialVersion: 1

16
Assets/ScriptableRenderFeatures/GradientFog/GradientFogFunction.hlsl


#ifndef GRADIENTFOGFUNCTION_INCLUDED
#define GRADIENTFOGFUNCTION_INCLUDED
float4 noFog = float4(0,0,0,1);
void FogGradient_float(float4 a, float4 b, float4 c, float t, out float4 Out) {
float alpha = step(t, 0.3) * lerp(0, 0.7, t*3.3);
alpha += step(0.3, t) * lerp(0.7, 1, (t-0.3)*1.42);
float4 color = step(t, 0.3) * lerp(noFog, a, t*3.3);
color += step(0.3, t) * step(t, 0.6) * lerp(a, b, (t-0.3)*3.3);
color += step(0.6, t) * lerp(b,c, saturate((t-0.6)*2.5));
Out = float4(color.r, color.g, color.b, saturate(alpha));
}
#endif

9
Assets/ScriptableRenderFeatures/GradientFog/GradientFogFunction.hlsl.meta


fileFormatVersion: 2
guid: c09f29dd61d5ae94d82327f71a164e3a
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

224
Assets/ScriptableRenderFeatures/GradientFog/ShaderGraph_GradientFog.shadergraph
文件差异内容过多而无法显示
查看文件

36
Assets/Data/UniversalRP/BoatXRayRenderer.asset


%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: de640fe3d0db1804a85f9fc8f5cadab6, type: 3}
m_Name: BoatXRayRenderer
m_EditorClassIdentifier:
m_RendererFeatures: []
postProcessData: {fileID: 0}
shaders:
blitPS: {fileID: 0}
copyDepthPS: {fileID: 0}
screenSpaceShadowPS: {fileID: 0}
samplingPS: {fileID: 0}
fallbackErrorPS: {fileID: 0}
m_OpaqueLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_TransparentLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_DefaultStencilState:
overrideStencilState: 0
stencilReference: 0
stencilCompareFunction: 8
passOperation: 0
failOperation: 0
zFailOperation: 0
m_ShadowTransparentReceive: 1

8
Assets/Data/UniversalRP/BoatXRayRenderer.asset.meta


fileFormatVersion: 2
guid: 936e79759a86c0b48a42e4be70b6de87
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

8
Assets/ScriptableRenderFeatures/DitherPass.meta


fileFormatVersion: 2
guid: f408f669171964041b051a8fd88d3efe
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

/Assets/ScriptableRenderFeatures/DitherPass/ScreenDitherShader.shadergraph.meta → /Assets/ScriptableRenderFeatures/GradientFog/ShaderGraph_GradientFog.shadergraph.meta

正在加载...
取消
保存