From 2dbd380038b87359762cd7ea9a74c43b16bb3466 Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 14:47:24 +0900 Subject: [PATCH 01/18] enable SSAO --- .../Assets/Settings/ForwardRenderer.asset | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/shaders-urp/Assets/Settings/ForwardRenderer.asset b/shaders-urp/Assets/Settings/ForwardRenderer.asset index a12ecf3..87539d7 100644 --- a/shaders-urp/Assets/Settings/ForwardRenderer.asset +++ b/shaders-urp/Assets/Settings/ForwardRenderer.asset @@ -26,8 +26,9 @@ MonoBehaviour: probeSamplingDebugMesh: {fileID: 0} probeSamplingDebugTexture: {fileID: 0} probeVolumeBlendStatesCS: {fileID: 0} - m_RendererFeatures: [] - m_RendererFeatureMap: + m_RendererFeatures: + - {fileID: 5413041191544749068} + m_RendererFeatureMap: 0cfc94c048fc1e4b m_UseNativeRenderPass: 0 xrSystemData: {fileID: 11400000, guid: 60e1133243b97e347b653163a8c01b64, type: 2} postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2} @@ -53,3 +54,38 @@ MonoBehaviour: m_DepthTextureFormat: 0 m_AccurateGbufferNormals: 0 m_IntermediateTextureMode: 1 +--- !u!114 &5413041191544749068 +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: f62c9c65cf3354c93be831c8bc075510, type: 3} + m_Name: ScreenSpaceAmbientOcclusion + m_EditorClassIdentifier: + m_Active: 1 + m_Settings: + AOMethod: 0 + Downsample: 0 + AfterOpaque: 0 + Source: 1 + NormalSamples: 1 + Intensity: 3 + DirectLightingStrength: 0.25 + Radius: 0.035 + Samples: 1 + BlurQuality: 0 + Falloff: 100 + SampleCount: -1 + m_BlueNoise256Textures: + - {fileID: 2800000, guid: 36f118343fc974119bee3d09e2111500, type: 3} + - {fileID: 2800000, guid: 4b7b083e6b6734e8bb2838b0b50a0bc8, type: 3} + - {fileID: 2800000, guid: c06cc21c692f94f5fb5206247191eeee, type: 3} + - {fileID: 2800000, guid: cb76dd40fa7654f9587f6a344f125c9a, type: 3} + - {fileID: 2800000, guid: e32226222ff144b24bf3a5a451de54bc, type: 3} + - {fileID: 2800000, guid: 3302065f671a8450b82c9ddf07426f3a, type: 3} + - {fileID: 2800000, guid: 56a77a3e8d64f47b6afe9e3c95cb57d5, type: 3} + m_Shader: {fileID: 4800000, guid: 0849e84e3d62649e8882e9d6f056a017, type: 3} From 43f669995cb321905f4f0b65302195e83a110584 Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 14:47:31 +0900 Subject: [PATCH 02/18] add Material --- .../Assets/Materials/TransparentLit_Mat.mat | 140 ++++++++++++++++++ .../Materials/TransparentLit_Mat.mat.meta | 8 + 2 files changed, 148 insertions(+) create mode 100644 shaders-urp/Assets/Materials/TransparentLit_Mat.mat create mode 100644 shaders-urp/Assets/Materials/TransparentLit_Mat.mat.meta diff --git a/shaders-urp/Assets/Materials/TransparentLit_Mat.mat b/shaders-urp/Assets/Materials/TransparentLit_Mat.mat new file mode 100644 index 0000000..4f2bcf7 --- /dev/null +++ b/shaders-urp/Assets/Materials/TransparentLit_Mat.mat @@ -0,0 +1,140 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-7542097610588244761 +MonoBehaviour: + m_ObjectHideFlags: 11 + 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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TransparentLit_Mat + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _ALPHAPREMULTIPLY_ON + - _SURFACE_TYPE_TRANSPARENT + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent + disabledShaderPasses: + - MOTIONVECTORS + - DepthOnly + - SHADOWCASTER + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 10 + - _DstBlendAlpha: 10 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 1 + - _WorkflowMode: 1 + - _ZWrite: 0 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 0.14901961} + - _Color: {r: 1, g: 1, b: 1, a: 0.14901961} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/shaders-urp/Assets/Materials/TransparentLit_Mat.mat.meta b/shaders-urp/Assets/Materials/TransparentLit_Mat.mat.meta new file mode 100644 index 0000000..974b797 --- /dev/null +++ b/shaders-urp/Assets/Materials/TransparentLit_Mat.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 36aa6fa3a423a8d418e11e47cdbaeffe +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: From 91233a428913eacb1530033cd5b9792e4151b97e Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 14:47:37 +0900 Subject: [PATCH 03/18] add Scene --- .../Assets/Scenes/RenderGraphSimple.unity | 933 ++++++++++++++++++ .../Scenes/RenderGraphSimple.unity.meta | 7 + 2 files changed, 940 insertions(+) create mode 100644 shaders-urp/Assets/Scenes/RenderGraphSimple.unity create mode 100644 shaders-urp/Assets/Scenes/RenderGraphSimple.unity.meta diff --git a/shaders-urp/Assets/Scenes/RenderGraphSimple.unity b/shaders-urp/Assets/Scenes/RenderGraphSimple.unity new file mode 100644 index 0000000..c0e322a --- /dev/null +++ b/shaders-urp/Assets/Scenes/RenderGraphSimple.unity @@ -0,0 +1,933 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 10 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 13 + m_BakeOnSceneLoad: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &203844586 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 203844589} + - component: {fileID: 203844588} + - component: {fileID: 203844587} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &203844587 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 203844586} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Version: 3 + m_UsePipelineSettings: 1 + m_AdditionalLightsShadowResolutionTier: 2 + m_LightLayerMask: 1 + m_RenderingLayers: 1 + m_CustomShadowLayers: 0 + m_ShadowLayerMask: 1 + m_ShadowRenderingLayers: 1 + m_LightCookieSize: {x: 1, y: 1} + m_LightCookieOffset: {x: 0, y: 0} + m_SoftShadowQuality: 0 +--- !u!108 &203844588 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 203844586} + m_Enabled: 1 + serializedVersion: 11 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ForceVisible: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 + m_LightUnit: 1 + m_LuxAtDistance: 1 + m_EnableSpotReflector: 1 +--- !u!4 &203844589 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 203844586} + serializedVersion: 2 + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &516781594 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 516781598} + - component: {fileID: 516781597} + - component: {fileID: 516781596} + - component: {fileID: 516781595} + m_Layer: 0 + m_Name: TransparentCube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!65 &516781595 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 516781594} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &516781596 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 516781594} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 36aa6fa3a423a8d418e11e47cdbaeffe, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &516781597 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 516781594} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &516781598 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 516781594} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.73, y: 0.525, z: -0.849} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &611740395 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 611740399} + - component: {fileID: 611740398} + - component: {fileID: 611740397} + - component: {fileID: 611740396} + m_Layer: 0 + m_Name: Sphere + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!135 &611740396 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 611740395} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Radius: 0.5 + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &611740397 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 611740395} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &611740398 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 611740395} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &611740399 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 611740395} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1.078, y: 0.513, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &929562780 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 929562784} + - component: {fileID: 929562783} + - component: {fileID: 929562782} + - component: {fileID: 929562781} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!65 &929562781 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 929562780} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &929562782 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 929562780} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &929562783 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 929562780} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &929562784 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 929562780} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0.28943044, z: -0, w: 0.9571991} + m_LocalPosition: {x: 0, y: 0.61, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: -33.648, z: 0} +--- !u!1 &948951734 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 948951738} + - component: {fileID: 948951737} + - component: {fileID: 948951736} + - component: {fileID: 948951735} + m_Layer: 0 + m_Name: Cylinder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!136 &948951735 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 948951734} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 0.5000001 + m_Height: 2 + m_Direction: 1 + m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697} +--- !u!23 &948951736 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 948951734} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &948951737 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 948951734} + m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &948951738 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 948951734} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -2.36, y: 0.98, z: -0.56} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &961739749 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 961739753} + - component: {fileID: 961739752} + - component: {fileID: 961739751} + - component: {fileID: 961739750} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &961739750 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 961739749} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_RenderShadows: 1 + m_RequiresDepthTextureOption: 2 + m_RequiresOpaqueTextureOption: 2 + m_CameraType: 0 + m_Cameras: [] + m_RendererIndex: -1 + m_VolumeLayerMask: + serializedVersion: 2 + m_Bits: 1 + m_VolumeTrigger: {fileID: 0} + m_VolumeFrameworkUpdateModeOption: 2 + m_RenderPostProcessing: 0 + m_Antialiasing: 0 + m_AntialiasingQuality: 2 + m_StopNaN: 0 + m_Dithering: 0 + m_ClearDepth: 1 + m_AllowXRRendering: 1 + m_AllowHDROutput: 1 + m_UseScreenCoordOverride: 0 + m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} + m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} + m_RequiresDepthTexture: 0 + m_RequiresColorTexture: 0 + m_Version: 2 + m_TaaSettings: + m_Quality: 3 + m_FrameInfluence: 0.1 + m_JitterScale: 1 + m_MipBias: 0 + m_VarianceClampScale: 0.9 + m_ContrastAdaptiveSharpening: 0 +--- !u!81 &961739751 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 961739749} + m_Enabled: 1 +--- !u!20 &961739752 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 961739749} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0, g: 0, b: 0, a: 1} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &961739753 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 961739749} + serializedVersion: 2 + m_LocalRotation: {x: -0.1796808, y: 0.109739624, z: -0.020174414, w: -0.97737664} + m_LocalPosition: {x: 1.2978855, y: 2.2271373, z: -5.7068305} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &2115784193 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2115784197} + - component: {fileID: 2115784196} + - component: {fileID: 2115784195} + - component: {fileID: 2115784194} + m_Layer: 0 + m_Name: Plane + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!64 &2115784194 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2115784193} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 5 + m_Convex: 0 + m_CookingOptions: 30 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &2115784195 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2115784193} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &2115784196 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2115784193} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &2115784197 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2115784193} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 961739753} + - {fileID: 203844589} + - {fileID: 2115784197} + - {fileID: 948951738} + - {fileID: 929562784} + - {fileID: 611740399} + - {fileID: 516781598} diff --git a/shaders-urp/Assets/Scenes/RenderGraphSimple.unity.meta b/shaders-urp/Assets/Scenes/RenderGraphSimple.unity.meta new file mode 100644 index 0000000..fd56e37 --- /dev/null +++ b/shaders-urp/Assets/Scenes/RenderGraphSimple.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 75edc3546759c944caec1d93987df41c +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: From f6f67f21372468d95d82df5a6862182d66d8dba1 Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 16:38:02 +0900 Subject: [PATCH 04/18] Copying SphereVolumeComponent and DitherEffectRendererFeature --- .../Assets/Scripts/RendererFeatures.meta | 8 + .../DitherEffectRendererFeature.cs | 336 ++++++++++++++++++ .../DitherEffectRendererFeature.cs.meta | 2 + .../RendererFeatures/SphereVolumeComponent.cs | 15 + .../SphereVolumeComponent.cs.meta | 2 + 5 files changed, 363 insertions(+) create mode 100644 shaders-urp/Assets/Scripts/RendererFeatures.meta create mode 100644 shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs create mode 100644 shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs.meta create mode 100644 shaders-urp/Assets/Scripts/RendererFeatures/SphereVolumeComponent.cs create mode 100644 shaders-urp/Assets/Scripts/RendererFeatures/SphereVolumeComponent.cs.meta diff --git a/shaders-urp/Assets/Scripts/RendererFeatures.meta b/shaders-urp/Assets/Scripts/RendererFeatures.meta new file mode 100644 index 0000000..3df715e --- /dev/null +++ b/shaders-urp/Assets/Scripts/RendererFeatures.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e78f3f1858217d44393eac39bac8982e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs new file mode 100644 index 0000000..7007204 --- /dev/null +++ b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs @@ -0,0 +1,336 @@ +using UnityEngine; +using UnityEngine.Rendering.RenderGraphModule; +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; +using UnityEngine.Rendering.RenderGraphModule.Util; +//using UnityEngine.Experimental.Rendering; +//using static UnityEditor.ShaderData; + +//This example blits the active CameraColor to a new texture. It shows how to do a blit with material, and how to use the ResourceData to avoid another blit back to the active color target. +//This example is for API demonstrative purposes. + + +// This pass blits the whole screen for a given material to a temp texture, and swaps the UniversalResourceData.cameraColor to this temp texture. +// Therefor, the next pass that references the cameraColor will reference this new temp texture as the cameraColor, saving us a blit. +// Using the ResourceData, you can manage swapping of resources yourself and don't need a bespoke API like the SwapColorBuffer API that was specific for the cameraColor. +// This allows you to write more decoupled passes without the added costs of avoidable copies/blits. +public class DitherEffectPass : ScriptableRenderPass +{ + const string m_PassName = "DitherEffectPass"; + + // Material used in the blit operation. + Material m_BlitMaterial; + + // Function used to transfer the material from the renderer feature to the render pass. + public void Setup(Material mat) + { + m_BlitMaterial = mat; + + //The pass will read the current color texture. That needs to be an intermediate texture. It's not supported to use the BackBuffer as input texture. + //By setting this property, URP will automatically create an intermediate texture. + //It's good practice to set it here and not from the RenderFeature. This way, the pass is selfcontaining and you can use it to directly enqueue the pass from a monobehaviour without a RenderFeature. + requiresIntermediateTexture = true; + } + + public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) + { + var stack = VolumeManager.instance.stack; + var customEffect = stack.GetComponent(); + // Only process if the effect is active + if (!customEffect.IsActive()) + return; + + // UniversalResourceData contains all the texture handles used by the renderer, including the active color and depth textures + // The active color and depth textures are the main color and depth buffers that the camera renders into + var resourceData = frameData.Get(); + + //This should never happen since we set m_Pass.requiresIntermediateTexture = true; + //Unless you set the render event to AfterRendering, where we only have the BackBuffer. + if (resourceData.isActiveTargetBackBuffer) + { + Debug.LogError($"Skipping render pass. DitherEffectRendererFeature requires an intermediate ColorTexture, we can't use the BackBuffer as a texture input."); + return; + } + + // The destination texture is created here, + // the texture is created with the same dimensions as the active color texture + var source = resourceData.activeColorTexture; + + var destinationDesc = renderGraph.GetTextureDesc(source); + destinationDesc.name = $"CameraColor-{m_PassName}"; + destinationDesc.clearBuffer = false; + + TextureHandle destination = renderGraph.CreateTexture(destinationDesc); + + RenderGraphUtils.BlitMaterialParameters para = new(source, destination, m_BlitMaterial, 0); + renderGraph.AddBlitPass(para, passName: m_PassName); + + //FrameData allows to get and set internal pipeline buffers. Here we update the CameraColorBuffer to the texture that we just wrote to in this pass. + //Because RenderGraph manages the pipeline resources and dependencies, following up passes will correctly use the right color buffer. + //This optimization has some caveats. You have to be careful when the color buffer is persistent across frames and between different cameras, such as in camera stacking. + //In those cases you need to make sure your texture is an RTHandle and that you properly manage the lifecycle of it. + resourceData.cameraColor = destination; + } +} + +public class DitherEffectRendererFeature : ScriptableRendererFeature +{ + [Tooltip("The material used when making the blit operation.")] + public Material material; + + [Tooltip("The event where to inject the pass.")] + public RenderPassEvent injectionPoint = RenderPassEvent.AfterRenderingPostProcessing; + + DitherEffectPass m_Pass; + + // Here you can create passes and do the initialization of them. This is called everytime serialization happens. + public override void Create() + { + m_Pass = new DitherEffectPass(); + + // Configures where the render pass should be injected. + m_Pass.renderPassEvent = injectionPoint; + } + + // 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) + { + // Early exit if there are no materials. + if (material == null) + { + Debug.LogWarning("DitherEffectRendererFeature material is null and will be skipped."); + return; + } + + m_Pass.Setup(material); + renderer.EnqueuePass(m_Pass); + } +} + + + +/*using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Rendering.RenderGraphModule; +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; + +public class DitherEffectFeature : ScriptableRendererFeature +{ + // We want to call the pass after post processing + public RenderPassEvent injectionPoint = RenderPassEvent.AfterRendering; + // Material with the DitherEffect conversion shader + public Material passMaterial; + // Needed requirements for the pass + public ScriptableRenderPassInput requirements = ScriptableRenderPassInput.Color; + + public bool optimise = false; + + private static MaterialPropertyBlock s_SharedPropertyBlock = null; + + // The pass itself + private DitherEffectPass m_pass; + + public override void Create() + { + m_pass = new DitherEffectPass(passMaterial, name, optimise); + m_pass.renderPassEvent = injectionPoint; + m_pass.ConfigureInput(requirements); + } + + public void OnEnable() + { + if(s_SharedPropertyBlock == null) + s_SharedPropertyBlock = new MaterialPropertyBlock(); + } + // Adding the render pass to the renderer + public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) + { + renderer.EnqueuePass(m_pass); + } + + // Class defining the pass + internal class DitherEffectPass : ScriptableRenderPass + { + private string m_PassName; + private ProfilingSampler m_Sampler; + private Material m_Material; + private bool m_Optimise; + //private static readonly int m_BlitTextureID = Shader.PropertyToID("_BlitTexture"); + private static readonly int m_BlitScaleBiasID = Shader.PropertyToID("_BlitScaleBias"); + + /////// NON Render Graph ONLY /////// + private RTHandle m_CopiedColor; + ///////////////////////////////////// + + + ///////// Render Graph ONLY ///////// + private PassData m_PassData; + private class PassData + { + internal Material material; + internal TextureHandle source; + } + private static Material s_FrameBufferFetchMaterial; + ///////////////////////////////////// + + public DitherEffectPass(Material mat, string name, bool optimise) + { + m_PassName = name; + m_Material = mat; + m_Optimise = optimise; + + m_Sampler ??= new ProfilingSampler(GetType().Name + "_" + name); + s_FrameBufferFetchMaterial ??= UnityEngine.Resources.Load("FrameBufferFetch") as Material; + } + + [System.Obsolete] + // NON Render Graph ONLY + public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData) + { + ReAllocate(renderingData.cameraData.cameraTargetDescriptor); + } + + internal void ReAllocate(RenderTextureDescriptor desc) + { + desc.msaaSamples = 1; + desc.depthBufferBits = (int)DepthBits.None; + RenderingUtils.ReAllocateHandleIfNeeded(ref m_CopiedColor, desc, name: "_FullscreenPassColorCopy"); + } + + public void Dispose() + { + m_CopiedColor?.Release(); + } + + private static void ExecuteCopyColorPass(RasterCommandBuffer cmd, RTHandle sourceTexture, bool optimise) + { + if(!optimise) + { + Blitter.BlitTexture(cmd, sourceTexture, new Vector4(1, 1, 0, 0), 0.0f, false); + } + else + { + cmd.DrawProcedural(Matrix4x4.identity, s_FrameBufferFetchMaterial, 1, MeshTopology.Triangles, 3, 1, null); + } + } + + private static void ExecuteMainPass(RasterCommandBuffer cmd, Material material, RTHandle copiedColor) + { + s_SharedPropertyBlock.Clear(); + //if (copiedColor != null) + // s_SharedPropertyBlock.SetTexture(m_BlitTextureID, copiedColor); + + // We need to set the "_BlitScaleBias" uniform for user materials with shaders relying on core Blit.hlsl to work + s_SharedPropertyBlock.SetVector(m_BlitScaleBiasID, new Vector4(1, 1, 0, 0)); + + cmd.DrawProcedural(Matrix4x4.identity, material, 0, MeshTopology.Triangles, 4, 1, s_SharedPropertyBlock); + } + + // NON Render Graph ONLY + [System.Obsolete] + public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) + { + var stack = VolumeManager.instance.stack; + var customEffect = stack.GetComponent(); + // Only process if the effect is active + if (!customEffect.IsActive()) + return; + + // Retrieve URP camera data + ref var cameraData = ref renderingData.cameraData; + + // Get a command buffer from the pool and clear it + CommandBuffer cmd = CommandBufferPool.Get("Custom Post Processing - Dither Effect"); + cmd.Clear(); + + using (new ProfilingScope(cmd, profilingSampler)) + { + // Get the raster command buffer + RasterCommandBuffer rasterCmd = CommandBufferHelpers.GetRasterCommandBuffer(cmd); + + // Set the render target to the temporary color texture (created in OnCameraSetup()) + CoreUtils.SetRenderTarget(cmd, m_CopiedColor); + // Execute the copy pass, copying the URP camera color target to the temp color target + ExecuteCopyColorPass(rasterCmd, cameraData.renderer.cameraColorTargetHandle, m_Optimise); + + // Set the render target back to the URP camera color target + CoreUtils.SetRenderTarget(cmd, cameraData.renderer.cameraColorTargetHandle); + // Execute the blit pass with the dither effect material, sampling the copied temp color texture + ExecuteMainPass(rasterCmd, m_Material, m_CopiedColor); + } + + // Execute the command buffer and release it + context.ExecuteCommandBuffer(cmd); + CommandBufferPool.Release(cmd); + } + + // Render Graph ONLY - Recording the passes in the render graph + public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) + { + var stack = VolumeManager.instance.stack; + var customEffect = stack.GetComponent(); + // Only process if the effect is active + if (!customEffect.IsActive()) + return; + + UniversalResourceData resourceData = frameData.Get(); + + // We need a copy of the color texture as input for the blit with material + // Retrieving texture descriptor from active color texture after post process + var colCopyDesc = renderGraph.GetTextureDesc(resourceData.afterPostProcessColor); + // Changing the name + colCopyDesc.name = "_TempColorCopy"; + // Requesting the creation of a texture to Render Graph, Render Graph will allocate when needed + TextureHandle copiedColorTexture = renderGraph.CreateTexture(colCopyDesc); + + // First blit, simply copying color to intermediary texture so it can be used as input in next pass + using (var builder = renderGraph.AddRasterRenderPass(m_PassName + "_CopyPass", out var passData, m_Sampler)) + { + // Setting the URP active color texture as the source for this pass + passData.source = resourceData.activeColorTexture; + // Setting input texture to sample + if (m_Optimise){ + builder.SetInputAttachment(resourceData.activeColorTexture, 0); + }else{ + builder.UseTexture(resourceData.activeColorTexture, AccessFlags.Read); + } + // Setting output attachment + builder.SetRenderAttachment(copiedColorTexture, 0, AccessFlags.Write); + + // Execute step, simple copy + builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => + { + ExecuteCopyColorPass(rgContext.cmd, data.source, m_Optimise); + }); + } + + // Second blit with material, applying gray conversion + using (var builder = renderGraph.AddRasterRenderPass(m_PassName + "_FullScreenPass", out var passData, m_Sampler)) + { + // Setting the material + passData.source = resourceData.activeColorTexture; + passData.material = m_Material; + + // Setting input texture to sample + if (m_Optimise){ + builder.SetInputAttachment( copiedColorTexture, 0); + }else{ + // Setting the temp color texture as the source for this pass + //passData.source = copiedColorTexture; + builder.UseTexture(copiedColorTexture, AccessFlags.Read); + } + // Setting output attachment + builder.SetRenderAttachment(resourceData.activeColorTexture, 0, AccessFlags.Write); + + // Execute step, second blit with the gray scale conversion + builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => + { + ExecuteMainPass(rgContext.cmd, data.material, m_Optimise ? null : data.source); + }); + } + } + } +}*/ diff --git a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs.meta b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs.meta new file mode 100644 index 0000000..bb948c0 --- /dev/null +++ b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 5d782816b8872884fa46c86ac5d816ee \ No newline at end of file diff --git a/shaders-urp/Assets/Scripts/RendererFeatures/SphereVolumeComponent.cs b/shaders-urp/Assets/Scripts/RendererFeatures/SphereVolumeComponent.cs new file mode 100644 index 0000000..2b4e3e2 --- /dev/null +++ b/shaders-urp/Assets/Scripts/RendererFeatures/SphereVolumeComponent.cs @@ -0,0 +1,15 @@ +using System; +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; + +[Serializable, VolumeComponentMenu("Sample Scene/Terminal")] +[SupportedOnRenderPipeline(typeof(UniversalRenderPipelineAsset))] +public class SphereVolumeComponent : VolumeComponent, IPostProcessComponent +{ + // For example, an intensity parameter that goes from 0 to 1 + public ClampedFloatParameter intensity = new ClampedFloatParameter(value: 0, min: 0, max: 1, overrideState: true); + + // Tells when our effect should be rendered + public bool IsActive() => intensity.value > 0; +} \ No newline at end of file diff --git a/shaders-urp/Assets/Scripts/RendererFeatures/SphereVolumeComponent.cs.meta b/shaders-urp/Assets/Scripts/RendererFeatures/SphereVolumeComponent.cs.meta new file mode 100644 index 0000000..d5984f6 --- /dev/null +++ b/shaders-urp/Assets/Scripts/RendererFeatures/SphereVolumeComponent.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 1265ae2ded31e594bb2910a63c8bc0e9 \ No newline at end of file From 8575322f40b1b208b14ab9a2e73626036e128a7c Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 16:39:32 +0900 Subject: [PATCH 05/18] Moving --- .../Scripts/{RendererFeatures => }/SphereVolumeComponent.cs | 0 .../Scripts/{RendererFeatures => }/SphereVolumeComponent.cs.meta | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename shaders-urp/Assets/Scripts/{RendererFeatures => }/SphereVolumeComponent.cs (100%) rename shaders-urp/Assets/Scripts/{RendererFeatures => }/SphereVolumeComponent.cs.meta (100%) diff --git a/shaders-urp/Assets/Scripts/RendererFeatures/SphereVolumeComponent.cs b/shaders-urp/Assets/Scripts/SphereVolumeComponent.cs similarity index 100% rename from shaders-urp/Assets/Scripts/RendererFeatures/SphereVolumeComponent.cs rename to shaders-urp/Assets/Scripts/SphereVolumeComponent.cs diff --git a/shaders-urp/Assets/Scripts/RendererFeatures/SphereVolumeComponent.cs.meta b/shaders-urp/Assets/Scripts/SphereVolumeComponent.cs.meta similarity index 100% rename from shaders-urp/Assets/Scripts/RendererFeatures/SphereVolumeComponent.cs.meta rename to shaders-urp/Assets/Scripts/SphereVolumeComponent.cs.meta From 499fe4185818f80a15d94d9ec6b57e1482d0f519 Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 16:55:07 +0900 Subject: [PATCH 06/18] Split RendererFeature --- .../RendererFeatures/DitherEffectPass.cs | 296 ++++++++++++++++ .../RendererFeatures/DitherEffectPass.cs.meta | 2 + .../DitherEffectRendererFeature.cs | 315 +----------------- 3 files changed, 311 insertions(+), 302 deletions(-) create mode 100644 shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs create mode 100644 shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs.meta diff --git a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs new file mode 100644 index 0000000..47bfd1d --- /dev/null +++ b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs @@ -0,0 +1,296 @@ +using UnityEngine; +using UnityEngine.Rendering.RenderGraphModule; +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; +using UnityEngine.Rendering.RenderGraphModule.Util; + +//This example blits the active CameraColor to a new texture. +//It shows how to do a blit with material, and how to use the ResourceData to avoid another blit back to the active color target. +//This example is for API demonstrative purposes. + +// This pass blits the whole screen for a given material to a temp texture, and swaps the UniversalResourceData.cameraColor to this temp texture. +// Therefore, the next pass that references the cameraColor will reference this new temp texture as the cameraColor, saving us a blit. +// Using the ResourceData, you can manage swapping of resources yourself and don't need a bespoke API like the SwapColorBuffer API that was specific for the cameraColor. +// This allows you to write more decoupled passes without the added costs of avoidable copies/blits. +public class DitherEffectPass : ScriptableRenderPass { + // Function used to transfer the material from the renderer feature to the render pass. + public void Setup(Material mat) { + m_blitMaterial = mat; + + //The pass will read the current color texture. That needs to be an intermediate texture. It's not supported to use the BackBuffer as input texture. + //By setting this property, URP will automatically create an intermediate texture. + //It's good practice to set it here and not from the RenderFeature. This way, the pass is selfcontaining and you can use it to directly enqueue the pass from a monobehaviour without a RenderFeature. + requiresIntermediateTexture = true; + } + + public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { + VolumeStack stack = VolumeManager.instance.stack; + var customEffect = stack.GetComponent(); + // Only process if the effect is active + if (!customEffect.IsActive()) + return; + + // UniversalResourceData contains all the texture handles used by the renderer, including the active color and depth textures + // The active color and depth textures are the main color and depth buffers that the camera renders into + UniversalResourceData resourceData = frameData.Get(); + + //This should never happen since we set m_Pass.requiresIntermediateTexture = true; + //Unless you set the render event to AfterRendering, where we only have the BackBuffer. + if (resourceData.isActiveTargetBackBuffer) + { + Debug.LogError($"Skipping render pass. DitherEffectRendererFeature requires an intermediate ColorTexture, we can't use the BackBuffer as a texture input."); + return; + } + + // The destination texture is created here, + // the texture is created with the same dimensions as the active color texture + TextureHandle source = resourceData.activeColorTexture; + + TextureDesc destinationDesc = renderGraph.GetTextureDesc(source); + destinationDesc.name = $"CameraColor-{PASS_NAME}"; + destinationDesc.clearBuffer = false; + + TextureHandle destination = renderGraph.CreateTexture(destinationDesc); + + RenderGraphUtils.BlitMaterialParameters para = new(source, destination, m_blitMaterial, 0); + renderGraph.AddBlitPass(para, passName: PASS_NAME); + + //FrameData allows to get and set internal pipeline buffers. Here we update the CameraColorBuffer to the texture that we just wrote to in this pass. + //Because RenderGraph manages the pipeline resources and dependencies, following up passes will correctly use the right color buffer. + //This optimization has some caveats. You have to be careful when the color buffer is persistent across frames and between different cameras, such as in camera stacking. + //In those cases you need to make sure your texture is an RTHandle and that you properly manage the lifecycle of it. + resourceData.cameraColor = destination; + } + +//-------------------------------------------------------------------------------------------------------------------------------------------------------------- + + const string PASS_NAME = "DitherEffectPass"; + Material m_blitMaterial; // Material used in the blit operation. + +} + + +/*using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Rendering.RenderGraphModule; +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; + +public class DitherEffectFeature : ScriptableRendererFeature +{ + // We want to call the pass after post processing + public RenderPassEvent injectionPoint = RenderPassEvent.AfterRendering; + // Material with the DitherEffect conversion shader + public Material passMaterial; + // Needed requirements for the pass + public ScriptableRenderPassInput requirements = ScriptableRenderPassInput.Color; + + public bool optimise = false; + + private static MaterialPropertyBlock s_SharedPropertyBlock = null; + + // The pass itself + private DitherEffectPass m_pass; + + public override void Create() + { + m_pass = new DitherEffectPass(passMaterial, name, optimise); + m_pass.renderPassEvent = injectionPoint; + m_pass.ConfigureInput(requirements); + } + + public void OnEnable() + { + if(s_SharedPropertyBlock == null) + s_SharedPropertyBlock = new MaterialPropertyBlock(); + } + // Adding the render pass to the renderer + public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) + { + renderer.EnqueuePass(m_pass); + } + + // Class defining the pass + internal class DitherEffectPass : ScriptableRenderPass + { + private string m_PassName; + private ProfilingSampler m_Sampler; + private Material m_Material; + private bool m_Optimise; + //private static readonly int m_BlitTextureID = Shader.PropertyToID("_BlitTexture"); + private static readonly int m_BlitScaleBiasID = Shader.PropertyToID("_BlitScaleBias"); + + /////// NON Render Graph ONLY /////// + private RTHandle m_CopiedColor; + ///////////////////////////////////// + + + ///////// Render Graph ONLY ///////// + private PassData m_PassData; + private class PassData + { + internal Material material; + internal TextureHandle source; + } + private static Material s_FrameBufferFetchMaterial; + ///////////////////////////////////// + + public DitherEffectPass(Material mat, string name, bool optimise) + { + m_PassName = name; + m_Material = mat; + m_Optimise = optimise; + + m_Sampler ??= new ProfilingSampler(GetType().Name + "_" + name); + s_FrameBufferFetchMaterial ??= UnityEngine.Resources.Load("FrameBufferFetch") as Material; + } + + [System.Obsolete] + // NON Render Graph ONLY + public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData) + { + ReAllocate(renderingData.cameraData.cameraTargetDescriptor); + } + + internal void ReAllocate(RenderTextureDescriptor desc) + { + desc.msaaSamples = 1; + desc.depthBufferBits = (int)DepthBits.None; + RenderingUtils.ReAllocateHandleIfNeeded(ref m_CopiedColor, desc, name: "_FullscreenPassColorCopy"); + } + + public void Dispose() + { + m_CopiedColor?.Release(); + } + + private static void ExecuteCopyColorPass(RasterCommandBuffer cmd, RTHandle sourceTexture, bool optimise) + { + if(!optimise) + { + Blitter.BlitTexture(cmd, sourceTexture, new Vector4(1, 1, 0, 0), 0.0f, false); + } + else + { + cmd.DrawProcedural(Matrix4x4.identity, s_FrameBufferFetchMaterial, 1, MeshTopology.Triangles, 3, 1, null); + } + } + + private static void ExecuteMainPass(RasterCommandBuffer cmd, Material material, RTHandle copiedColor) + { + s_SharedPropertyBlock.Clear(); + //if (copiedColor != null) + // s_SharedPropertyBlock.SetTexture(m_BlitTextureID, copiedColor); + + // We need to set the "_BlitScaleBias" uniform for user materials with shaders relying on core Blit.hlsl to work + s_SharedPropertyBlock.SetVector(m_BlitScaleBiasID, new Vector4(1, 1, 0, 0)); + + cmd.DrawProcedural(Matrix4x4.identity, material, 0, MeshTopology.Triangles, 4, 1, s_SharedPropertyBlock); + } + + // NON Render Graph ONLY + [System.Obsolete] + public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) + { + var stack = VolumeManager.instance.stack; + var customEffect = stack.GetComponent(); + // Only process if the effect is active + if (!customEffect.IsActive()) + return; + + // Retrieve URP camera data + ref var cameraData = ref renderingData.cameraData; + + // Get a command buffer from the pool and clear it + CommandBuffer cmd = CommandBufferPool.Get("Custom Post Processing - Dither Effect"); + cmd.Clear(); + + using (new ProfilingScope(cmd, profilingSampler)) + { + // Get the raster command buffer + RasterCommandBuffer rasterCmd = CommandBufferHelpers.GetRasterCommandBuffer(cmd); + + // Set the render target to the temporary color texture (created in OnCameraSetup()) + CoreUtils.SetRenderTarget(cmd, m_CopiedColor); + // Execute the copy pass, copying the URP camera color target to the temp color target + ExecuteCopyColorPass(rasterCmd, cameraData.renderer.cameraColorTargetHandle, m_Optimise); + + // Set the render target back to the URP camera color target + CoreUtils.SetRenderTarget(cmd, cameraData.renderer.cameraColorTargetHandle); + // Execute the blit pass with the dither effect material, sampling the copied temp color texture + ExecuteMainPass(rasterCmd, m_Material, m_CopiedColor); + } + + // Execute the command buffer and release it + context.ExecuteCommandBuffer(cmd); + CommandBufferPool.Release(cmd); + } + + // Render Graph ONLY - Recording the passes in the render graph + public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) + { + var stack = VolumeManager.instance.stack; + var customEffect = stack.GetComponent(); + // Only process if the effect is active + if (!customEffect.IsActive()) + return; + + UniversalResourceData resourceData = frameData.Get(); + + // We need a copy of the color texture as input for the blit with material + // Retrieving texture descriptor from active color texture after post process + var colCopyDesc = renderGraph.GetTextureDesc(resourceData.afterPostProcessColor); + // Changing the name + colCopyDesc.name = "_TempColorCopy"; + // Requesting the creation of a texture to Render Graph, Render Graph will allocate when needed + TextureHandle copiedColorTexture = renderGraph.CreateTexture(colCopyDesc); + + // First blit, simply copying color to intermediary texture so it can be used as input in next pass + using (var builder = renderGraph.AddRasterRenderPass(m_PassName + "_CopyPass", out var passData, m_Sampler)) + { + // Setting the URP active color texture as the source for this pass + passData.source = resourceData.activeColorTexture; + // Setting input texture to sample + if (m_Optimise){ + builder.SetInputAttachment(resourceData.activeColorTexture, 0); + }else{ + builder.UseTexture(resourceData.activeColorTexture, AccessFlags.Read); + } + // Setting output attachment + builder.SetRenderAttachment(copiedColorTexture, 0, AccessFlags.Write); + + // Execute step, simple copy + builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => + { + ExecuteCopyColorPass(rgContext.cmd, data.source, m_Optimise); + }); + } + + // Second blit with material, applying gray conversion + using (var builder = renderGraph.AddRasterRenderPass(m_PassName + "_FullScreenPass", out var passData, m_Sampler)) + { + // Setting the material + passData.source = resourceData.activeColorTexture; + passData.material = m_Material; + + // Setting input texture to sample + if (m_Optimise){ + builder.SetInputAttachment( copiedColorTexture, 0); + }else{ + // Setting the temp color texture as the source for this pass + //passData.source = copiedColorTexture; + builder.UseTexture(copiedColorTexture, AccessFlags.Read); + } + // Setting output attachment + builder.SetRenderAttachment(resourceData.activeColorTexture, 0, AccessFlags.Write); + + // Execute step, second blit with the gray scale conversion + builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => + { + ExecuteMainPass(rgContext.cmd, data.material, m_Optimise ? null : data.source); + }); + } + } + } +}*/ diff --git a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs.meta b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs.meta new file mode 100644 index 0000000..47ed72e --- /dev/null +++ b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 41d20609487e41d4ca4a128d76763fa1 diff --git a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs index 7007204..0e6a8ba 100644 --- a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs +++ b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs @@ -1,87 +1,13 @@ using UnityEngine; -using UnityEngine.Rendering.RenderGraphModule; -using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; -using UnityEngine.Rendering.RenderGraphModule.Util; -//using UnityEngine.Experimental.Rendering; -//using static UnityEditor.ShaderData; +using UnityEngine.Serialization; -//This example blits the active CameraColor to a new texture. It shows how to do a blit with material, and how to use the ResourceData to avoid another blit back to the active color target. +//This example blits the active CameraColor to a new texture. +//It shows how to do a blit with material, and how to use the ResourceData to avoid another blit back to the active color target. //This example is for API demonstrative purposes. - -// This pass blits the whole screen for a given material to a temp texture, and swaps the UniversalResourceData.cameraColor to this temp texture. -// Therefor, the next pass that references the cameraColor will reference this new temp texture as the cameraColor, saving us a blit. -// Using the ResourceData, you can manage swapping of resources yourself and don't need a bespoke API like the SwapColorBuffer API that was specific for the cameraColor. -// This allows you to write more decoupled passes without the added costs of avoidable copies/blits. -public class DitherEffectPass : ScriptableRenderPass -{ - const string m_PassName = "DitherEffectPass"; - - // Material used in the blit operation. - Material m_BlitMaterial; - - // Function used to transfer the material from the renderer feature to the render pass. - public void Setup(Material mat) - { - m_BlitMaterial = mat; - - //The pass will read the current color texture. That needs to be an intermediate texture. It's not supported to use the BackBuffer as input texture. - //By setting this property, URP will automatically create an intermediate texture. - //It's good practice to set it here and not from the RenderFeature. This way, the pass is selfcontaining and you can use it to directly enqueue the pass from a monobehaviour without a RenderFeature. - requiresIntermediateTexture = true; - } - - public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) - { - var stack = VolumeManager.instance.stack; - var customEffect = stack.GetComponent(); - // Only process if the effect is active - if (!customEffect.IsActive()) - return; - - // UniversalResourceData contains all the texture handles used by the renderer, including the active color and depth textures - // The active color and depth textures are the main color and depth buffers that the camera renders into - var resourceData = frameData.Get(); - - //This should never happen since we set m_Pass.requiresIntermediateTexture = true; - //Unless you set the render event to AfterRendering, where we only have the BackBuffer. - if (resourceData.isActiveTargetBackBuffer) - { - Debug.LogError($"Skipping render pass. DitherEffectRendererFeature requires an intermediate ColorTexture, we can't use the BackBuffer as a texture input."); - return; - } - - // The destination texture is created here, - // the texture is created with the same dimensions as the active color texture - var source = resourceData.activeColorTexture; - - var destinationDesc = renderGraph.GetTextureDesc(source); - destinationDesc.name = $"CameraColor-{m_PassName}"; - destinationDesc.clearBuffer = false; - - TextureHandle destination = renderGraph.CreateTexture(destinationDesc); - - RenderGraphUtils.BlitMaterialParameters para = new(source, destination, m_BlitMaterial, 0); - renderGraph.AddBlitPass(para, passName: m_PassName); - - //FrameData allows to get and set internal pipeline buffers. Here we update the CameraColorBuffer to the texture that we just wrote to in this pass. - //Because RenderGraph manages the pipeline resources and dependencies, following up passes will correctly use the right color buffer. - //This optimization has some caveats. You have to be careful when the color buffer is persistent across frames and between different cameras, such as in camera stacking. - //In those cases you need to make sure your texture is an RTHandle and that you properly manage the lifecycle of it. - resourceData.cameraColor = destination; - } -} - public class DitherEffectRendererFeature : ScriptableRendererFeature { - [Tooltip("The material used when making the blit operation.")] - public Material material; - - [Tooltip("The event where to inject the pass.")] - public RenderPassEvent injectionPoint = RenderPassEvent.AfterRenderingPostProcessing; - - DitherEffectPass m_Pass; // Here you can create passes and do the initialization of them. This is called everytime serialization happens. public override void Create() @@ -97,240 +23,25 @@ public override void Create() public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) { // Early exit if there are no materials. - if (material == null) + if (m_blitMaterial == null) { Debug.LogWarning("DitherEffectRendererFeature material is null and will be skipped."); return; } - m_Pass.Setup(material); + m_Pass.Setup(m_blitMaterial); renderer.EnqueuePass(m_Pass); } -} - - - -/*using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Rendering.RenderGraphModule; -using UnityEngine.Rendering; -using UnityEngine.Rendering.Universal; - -public class DitherEffectFeature : ScriptableRendererFeature -{ - // We want to call the pass after post processing - public RenderPassEvent injectionPoint = RenderPassEvent.AfterRendering; - // Material with the DitherEffect conversion shader - public Material passMaterial; - // Needed requirements for the pass - public ScriptableRenderPassInput requirements = ScriptableRenderPassInput.Color; - - public bool optimise = false; - - private static MaterialPropertyBlock s_SharedPropertyBlock = null; - - // The pass itself - private DitherEffectPass m_pass; - - public override void Create() - { - m_pass = new DitherEffectPass(passMaterial, name, optimise); - m_pass.renderPassEvent = injectionPoint; - m_pass.ConfigureInput(requirements); - } - - public void OnEnable() - { - if(s_SharedPropertyBlock == null) - s_SharedPropertyBlock = new MaterialPropertyBlock(); - } - // Adding the render pass to the renderer - public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) - { - renderer.EnqueuePass(m_pass); - } - - // Class defining the pass - internal class DitherEffectPass : ScriptableRenderPass - { - private string m_PassName; - private ProfilingSampler m_Sampler; - private Material m_Material; - private bool m_Optimise; - //private static readonly int m_BlitTextureID = Shader.PropertyToID("_BlitTexture"); - private static readonly int m_BlitScaleBiasID = Shader.PropertyToID("_BlitScaleBias"); - - /////// NON Render Graph ONLY /////// - private RTHandle m_CopiedColor; - ///////////////////////////////////// - - - ///////// Render Graph ONLY ///////// - private PassData m_PassData; - private class PassData - { - internal Material material; - internal TextureHandle source; - } - private static Material s_FrameBufferFetchMaterial; - ///////////////////////////////////// - - public DitherEffectPass(Material mat, string name, bool optimise) - { - m_PassName = name; - m_Material = mat; - m_Optimise = optimise; - m_Sampler ??= new ProfilingSampler(GetType().Name + "_" + name); - s_FrameBufferFetchMaterial ??= UnityEngine.Resources.Load("FrameBufferFetch") as Material; - } +//-------------------------------------------------------------------------------------------------------------------------------------------------------------- - [System.Obsolete] - // NON Render Graph ONLY - public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData) - { - ReAllocate(renderingData.cameraData.cameraTargetDescriptor); - } - - internal void ReAllocate(RenderTextureDescriptor desc) - { - desc.msaaSamples = 1; - desc.depthBufferBits = (int)DepthBits.None; - RenderingUtils.ReAllocateHandleIfNeeded(ref m_CopiedColor, desc, name: "_FullscreenPassColorCopy"); - } - - public void Dispose() - { - m_CopiedColor?.Release(); - } - - private static void ExecuteCopyColorPass(RasterCommandBuffer cmd, RTHandle sourceTexture, bool optimise) - { - if(!optimise) - { - Blitter.BlitTexture(cmd, sourceTexture, new Vector4(1, 1, 0, 0), 0.0f, false); - } - else - { - cmd.DrawProcedural(Matrix4x4.identity, s_FrameBufferFetchMaterial, 1, MeshTopology.Triangles, 3, 1, null); - } - } - - private static void ExecuteMainPass(RasterCommandBuffer cmd, Material material, RTHandle copiedColor) - { - s_SharedPropertyBlock.Clear(); - //if (copiedColor != null) - // s_SharedPropertyBlock.SetTexture(m_BlitTextureID, copiedColor); + [FormerlySerializedAs("material")] [Tooltip("The material used when making the blit operation.")] + public Material m_blitMaterial; - // We need to set the "_BlitScaleBias" uniform for user materials with shaders relying on core Blit.hlsl to work - s_SharedPropertyBlock.SetVector(m_BlitScaleBiasID, new Vector4(1, 1, 0, 0)); - - cmd.DrawProcedural(Matrix4x4.identity, material, 0, MeshTopology.Triangles, 4, 1, s_SharedPropertyBlock); - } - - // NON Render Graph ONLY - [System.Obsolete] - public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) - { - var stack = VolumeManager.instance.stack; - var customEffect = stack.GetComponent(); - // Only process if the effect is active - if (!customEffect.IsActive()) - return; - - // Retrieve URP camera data - ref var cameraData = ref renderingData.cameraData; - - // Get a command buffer from the pool and clear it - CommandBuffer cmd = CommandBufferPool.Get("Custom Post Processing - Dither Effect"); - cmd.Clear(); - - using (new ProfilingScope(cmd, profilingSampler)) - { - // Get the raster command buffer - RasterCommandBuffer rasterCmd = CommandBufferHelpers.GetRasterCommandBuffer(cmd); - - // Set the render target to the temporary color texture (created in OnCameraSetup()) - CoreUtils.SetRenderTarget(cmd, m_CopiedColor); - // Execute the copy pass, copying the URP camera color target to the temp color target - ExecuteCopyColorPass(rasterCmd, cameraData.renderer.cameraColorTargetHandle, m_Optimise); - - // Set the render target back to the URP camera color target - CoreUtils.SetRenderTarget(cmd, cameraData.renderer.cameraColorTargetHandle); - // Execute the blit pass with the dither effect material, sampling the copied temp color texture - ExecuteMainPass(rasterCmd, m_Material, m_CopiedColor); - } - - // Execute the command buffer and release it - context.ExecuteCommandBuffer(cmd); - CommandBufferPool.Release(cmd); - } - - // Render Graph ONLY - Recording the passes in the render graph - public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) - { - var stack = VolumeManager.instance.stack; - var customEffect = stack.GetComponent(); - // Only process if the effect is active - if (!customEffect.IsActive()) - return; - - UniversalResourceData resourceData = frameData.Get(); - - // We need a copy of the color texture as input for the blit with material - // Retrieving texture descriptor from active color texture after post process - var colCopyDesc = renderGraph.GetTextureDesc(resourceData.afterPostProcessColor); - // Changing the name - colCopyDesc.name = "_TempColorCopy"; - // Requesting the creation of a texture to Render Graph, Render Graph will allocate when needed - TextureHandle copiedColorTexture = renderGraph.CreateTexture(colCopyDesc); - - // First blit, simply copying color to intermediary texture so it can be used as input in next pass - using (var builder = renderGraph.AddRasterRenderPass(m_PassName + "_CopyPass", out var passData, m_Sampler)) - { - // Setting the URP active color texture as the source for this pass - passData.source = resourceData.activeColorTexture; - // Setting input texture to sample - if (m_Optimise){ - builder.SetInputAttachment(resourceData.activeColorTexture, 0); - }else{ - builder.UseTexture(resourceData.activeColorTexture, AccessFlags.Read); - } - // Setting output attachment - builder.SetRenderAttachment(copiedColorTexture, 0, AccessFlags.Write); - - // Execute step, simple copy - builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => - { - ExecuteCopyColorPass(rgContext.cmd, data.source, m_Optimise); - }); - } - - // Second blit with material, applying gray conversion - using (var builder = renderGraph.AddRasterRenderPass(m_PassName + "_FullScreenPass", out var passData, m_Sampler)) - { - // Setting the material - passData.source = resourceData.activeColorTexture; - passData.material = m_Material; + [Tooltip("The event where to inject the pass.")] + public RenderPassEvent injectionPoint = RenderPassEvent.AfterRenderingPostProcessing; - // Setting input texture to sample - if (m_Optimise){ - builder.SetInputAttachment( copiedColorTexture, 0); - }else{ - // Setting the temp color texture as the source for this pass - //passData.source = copiedColorTexture; - builder.UseTexture(copiedColorTexture, AccessFlags.Read); - } - // Setting output attachment - builder.SetRenderAttachment(resourceData.activeColorTexture, 0, AccessFlags.Write); + DitherEffectPass m_Pass; + +} - // Execute step, second blit with the gray scale conversion - builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => - { - ExecuteMainPass(rgContext.cmd, data.material, m_Optimise ? null : data.source); - }); - } - } - } -}*/ From eaaa1313b591a36886465865c694a81dc9be82c2 Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 16:56:36 +0900 Subject: [PATCH 07/18] minor --- .../DitherEffectRendererFeature.cs | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs index 0e6a8ba..c9a399e 100644 --- a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs +++ b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs @@ -6,42 +6,37 @@ //It shows how to do a blit with material, and how to use the ResourceData to avoid another blit back to the active color target. //This example is for API demonstrative purposes. -public class DitherEffectRendererFeature : ScriptableRendererFeature -{ +public class DitherEffectRendererFeature : ScriptableRendererFeature { // Here you can create passes and do the initialization of them. This is called everytime serialization happens. - public override void Create() - { - m_Pass = new DitherEffectPass(); - - // Configures where the render pass should be injected. - m_Pass.renderPassEvent = injectionPoint; + public override void Create() { + m_pass = new DitherEffectPass { + renderPassEvent = m_injectionPoint + }; } // 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) - { + public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) { // Early exit if there are no materials. - if (m_blitMaterial == null) - { + if (m_blitMaterial == null) { Debug.LogWarning("DitherEffectRendererFeature material is null and will be skipped."); return; } - m_Pass.Setup(m_blitMaterial); - renderer.EnqueuePass(m_Pass); + m_pass.Setup(m_blitMaterial); + renderer.EnqueuePass(m_pass); } //-------------------------------------------------------------------------------------------------------------------------------------------------------------- - [FormerlySerializedAs("material")] [Tooltip("The material used when making the blit operation.")] + [Tooltip("The material used when making the blit operation.")] public Material m_blitMaterial; [Tooltip("The event where to inject the pass.")] - public RenderPassEvent injectionPoint = RenderPassEvent.AfterRenderingPostProcessing; + public RenderPassEvent m_injectionPoint = RenderPassEvent.AfterRenderingPostProcessing; - DitherEffectPass m_Pass; + private DitherEffectPass m_pass; } From 0dbdc90d6403399f3921537f0e30ade8e6280a8f Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 16:57:08 +0900 Subject: [PATCH 08/18] minor --- .../Scripts/RendererFeatures/DitherEffectRendererFeature.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs index c9a399e..e7d1f4e 100644 --- a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs +++ b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs @@ -1,6 +1,5 @@ using UnityEngine; using UnityEngine.Rendering.Universal; -using UnityEngine.Serialization; //This example blits the active CameraColor to a new texture. //It shows how to do a blit with material, and how to use the ResourceData to avoid another blit back to the active color target. @@ -31,10 +30,10 @@ public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingD //-------------------------------------------------------------------------------------------------------------------------------------------------------------- [Tooltip("The material used when making the blit operation.")] - public Material m_blitMaterial; + [SerializeField] private Material m_blitMaterial; [Tooltip("The event where to inject the pass.")] - public RenderPassEvent m_injectionPoint = RenderPassEvent.AfterRenderingPostProcessing; + [SerializeField] private RenderPassEvent m_injectionPoint = RenderPassEvent.AfterRenderingPostProcessing; private DitherEffectPass m_pass; From f498658bcf5e59dc2062bd422541ffcdf47e72c9 Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 17:00:22 +0900 Subject: [PATCH 09/18] minor --- .../Scripts/RendererFeatures/DitherEffectPass.cs | 14 +++++++------- .../DitherEffectRendererFeature.cs | 4 ---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs index 47bfd1d..47080b8 100644 --- a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs +++ b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs @@ -19,16 +19,17 @@ public void Setup(Material mat) { //The pass will read the current color texture. That needs to be an intermediate texture. It's not supported to use the BackBuffer as input texture. //By setting this property, URP will automatically create an intermediate texture. - //It's good practice to set it here and not from the RenderFeature. This way, the pass is selfcontaining and you can use it to directly enqueue the pass from a monobehaviour without a RenderFeature. + //It's good practice to set it here and not from the RenderFeature. + //This way, the pass is self containing and you can use it to directly enqueue the pass from a monobehaviour without a RenderFeature. requiresIntermediateTexture = true; } public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { VolumeStack stack = VolumeManager.instance.stack; - var customEffect = stack.GetComponent(); - // Only process if the effect is active - if (!customEffect.IsActive()) - return; + SphereVolumeComponent customEffect = stack.GetComponent(); + // Only process if the effect is active + if (!customEffect.IsActive()) + return; // UniversalResourceData contains all the texture handles used by the renderer, including the active color and depth textures // The active color and depth textures are the main color and depth buffers that the camera renders into @@ -36,8 +37,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer //This should never happen since we set m_Pass.requiresIntermediateTexture = true; //Unless you set the render event to AfterRendering, where we only have the BackBuffer. - if (resourceData.isActiveTargetBackBuffer) - { + if (resourceData.isActiveTargetBackBuffer) { Debug.LogError($"Skipping render pass. DitherEffectRendererFeature requires an intermediate ColorTexture, we can't use the BackBuffer as a texture input."); return; } diff --git a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs index e7d1f4e..7c63df6 100644 --- a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs +++ b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectRendererFeature.cs @@ -1,10 +1,6 @@ using UnityEngine; using UnityEngine.Rendering.Universal; -//This example blits the active CameraColor to a new texture. -//It shows how to do a blit with material, and how to use the ResourceData to avoid another blit back to the active color target. -//This example is for API demonstrative purposes. - public class DitherEffectRendererFeature : ScriptableRendererFeature { // Here you can create passes and do the initialization of them. This is called everytime serialization happens. From 4204f7d604c2afffe321ab07f418b156a2bec55b Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 17:02:38 +0900 Subject: [PATCH 10/18] Rename VolumeComponent --- .../Assets/Scripts/CustomDitherVolumeComponent.cs | 14 ++++++++++++++ ...s.meta => CustomDitherVolumeComponent.cs.meta} | 0 .../Scripts/RendererFeatures/DitherEffectPass.cs | 2 +- .../Assets/Scripts/SphereVolumeComponent.cs | 15 --------------- 4 files changed, 15 insertions(+), 16 deletions(-) create mode 100644 shaders-urp/Assets/Scripts/CustomDitherVolumeComponent.cs rename shaders-urp/Assets/Scripts/{SphereVolumeComponent.cs.meta => CustomDitherVolumeComponent.cs.meta} (100%) delete mode 100644 shaders-urp/Assets/Scripts/SphereVolumeComponent.cs diff --git a/shaders-urp/Assets/Scripts/CustomDitherVolumeComponent.cs b/shaders-urp/Assets/Scripts/CustomDitherVolumeComponent.cs new file mode 100644 index 0000000..22680fd --- /dev/null +++ b/shaders-urp/Assets/Scripts/CustomDitherVolumeComponent.cs @@ -0,0 +1,14 @@ +using System; +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; + +[Serializable, VolumeComponentMenu("Custom/Dither")] +[SupportedOnRenderPipeline(typeof(UniversalRenderPipelineAsset))] +public class CustomDitherVolumeComponent : VolumeComponent, IPostProcessComponent +{ + [SerializeField] private ClampedFloatParameter m_intensity = new ClampedFloatParameter(value: 0, min: 0, max: 1, overrideState: true); + + // Tells when our effect should be rendered + public bool IsActive() => m_intensity.value > 0; +} \ No newline at end of file diff --git a/shaders-urp/Assets/Scripts/SphereVolumeComponent.cs.meta b/shaders-urp/Assets/Scripts/CustomDitherVolumeComponent.cs.meta similarity index 100% rename from shaders-urp/Assets/Scripts/SphereVolumeComponent.cs.meta rename to shaders-urp/Assets/Scripts/CustomDitherVolumeComponent.cs.meta diff --git a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs index 47080b8..d0121a8 100644 --- a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs +++ b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs @@ -26,7 +26,7 @@ public void Setup(Material mat) { public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { VolumeStack stack = VolumeManager.instance.stack; - SphereVolumeComponent customEffect = stack.GetComponent(); + CustomDitherVolumeComponent customEffect = stack.GetComponent(); // Only process if the effect is active if (!customEffect.IsActive()) return; diff --git a/shaders-urp/Assets/Scripts/SphereVolumeComponent.cs b/shaders-urp/Assets/Scripts/SphereVolumeComponent.cs deleted file mode 100644 index 2b4e3e2..0000000 --- a/shaders-urp/Assets/Scripts/SphereVolumeComponent.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using UnityEngine; -using UnityEngine.Rendering; -using UnityEngine.Rendering.Universal; - -[Serializable, VolumeComponentMenu("Sample Scene/Terminal")] -[SupportedOnRenderPipeline(typeof(UniversalRenderPipelineAsset))] -public class SphereVolumeComponent : VolumeComponent, IPostProcessComponent -{ - // For example, an intensity parameter that goes from 0 to 1 - public ClampedFloatParameter intensity = new ClampedFloatParameter(value: 0, min: 0, max: 1, overrideState: true); - - // Tells when our effect should be rendered - public bool IsActive() => intensity.value > 0; -} \ No newline at end of file From cce998f229ae2d11f7cff66e9ce3a6949f81c750 Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 17:02:56 +0900 Subject: [PATCH 11/18] minor --- shaders-urp/Assets/Scripts/CustomDitherVolumeComponent.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/shaders-urp/Assets/Scripts/CustomDitherVolumeComponent.cs b/shaders-urp/Assets/Scripts/CustomDitherVolumeComponent.cs index 22680fd..9886ede 100644 --- a/shaders-urp/Assets/Scripts/CustomDitherVolumeComponent.cs +++ b/shaders-urp/Assets/Scripts/CustomDitherVolumeComponent.cs @@ -5,10 +5,8 @@ [Serializable, VolumeComponentMenu("Custom/Dither")] [SupportedOnRenderPipeline(typeof(UniversalRenderPipelineAsset))] -public class CustomDitherVolumeComponent : VolumeComponent, IPostProcessComponent -{ +public class CustomDitherVolumeComponent : VolumeComponent, IPostProcessComponent { [SerializeField] private ClampedFloatParameter m_intensity = new ClampedFloatParameter(value: 0, min: 0, max: 1, overrideState: true); - - // Tells when our effect should be rendered - public bool IsActive() => m_intensity.value > 0; + + public bool IsActive() => m_intensity.value > 0; // Tells when our effect should be rendered } \ No newline at end of file From c8f2ddc4fc255a24874e16cc2885aa1c4747183e Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 17:11:21 +0900 Subject: [PATCH 12/18] Adding shaders --- shaders-urp/Assets/Shaders.meta | 8 +++++++ .../Assets/Shaders/FrameBufferFetch.hlsl | 23 +++++++++++++++++++ .../Assets/Shaders/FrameBufferFetch.hlsl.meta | 7 ++++++ 3 files changed, 38 insertions(+) create mode 100644 shaders-urp/Assets/Shaders.meta create mode 100644 shaders-urp/Assets/Shaders/FrameBufferFetch.hlsl create mode 100644 shaders-urp/Assets/Shaders/FrameBufferFetch.hlsl.meta diff --git a/shaders-urp/Assets/Shaders.meta b/shaders-urp/Assets/Shaders.meta new file mode 100644 index 0000000..84e36a9 --- /dev/null +++ b/shaders-urp/Assets/Shaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 328040ccd9c985b49bdabef4e2693ab6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/shaders-urp/Assets/Shaders/FrameBufferFetch.hlsl b/shaders-urp/Assets/Shaders/FrameBufferFetch.hlsl new file mode 100644 index 0000000..1705568 --- /dev/null +++ b/shaders-urp/Assets/Shaders/FrameBufferFetch.hlsl @@ -0,0 +1,23 @@ +#ifndef FRAMEBUFFER_FETCH +#define FRAMEBUFFER_FETCH + +#ifdef SHADERGRAPH_PREVIEW +#else +#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" +// Declare the framebuffer input as a texture 2d containing float. +FRAMEBUFFER_INPUT_X_FLOAT(0); +#endif + +void FragFrameBufferFetch_float(float2 clipPos, out float3 outFbf) +{ +#ifdef SHADERGRAPH_PREVIEW + float4 color = float4(1,1,1,1); +#else + // Read previous subpass result directly from the framebuffer. + float4 color = LOAD_FRAMEBUFFER_X_INPUT(0, clipPos); +#endif + + outFbf = color.xyz; +} + +#endif diff --git a/shaders-urp/Assets/Shaders/FrameBufferFetch.hlsl.meta b/shaders-urp/Assets/Shaders/FrameBufferFetch.hlsl.meta new file mode 100644 index 0000000..efe7d59 --- /dev/null +++ b/shaders-urp/Assets/Shaders/FrameBufferFetch.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 501de7d1519ff4c4faf27be8f6a96b55 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: From a677f2a5220405e320da9d615fd0ad318466acde Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 17:11:43 +0900 Subject: [PATCH 13/18] adding dither shader --- .../Assets/Materials/TwoToneDither_Mat.mat | 140 ++ .../Materials/TwoToneDither_Mat.mat.meta | 8 + .../TwoToneDither_FullScreen.shadergraph | 1787 +++++++++++++++++ .../TwoToneDither_FullScreen.shadergraph.meta | 10 + 4 files changed, 1945 insertions(+) create mode 100644 shaders-urp/Assets/Materials/TwoToneDither_Mat.mat create mode 100644 shaders-urp/Assets/Materials/TwoToneDither_Mat.mat.meta create mode 100644 shaders-urp/Assets/ShaderGraphs/TwoToneDither_FullScreen.shadergraph create mode 100644 shaders-urp/Assets/ShaderGraphs/TwoToneDither_FullScreen.shadergraph.meta diff --git a/shaders-urp/Assets/Materials/TwoToneDither_Mat.mat b/shaders-urp/Assets/Materials/TwoToneDither_Mat.mat new file mode 100644 index 0000000..99cf64b --- /dev/null +++ b/shaders-urp/Assets/Materials/TwoToneDither_Mat.mat @@ -0,0 +1,140 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-4319710453331108620 +MonoBehaviour: + m_ObjectHideFlags: 11 + 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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TwoToneDither_Mat + m_Shader: {fileID: -6465566751694194690, guid: 5bacd8bcfc824684c85722b98cc86dfe, + type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _Dither_Scale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Step_Threshold: 0 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorA: {r: 0.2830189, g: 0.10279459, b: 0.10279459, a: 0} + - _ColorB: {r: 0.5215139, g: 0.9622642, b: 0.49474904, a: 0} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/shaders-urp/Assets/Materials/TwoToneDither_Mat.mat.meta b/shaders-urp/Assets/Materials/TwoToneDither_Mat.mat.meta new file mode 100644 index 0000000..c9f4785 --- /dev/null +++ b/shaders-urp/Assets/Materials/TwoToneDither_Mat.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 90057bb3471f9af43b7530912b0bfd12 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/shaders-urp/Assets/ShaderGraphs/TwoToneDither_FullScreen.shadergraph b/shaders-urp/Assets/ShaderGraphs/TwoToneDither_FullScreen.shadergraph new file mode 100644 index 0000000..2f94db9 --- /dev/null +++ b/shaders-urp/Assets/ShaderGraphs/TwoToneDither_FullScreen.shadergraph @@ -0,0 +1,1787 @@ +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.GraphData", + "m_ObjectId": "4b894517388d42ef823d8b83fa612e26", + "m_Properties": [ + { + "m_Id": "038ee04dd5c44c59adfdd2a81b2dc0b2" + }, + { + "m_Id": "d3288fbc63dc494fb6eaea6d4ec231ef" + }, + { + "m_Id": "dc395505e6a94b78b87f9559b4d2e720" + }, + { + "m_Id": "76f3b57623df4304a87f0f2cbf3c7fea" + } + ], + "m_Keywords": [], + "m_Dropdowns": [], + "m_CategoryData": [ + { + "m_Id": "e5688d4a6446433e8c22b67dc1cf4efa" + } + ], + "m_Nodes": [ + { + "m_Id": "307127996ed94ca6883c32d86cfc747a" + }, + { + "m_Id": "fd183f4c1a4443c99dffa96b76b68e5f" + }, + { + "m_Id": "6f16b9a25e2e45f9ab6a2e720863e24a" + }, + { + "m_Id": "d6c221eee6ff4e49a097d521b5b5b1f8" + }, + { + "m_Id": "399a8f59e4144b7f828fda4fcd443454" + }, + { + "m_Id": "4c3b5acdde324d4a9b5c42c440b26a55" + }, + { + "m_Id": "9f376bf41a1148f787317e673232f9fc" + }, + { + "m_Id": "54835e022883497fbb75f7ff82f9a0ca" + }, + { + "m_Id": "260e7c56065d4e1d90da0e52d012d0c2" + }, + { + "m_Id": "9f36ebbc7fb5477091b40a0833a779de" + }, + { + "m_Id": "fea87f1e34714d0e8c1e30d47923b804" + }, + { + "m_Id": "236d6a9102cc4b9eb33d9df09901ec5d" + }, + { + "m_Id": "cd235a6e0b1146a8b2f57fee1aed4942" + }, + { + "m_Id": "8d8dd65ffc564c1bb8f2e23b5f4f4a8e" + }, + { + "m_Id": "6084a878f8334517a885db5a830751c8" + } + ], + "m_GroupDatas": [ + { + "m_Id": "50bdaf609c8e4d8e976ffec3becd616f" + }, + { + "m_Id": "0a911764a532477b860a6b4a00bb3374" + } + ], + "m_StickyNoteDatas": [], + "m_Edges": [ + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "236d6a9102cc4b9eb33d9df09901ec5d" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "54835e022883497fbb75f7ff82f9a0ca" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "260e7c56065d4e1d90da0e52d012d0c2" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "9f36ebbc7fb5477091b40a0833a779de" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "399a8f59e4144b7f828fda4fcd443454" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "54835e022883497fbb75f7ff82f9a0ca" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "4c3b5acdde324d4a9b5c42c440b26a55" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "d6c221eee6ff4e49a097d521b5b5b1f8" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "54835e022883497fbb75f7ff82f9a0ca" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "307127996ed94ca6883c32d86cfc747a" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "6f16b9a25e2e45f9ab6a2e720863e24a" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "4c3b5acdde324d4a9b5c42c440b26a55" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "8d8dd65ffc564c1bb8f2e23b5f4f4a8e" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "6084a878f8334517a885db5a830751c8" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9f36ebbc7fb5477091b40a0833a779de" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "d6c221eee6ff4e49a097d521b5b5b1f8" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9f376bf41a1148f787317e673232f9fc" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "399a8f59e4144b7f828fda4fcd443454" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "cd235a6e0b1146a8b2f57fee1aed4942" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "54835e022883497fbb75f7ff82f9a0ca" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "d6c221eee6ff4e49a097d521b5b5b1f8" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "399a8f59e4144b7f828fda4fcd443454" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "fea87f1e34714d0e8c1e30d47923b804" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "9f36ebbc7fb5477091b40a0833a779de" + }, + "m_SlotId": 1 + } + } + ], + "m_VertexContext": { + "m_Position": { + "x": 396.0, + "y": 144.0 + }, + "m_Blocks": [] + }, + "m_FragmentContext": { + "m_Position": { + "x": 396.0, + "y": 343.9999694824219 + }, + "m_Blocks": [ + { + "m_Id": "307127996ed94ca6883c32d86cfc747a" + }, + { + "m_Id": "fd183f4c1a4443c99dffa96b76b68e5f" + } + ] + }, + "m_PreviewData": { + "serializedMesh": { + "m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "preventRotation": false + }, + "m_Path": "Shader Graphs", + "m_GraphPrecision": 1, + "m_PreviewMode": 2, + "m_OutputNode": { + "m_Id": "" + }, + "m_SubDatas": [], + "m_ActiveTargets": [ + { + "m_Id": "25a3599bef00495e80bbb464e473f7c8" + } + ] +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "038ee04dd5c44c59adfdd2a81b2dc0b2", + "m_Guid": { + "m_GuidSerialized": "da28b2b6-220f-4338-b01f-e4e0be8a9066" + }, + "m_Name": "Step Threshold", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Step Threshold", + "m_DefaultReferenceName": "_Step_Threshold", + "m_OverrideReferenceName": "", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_DismissedVersion": 0, + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 0, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.GroupData", + "m_ObjectId": "0a911764a532477b860a6b4a00bb3374", + "m_Title": "FrameBuffer Fetch", + "m_Position": { + "x": -1367.4285888671875, + "y": 83.42855834960938 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "1339941f19f149678b9fea041a9a15c0", + "m_Id": 0, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "17156d19edb54a4897f80adb7d990b2a", + "m_Id": 0, + "m_DisplayName": "color", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "color", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBAMaterialSlot", + "m_ObjectId": "1edbf32e89a344baa0b60eb4989e4469", + "m_Id": 2, + "m_DisplayName": "Output", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Output", + "m_StageCapability": 2, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 1.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "236d6a9102cc4b9eb33d9df09901ec5d", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -116.66667938232422, + "y": 308.0, + "width": 113.33334350585938, + "height": 36.0 + } + }, + "m_Slots": [ + { + "m_Id": "7087ff9704724698a6b5cd605e2c497d" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "d3288fbc63dc494fb6eaea6d4ec231ef" + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget", + "m_ObjectId": "25a3599bef00495e80bbb464e473f7c8", + "m_Datas": [ + { + "m_Id": "ed88d2e75891447bb5206eec985a08fb" + } + ], + "m_ActiveSubTarget": { + "m_Id": "3e155fc0e3f24eb4aceb224c2ee96786" + }, + "m_AllowMaterialOverride": false, + "m_SurfaceType": 0, + "m_ZTestMode": 4, + "m_ZWriteControl": 0, + "m_AlphaMode": 0, + "m_RenderFace": 2, + "m_AlphaClip": false, + "m_CastShadows": true, + "m_ReceiveShadows": true, + "m_DisableTint": false, + "m_AdditionalMotionVectorMode": 0, + "m_AlembicMotionVectors": false, + "m_SupportsLODCrossFade": false, + "m_CustomEditorGUI": "", + "m_SupportVFX": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ScreenPositionNode", + "m_ObjectId": "260e7c56065d4e1d90da0e52d012d0c2", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Screen Position", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1003.3333129882813, + "y": 560.0, + "width": 147.33331298828126, + "height": 131.99993896484376 + } + }, + "m_Slots": [ + { + "m_Id": "1339941f19f149678b9fea041a9a15c0" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_ScreenSpaceType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ScreenPositionMaterialSlot", + "m_ObjectId": "27623384578f4612b8ebfa4434f26e7a", + "m_Id": 0, + "m_DisplayName": "UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [], + "m_ScreenSpaceType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "307127996ed94ca6883c32d86cfc747a", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.BaseColor", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "73f19e1092594af392332c16a653bfee" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.BaseColor" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.StepNode", + "m_ObjectId": "399a8f59e4144b7f828fda4fcd443454", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Step", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -149.99996948242188, + "y": 392.66668701171877, + "width": 146.66664123535157, + "height": 119.99993896484375 + } + }, + "m_Slots": [ + { + "m_Id": "7f8f8a23eee6454db1dde9cb9fc3c3c6" + }, + { + "m_Id": "72f521ec37044eb3980ac772a141fad3" + }, + { + "m_Id": "a50335a80cb4489483bfac3056a78229" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalFullscreenSubTarget", + "m_ObjectId": "3e155fc0e3f24eb4aceb224c2ee96786" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "3f2c3c8d7bc242668724c261660e385c", + "m_Id": 3, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "47537411593747a988562f7878bcc24f", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode", + "m_ObjectId": "4c3b5acdde324d4a9b5c42c440b26a55", + "m_Group": { + "m_Id": "" + }, + "m_Name": "luminance (Custom Function)", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -685.3333129882813, + "y": 399.9999694824219, + "width": 213.33331298828126, + "height": 96.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "17156d19edb54a4897f80adb7d990b2a" + }, + { + "m_Id": "f0ff1d5c09ef47d0ad36318e60c97e33" + } + ], + "synonyms": [ + "code", + "HLSL" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SourceType": 1, + "m_FunctionName": "luminance", + "m_FunctionSource": "", + "m_FunctionSourceUsePragmas": true, + "m_FunctionBody": "luminance = 0.299*color.r + 0.587 * color.g + 0.114 * color.b;" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.GroupData", + "m_ObjectId": "50bdaf609c8e4d8e976ffec3becd616f", + "m_Title": "Sampling URP Color Buffer", + "m_Position": { + "x": -1261.7142333984375, + "y": 318.2857971191406 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "52de7ad03e024bada895dc577c6db05c", + "m_Id": 0, + "m_DisplayName": "clipPos", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "clipPos", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.LerpNode", + "m_ObjectId": "54835e022883497fbb75f7ff82f9a0ca", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Lerp", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 84.66670227050781, + "y": 344.0, + "width": 131.33326721191407, + "height": 144.0 + } + }, + "m_Slots": [ + { + "m_Id": "d052c31480194c34a8b49c5a444801d2" + }, + { + "m_Id": "e90887a75c2947a1ad02b8b6917f18e9" + }, + { + "m_Id": "d6633ef4711345e19bb76d5164f38c32" + }, + { + "m_Id": "3f2c3c8d7bc242668724c261660e385c" + } + ], + "synonyms": [ + "mix", + "blend", + "linear interpolate" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode", + "m_ObjectId": "6084a878f8334517a885db5a830751c8", + "m_Group": { + "m_Id": "0a911764a532477b860a6b4a00bb3374" + }, + "m_Name": "FragFrameBufferFetch (Custom Function)", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1175.3333740234375, + "y": 143.3333282470703, + "width": 283.33331298828127, + "height": 96.0 + } + }, + "m_Slots": [ + { + "m_Id": "52de7ad03e024bada895dc577c6db05c" + }, + { + "m_Id": "b35ee3f887a94f2d8f1c2e0e9cfcee22" + } + ], + "synonyms": [ + "code", + "HLSL" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SourceType": 0, + "m_FunctionName": "FragFrameBufferFetch", + "m_FunctionSource": "501de7d1519ff4c4faf27be8f6a96b55", + "m_FunctionSourceUsePragmas": true, + "m_FunctionBody": "Enter function body here..." +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "62121ddcdab6468eac0238312db6ac6f", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.Universal.UniversalSampleBufferNode", + "m_ObjectId": "6f16b9a25e2e45f9ab6a2e720863e24a", + "m_Group": { + "m_Id": "50bdaf609c8e4d8e976ffec3becd616f" + }, + "m_Name": "URP Sample Buffer", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1236.0, + "y": 377.9999694824219, + "width": 156.6666259765625, + "height": 132.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "27623384578f4612b8ebfa4434f26e7a" + }, + { + "m_Id": "1edbf32e89a344baa0b60eb4989e4469" + } + ], + "synonyms": [ + "normal", + "motion vector", + "blit" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_BufferType": 2 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "7087ff9704724698a6b5cd605e2c497d", + "m_Id": 0, + "m_DisplayName": "ColorA", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "72f521ec37044eb3980ac772a141fad3", + "m_Id": 1, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", + "m_ObjectId": "73f19e1092594af392332c16a653bfee", + "m_Id": 0, + "m_DisplayName": "Base Color", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "BaseColor", + "m_StageCapability": 2, + "m_Value": { + "x": 0.5, + "y": 0.5, + "z": 0.5 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_ColorMode": 0, + "m_DefaultColor": { + "r": 0.5, + "g": 0.5, + "b": 0.5, + "a": 1.0 + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "76f3b57623df4304a87f0f2cbf3c7fea", + "m_Guid": { + "m_GuidSerialized": "5cb43f98-df50-4349-8e8a-4b8c2f3e4d01" + }, + "m_Name": "Dither Scale", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Dither Scale", + "m_DefaultReferenceName": "_Dither_Scale", + "m_OverrideReferenceName": "", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_DismissedVersion": 0, + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 1.0, + "m_FloatType": 0, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "77d4c9cf3b2f4bf6871514e6db22bac1", + "m_Id": 0, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ScreenPositionMaterialSlot", + "m_ObjectId": "7d89190be85f425b98d73615be03c889", + "m_Id": 1, + "m_DisplayName": "Screen Position", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "ScreenPosition", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [], + "m_ScreenSpaceType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "7f8f8a23eee6454db1dde9cb9fc3c3c6", + "m_Id": 0, + "m_DisplayName": "Edge", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Edge", + "m_StageCapability": 3, + "m_Value": { + "x": 0.5, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "80339ff08c5c4afd803f53b36bd1c511", + "m_Id": 0, + "m_DisplayName": "Step Threshold", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ScreenPositionNode", + "m_ObjectId": "8d8dd65ffc564c1bb8f2e23b5f4f4a8e", + "m_Group": { + "m_Id": "0a911764a532477b860a6b4a00bb3374" + }, + "m_Name": "Screen Position", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1342.0, + "y": 143.3333282470703, + "width": 147.333251953125, + "height": 131.99998474121095 + } + }, + "m_Slots": [ + { + "m_Id": "77d4c9cf3b2f4bf6871514e6db22bac1" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_ScreenSpaceType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "9f36ebbc7fb5477091b40a0833a779de", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -685.3333740234375, + "y": 579.3333129882813, + "width": 209.33340454101563, + "height": 304.0 + } + }, + "m_Slots": [ + { + "m_Id": "62121ddcdab6468eac0238312db6ac6f" + }, + { + "m_Id": "affcc681888749348137b3a3663e80cc" + }, + { + "m_Id": "f7a56dc59708475ca8e404aa8f3d3352" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "9f376bf41a1148f787317e673232f9fc", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -379.33331298828127, + "y": 363.9999694824219, + "width": 155.99998474121095, + "height": 36.0 + } + }, + "m_Slots": [ + { + "m_Id": "80339ff08c5c4afd803f53b36bd1c511" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "038ee04dd5c44c59adfdd2a81b2dc0b2" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "a50335a80cb4489483bfac3056a78229", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "ae0f4fe2068742e08254be273b531b73", + "m_Id": 0, + "m_DisplayName": "ColorB", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "affcc681888749348137b3a3663e80cc", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "b27c3a5f86314913ac4146a301fa3315", + "m_Id": 0, + "m_DisplayName": "Dither Scale", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "b35ee3f887a94f2d8f1c2e0e9cfcee22", + "m_Id": 1, + "m_DisplayName": "outFbf", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "outFbf", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "cd235a6e0b1146a8b2f57fee1aed4942", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -117.33326721191406, + "y": 345.9999694824219, + "width": 113.99993133544922, + "height": 36.000030517578128 + } + }, + "m_Slots": [ + { + "m_Id": "ae0f4fe2068742e08254be273b531b73" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "dc395505e6a94b78b87f9559b4d2e720" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "d052c31480194c34a8b49c5a444801d2", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.Internal.ColorShaderProperty", + "m_ObjectId": "d3288fbc63dc494fb6eaea6d4ec231ef", + "m_Guid": { + "m_GuidSerialized": "218d7625-540f-4f8e-8414-d23d1e7ffd49" + }, + "m_Name": "ColorA", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "ColorA", + "m_DefaultReferenceName": "_ColorA", + "m_OverrideReferenceName": "", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_DismissedVersion": 0, + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "r": 0.0, + "g": 0.0, + "b": 0.0, + "a": 0.0 + }, + "isMainColor": false, + "m_ColorMode": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "d6633ef4711345e19bb76d5164f38c32", + "m_Id": 2, + "m_DisplayName": "T", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "T", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DitherNode", + "m_ObjectId": "d6c221eee6ff4e49a097d521b5b5b1f8", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Dither", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -426.0, + "y": 399.9999694824219, + "width": 202.6666717529297, + "height": 119.99996948242188 + } + }, + "m_Slots": [ + { + "m_Id": "e2e060ff98004b18883ec3b5f93dc5c7" + }, + { + "m_Id": "7d89190be85f425b98d73615be03c889" + }, + { + "m_Id": "47537411593747a988562f7878bcc24f" + } + ], + "synonyms": [ + "blue noise", + "half tone" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.Internal.ColorShaderProperty", + "m_ObjectId": "dc395505e6a94b78b87f9559b4d2e720", + "m_Guid": { + "m_GuidSerialized": "68022751-1901-4075-acb8-5b394b6759b7" + }, + "m_Name": "ColorB", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "ColorB", + "m_DefaultReferenceName": "_ColorB", + "m_OverrideReferenceName": "", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_DismissedVersion": 0, + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "r": 1.0, + "g": 1.0, + "b": 1.0, + "a": 0.0 + }, + "isMainColor": false, + "m_ColorMode": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "e280493a99c74cf18f8ede943ac211b1", + "m_Id": 0, + "m_DisplayName": "Alpha", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Alpha", + "m_StageCapability": 2, + "m_Value": 1.0, + "m_DefaultValue": 1.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "e2e060ff98004b18883ec3b5f93dc5c7", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "e5688d4a6446433e8c22b67dc1cf4efa", + "m_Name": "", + "m_ChildObjectList": [ + { + "m_Id": "038ee04dd5c44c59adfdd2a81b2dc0b2" + }, + { + "m_Id": "76f3b57623df4304a87f0f2cbf3c7fea" + }, + { + "m_Id": "d3288fbc63dc494fb6eaea6d4ec231ef" + }, + { + "m_Id": "dc395505e6a94b78b87f9559b4d2e720" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "e90887a75c2947a1ad02b8b6917f18e9", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.Fullscreen.ShaderGraph.FullscreenData", + "m_ObjectId": "ed88d2e75891447bb5206eec985a08fb", + "m_Version": 0, + "m_fullscreenMode": 0, + "m_BlendMode": 0, + "m_SrcColorBlendMode": 0, + "m_DstColorBlendMode": 1, + "m_ColorBlendOperation": 0, + "m_SrcAlphaBlendMode": 0, + "m_DstAlphaBlendMode": 1, + "m_AlphaBlendOperation": 0, + "m_EnableStencil": false, + "m_StencilReference": 0, + "m_StencilReadMask": 255, + "m_StencilWriteMask": 255, + "m_StencilCompareFunction": 8, + "m_StencilPassOperation": 0, + "m_StencilFailOperation": 0, + "m_StencilDepthFailOperation": 0, + "m_DepthWrite": false, + "m_depthWriteMode": 0, + "m_AllowMaterialOverride": false, + "m_DepthTestMode": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "f0ff1d5c09ef47d0ad36318e60c97e33", + "m_Id": 1, + "m_DisplayName": "luminance", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "luminance", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "f7a56dc59708475ca8e404aa8f3d3352", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "fd183f4c1a4443c99dffa96b76b68e5f", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.Alpha", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "e280493a99c74cf18f8ede943ac211b1" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Alpha" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "fea87f1e34714d0e8c1e30d47923b804", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -963.3333129882813, + "y": 710.6666259765625, + "width": 140.0, + "height": 36.0 + } + }, + "m_Slots": [ + { + "m_Id": "b27c3a5f86314913ac4146a301fa3315" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "76f3b57623df4304a87f0f2cbf3c7fea" + } +} + diff --git a/shaders-urp/Assets/ShaderGraphs/TwoToneDither_FullScreen.shadergraph.meta b/shaders-urp/Assets/ShaderGraphs/TwoToneDither_FullScreen.shadergraph.meta new file mode 100644 index 0000000..33ec128 --- /dev/null +++ b/shaders-urp/Assets/ShaderGraphs/TwoToneDither_FullScreen.shadergraph.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 5bacd8bcfc824684c85722b98cc86dfe +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} From 887d8f5e66f265f25d9f7b89a6dc1292aae0cb33 Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 17:11:53 +0900 Subject: [PATCH 14/18] add VolumeProfile --- .../Assets/Scenes/RenderGraphSimple.meta | 8 +++ .../RenderGraphSimpleVolumeProfile.asset | 58 +++++++++++++++++++ .../RenderGraphSimpleVolumeProfile.asset.meta | 8 +++ 3 files changed, 74 insertions(+) create mode 100644 shaders-urp/Assets/Scenes/RenderGraphSimple.meta create mode 100644 shaders-urp/Assets/Scenes/RenderGraphSimple/RenderGraphSimpleVolumeProfile.asset create mode 100644 shaders-urp/Assets/Scenes/RenderGraphSimple/RenderGraphSimpleVolumeProfile.asset.meta diff --git a/shaders-urp/Assets/Scenes/RenderGraphSimple.meta b/shaders-urp/Assets/Scenes/RenderGraphSimple.meta new file mode 100644 index 0000000..9800ac9 --- /dev/null +++ b/shaders-urp/Assets/Scenes/RenderGraphSimple.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f5561fe5203e732418f28d13057025b7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/shaders-urp/Assets/Scenes/RenderGraphSimple/RenderGraphSimpleVolumeProfile.asset b/shaders-urp/Assets/Scenes/RenderGraphSimple/RenderGraphSimpleVolumeProfile.asset new file mode 100644 index 0000000..eec6e1f --- /dev/null +++ b/shaders-urp/Assets/Scenes/RenderGraphSimple/RenderGraphSimpleVolumeProfile.asset @@ -0,0 +1,58 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-3264523338660245209 +MonoBehaviour: + m_ObjectHideFlags: 3 + 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: 1265ae2ded31e594bb2910a63c8bc0e9, type: 3} + m_Name: CustomDitherVolumeComponent + m_EditorClassIdentifier: + active: 1 + m_intensity: + m_OverrideState: 1 + m_Value: 1 +--- !u!114 &-2661183006940541709 +MonoBehaviour: + m_ObjectHideFlags: 3 + 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: 29fa0085f50d5e54f8144f766051a691, type: 3} + m_Name: FilmGrain + m_EditorClassIdentifier: + active: 1 + type: + m_OverrideState: 1 + m_Value: 8 + intensity: + m_OverrideState: 1 + m_Value: 1 + response: + m_OverrideState: 0 + m_Value: 0.8 + texture: + m_OverrideState: 0 + m_Value: {fileID: 0} +--- !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: d7fd9488000d3734a9e00ee676215985, type: 3} + m_Name: RenderGraphSimpleVolumeProfile + m_EditorClassIdentifier: + components: + - {fileID: -2661183006940541709} + - {fileID: -3264523338660245209} diff --git a/shaders-urp/Assets/Scenes/RenderGraphSimple/RenderGraphSimpleVolumeProfile.asset.meta b/shaders-urp/Assets/Scenes/RenderGraphSimple/RenderGraphSimpleVolumeProfile.asset.meta new file mode 100644 index 0000000..ec192fd --- /dev/null +++ b/shaders-urp/Assets/Scenes/RenderGraphSimple/RenderGraphSimpleVolumeProfile.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 30f0cb6ed9d4de445abdef0019bb8f0b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: From 96e60d4b8ff86fd77cde2b8cc864e37708e2d61d Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 17:12:00 +0900 Subject: [PATCH 15/18] update assets --- .../Assets/Scenes/RenderGraphSimple.unity | 78 ++++++++++++++++++- .../Assets/Settings/ForwardRenderer.asset | 18 ++++- 2 files changed, 92 insertions(+), 4 deletions(-) diff --git a/shaders-urp/Assets/Scenes/RenderGraphSimple.unity b/shaders-urp/Assets/Scenes/RenderGraphSimple.unity index c0e322a..daf5fc0 100644 --- a/shaders-urp/Assets/Scenes/RenderGraphSimple.unity +++ b/shaders-urp/Assets/Scenes/RenderGraphSimple.unity @@ -240,6 +240,77 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &374385176 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 374385179} + - component: {fileID: 374385178} + - component: {fileID: 374385177} + m_Layer: 0 + m_Name: Sphere Volume + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &374385177 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 374385176} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IsGlobal: 0 + priority: 0 + blendDistance: 1 + weight: 1 + sharedProfile: {fileID: 11400000, guid: 30f0cb6ed9d4de445abdef0019bb8f0b, type: 2} +--- !u!135 &374385178 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 374385176} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Radius: 0.5 + m_Center: {x: 0, y: 0, z: 0} +--- !u!4 &374385179 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 374385176} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 2.9762, y: 2.3623552, z: -4.5836} + m_LocalScale: {x: 3.0763495, y: 3.0763495, z: 3.0763495} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &516781594 GameObject: m_ObjectHideFlags: 0 @@ -716,7 +787,7 @@ MonoBehaviour: m_Bits: 1 m_VolumeTrigger: {fileID: 0} m_VolumeFrameworkUpdateModeOption: 2 - m_RenderPostProcessing: 0 + m_RenderPostProcessing: 1 m_Antialiasing: 0 m_AntialiasingQuality: 2 m_StopNaN: 0 @@ -805,8 +876,8 @@ Transform: m_GameObject: {fileID: 961739749} serializedVersion: 2 m_LocalRotation: {x: -0.1796808, y: 0.109739624, z: -0.020174414, w: -0.97737664} - m_LocalPosition: {x: 1.2978855, y: 2.2271373, z: -5.7068305} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalPosition: {x: 0.85, y: 1.46, z: -3.74} + m_LocalScale: {x: 1, y: 1, z: 1.6784} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} @@ -931,3 +1002,4 @@ SceneRoots: - {fileID: 929562784} - {fileID: 611740399} - {fileID: 516781598} + - {fileID: 374385179} diff --git a/shaders-urp/Assets/Settings/ForwardRenderer.asset b/shaders-urp/Assets/Settings/ForwardRenderer.asset index 87539d7..eaa8187 100644 --- a/shaders-urp/Assets/Settings/ForwardRenderer.asset +++ b/shaders-urp/Assets/Settings/ForwardRenderer.asset @@ -1,5 +1,20 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!114 &-314309698037612059 +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: 5d782816b8872884fa46c86ac5d816ee, type: 3} + m_Name: DitherEffectRendererFeature + m_EditorClassIdentifier: + m_Active: 1 + m_blitMaterial: {fileID: 2100000, guid: 90057bb3471f9af43b7530912b0bfd12, type: 2} + m_injectionPoint: 600 --- !u!114 &11400000 MonoBehaviour: m_ObjectHideFlags: 0 @@ -28,7 +43,8 @@ MonoBehaviour: probeVolumeBlendStatesCS: {fileID: 0} m_RendererFeatures: - {fileID: 5413041191544749068} - m_RendererFeatureMap: 0cfc94c048fc1e4b + - {fileID: -314309698037612059} + m_RendererFeatureMap: 0cfc94c048fc1e4be50102b3fe58a3fb m_UseNativeRenderPass: 0 xrSystemData: {fileID: 11400000, guid: 60e1133243b97e347b653163a8c01b64, type: 2} postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2} From e7025cc485e804458fc8119ab5524468adaec09e Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 17:13:50 +0900 Subject: [PATCH 16/18] remove unused code --- .../RendererFeatures/DitherEffectPass.cs | 226 ------------------ 1 file changed, 226 deletions(-) diff --git a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs index d0121a8..15fca99 100644 --- a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs +++ b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs @@ -68,229 +68,3 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer Material m_blitMaterial; // Material used in the blit operation. } - - -/*using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Rendering.RenderGraphModule; -using UnityEngine.Rendering; -using UnityEngine.Rendering.Universal; - -public class DitherEffectFeature : ScriptableRendererFeature -{ - // We want to call the pass after post processing - public RenderPassEvent injectionPoint = RenderPassEvent.AfterRendering; - // Material with the DitherEffect conversion shader - public Material passMaterial; - // Needed requirements for the pass - public ScriptableRenderPassInput requirements = ScriptableRenderPassInput.Color; - - public bool optimise = false; - - private static MaterialPropertyBlock s_SharedPropertyBlock = null; - - // The pass itself - private DitherEffectPass m_pass; - - public override void Create() - { - m_pass = new DitherEffectPass(passMaterial, name, optimise); - m_pass.renderPassEvent = injectionPoint; - m_pass.ConfigureInput(requirements); - } - - public void OnEnable() - { - if(s_SharedPropertyBlock == null) - s_SharedPropertyBlock = new MaterialPropertyBlock(); - } - // Adding the render pass to the renderer - public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) - { - renderer.EnqueuePass(m_pass); - } - - // Class defining the pass - internal class DitherEffectPass : ScriptableRenderPass - { - private string m_PassName; - private ProfilingSampler m_Sampler; - private Material m_Material; - private bool m_Optimise; - //private static readonly int m_BlitTextureID = Shader.PropertyToID("_BlitTexture"); - private static readonly int m_BlitScaleBiasID = Shader.PropertyToID("_BlitScaleBias"); - - /////// NON Render Graph ONLY /////// - private RTHandle m_CopiedColor; - ///////////////////////////////////// - - - ///////// Render Graph ONLY ///////// - private PassData m_PassData; - private class PassData - { - internal Material material; - internal TextureHandle source; - } - private static Material s_FrameBufferFetchMaterial; - ///////////////////////////////////// - - public DitherEffectPass(Material mat, string name, bool optimise) - { - m_PassName = name; - m_Material = mat; - m_Optimise = optimise; - - m_Sampler ??= new ProfilingSampler(GetType().Name + "_" + name); - s_FrameBufferFetchMaterial ??= UnityEngine.Resources.Load("FrameBufferFetch") as Material; - } - - [System.Obsolete] - // NON Render Graph ONLY - public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData) - { - ReAllocate(renderingData.cameraData.cameraTargetDescriptor); - } - - internal void ReAllocate(RenderTextureDescriptor desc) - { - desc.msaaSamples = 1; - desc.depthBufferBits = (int)DepthBits.None; - RenderingUtils.ReAllocateHandleIfNeeded(ref m_CopiedColor, desc, name: "_FullscreenPassColorCopy"); - } - - public void Dispose() - { - m_CopiedColor?.Release(); - } - - private static void ExecuteCopyColorPass(RasterCommandBuffer cmd, RTHandle sourceTexture, bool optimise) - { - if(!optimise) - { - Blitter.BlitTexture(cmd, sourceTexture, new Vector4(1, 1, 0, 0), 0.0f, false); - } - else - { - cmd.DrawProcedural(Matrix4x4.identity, s_FrameBufferFetchMaterial, 1, MeshTopology.Triangles, 3, 1, null); - } - } - - private static void ExecuteMainPass(RasterCommandBuffer cmd, Material material, RTHandle copiedColor) - { - s_SharedPropertyBlock.Clear(); - //if (copiedColor != null) - // s_SharedPropertyBlock.SetTexture(m_BlitTextureID, copiedColor); - - // We need to set the "_BlitScaleBias" uniform for user materials with shaders relying on core Blit.hlsl to work - s_SharedPropertyBlock.SetVector(m_BlitScaleBiasID, new Vector4(1, 1, 0, 0)); - - cmd.DrawProcedural(Matrix4x4.identity, material, 0, MeshTopology.Triangles, 4, 1, s_SharedPropertyBlock); - } - - // NON Render Graph ONLY - [System.Obsolete] - public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) - { - var stack = VolumeManager.instance.stack; - var customEffect = stack.GetComponent(); - // Only process if the effect is active - if (!customEffect.IsActive()) - return; - - // Retrieve URP camera data - ref var cameraData = ref renderingData.cameraData; - - // Get a command buffer from the pool and clear it - CommandBuffer cmd = CommandBufferPool.Get("Custom Post Processing - Dither Effect"); - cmd.Clear(); - - using (new ProfilingScope(cmd, profilingSampler)) - { - // Get the raster command buffer - RasterCommandBuffer rasterCmd = CommandBufferHelpers.GetRasterCommandBuffer(cmd); - - // Set the render target to the temporary color texture (created in OnCameraSetup()) - CoreUtils.SetRenderTarget(cmd, m_CopiedColor); - // Execute the copy pass, copying the URP camera color target to the temp color target - ExecuteCopyColorPass(rasterCmd, cameraData.renderer.cameraColorTargetHandle, m_Optimise); - - // Set the render target back to the URP camera color target - CoreUtils.SetRenderTarget(cmd, cameraData.renderer.cameraColorTargetHandle); - // Execute the blit pass with the dither effect material, sampling the copied temp color texture - ExecuteMainPass(rasterCmd, m_Material, m_CopiedColor); - } - - // Execute the command buffer and release it - context.ExecuteCommandBuffer(cmd); - CommandBufferPool.Release(cmd); - } - - // Render Graph ONLY - Recording the passes in the render graph - public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) - { - var stack = VolumeManager.instance.stack; - var customEffect = stack.GetComponent(); - // Only process if the effect is active - if (!customEffect.IsActive()) - return; - - UniversalResourceData resourceData = frameData.Get(); - - // We need a copy of the color texture as input for the blit with material - // Retrieving texture descriptor from active color texture after post process - var colCopyDesc = renderGraph.GetTextureDesc(resourceData.afterPostProcessColor); - // Changing the name - colCopyDesc.name = "_TempColorCopy"; - // Requesting the creation of a texture to Render Graph, Render Graph will allocate when needed - TextureHandle copiedColorTexture = renderGraph.CreateTexture(colCopyDesc); - - // First blit, simply copying color to intermediary texture so it can be used as input in next pass - using (var builder = renderGraph.AddRasterRenderPass(m_PassName + "_CopyPass", out var passData, m_Sampler)) - { - // Setting the URP active color texture as the source for this pass - passData.source = resourceData.activeColorTexture; - // Setting input texture to sample - if (m_Optimise){ - builder.SetInputAttachment(resourceData.activeColorTexture, 0); - }else{ - builder.UseTexture(resourceData.activeColorTexture, AccessFlags.Read); - } - // Setting output attachment - builder.SetRenderAttachment(copiedColorTexture, 0, AccessFlags.Write); - - // Execute step, simple copy - builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => - { - ExecuteCopyColorPass(rgContext.cmd, data.source, m_Optimise); - }); - } - - // Second blit with material, applying gray conversion - using (var builder = renderGraph.AddRasterRenderPass(m_PassName + "_FullScreenPass", out var passData, m_Sampler)) - { - // Setting the material - passData.source = resourceData.activeColorTexture; - passData.material = m_Material; - - // Setting input texture to sample - if (m_Optimise){ - builder.SetInputAttachment( copiedColorTexture, 0); - }else{ - // Setting the temp color texture as the source for this pass - //passData.source = copiedColorTexture; - builder.UseTexture(copiedColorTexture, AccessFlags.Read); - } - // Setting output attachment - builder.SetRenderAttachment(resourceData.activeColorTexture, 0, AccessFlags.Write); - - // Execute step, second blit with the gray scale conversion - builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => - { - ExecuteMainPass(rgContext.cmd, data.material, m_Optimise ? null : data.source); - }); - } - } - } -}*/ From b470c01aaa2deb77562471ca486b0fb63a9ff54a Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 17:14:52 +0900 Subject: [PATCH 17/18] minor --- .../Assets/Scripts/RendererFeatures/DitherEffectPass.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs index 15fca99..362e943 100644 --- a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs +++ b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs @@ -42,12 +42,11 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer return; } - // The destination texture is created here, - // the texture is created with the same dimensions as the active color texture + // The destination texture is created here with the same dimensions as the active color texture TextureHandle source = resourceData.activeColorTexture; TextureDesc destinationDesc = renderGraph.GetTextureDesc(source); - destinationDesc.name = $"CameraColor-{PASS_NAME}"; + destinationDesc.name = $"DitherEffectPass-CameraColor-{PASS_NAME}"; destinationDesc.clearBuffer = false; TextureHandle destination = renderGraph.CreateTexture(destinationDesc); From 535fd171c93e67d6b19ad1d8e60ae104754196fc Mon Sep 17 00:00:00 2001 From: Sindharta Tanuwijaya Date: Tue, 12 Nov 2024 20:42:29 +0900 Subject: [PATCH 18/18] Hack Disable MSAA. NOT IDEAL --- shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs index 362e943..9ea77cc 100644 --- a/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs +++ b/shaders-urp/Assets/Scripts/RendererFeatures/DitherEffectPass.cs @@ -48,6 +48,8 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer TextureDesc destinationDesc = renderGraph.GetTextureDesc(source); destinationDesc.name = $"DitherEffectPass-CameraColor-{PASS_NAME}"; destinationDesc.clearBuffer = false; +// destinationDesc.msaaSamples = QualitySettings.antiAliasing == 0 ? MSAASamples.None : MSAASamples.MSAA2x; + destinationDesc.msaaSamples = MSAASamples.None; TextureHandle destination = renderGraph.CreateTexture(destinationDesc);