public CustomShadowmapRenderPass(string profilerTag, bool opaque, RenderPassEvent evt, RenderQueueRange renderQueueRange, LayerMask layerMask)//, StencilState stencilState, int stencilReference) { m_ProfilerTag = profilerTag; m_ProfilingSampler = new ProfilingSampler(profilerTag); m_ShaderTagIdList.Add(new ShaderTagId("ZorroShadow")); renderPassEvent = evt; m_MainLightShadowmap.Init("_CustomShadowmapTexture"); m_FilteringSettings = new FilteringSettings(renderQueueRange, layerMask); m_RenderStateBlock = new RenderStateBlock(RenderStateMask.Nothing); //if (stencilState.enabled) //{ // m_RenderStateBlock.stencilReference = stencilReference; // m_RenderStateBlock.mask = RenderStateMask.Stencil; // m_RenderStateBlock.stencilState = stencilState; //} _CustomWorldToShadowID = Shader.PropertyToID("_ZorroShadowMatrix"); _CustomShadowParams = Shader.PropertyToID("_ZorroShadowParams"); m_MainLightShadowmap.Init("_CustomLightShadowmapTexture"); }
public CloudShadowPass(Material mat, RenderPassEvent passEvenet) { m_Material = mat; this.renderPassEvent = passEvenet; //初始化辅助RT名字 m_TemporaryColorTexture.Init("CloudShadow"); }
public GrabBlurPassImpl(RenderTargetHandle colorHandle) { m_Blur = new CommandBufferBlur(); m_BlurTemp1.Init("_Temp1"); m_BlurTemp2.Init("_Temp2"); m_ScreenCopyId.Init("_ScreenCopyTexture"); }
public override void Create() { FilterSettings filter = settings.filterSettings; renderObjectsPass = new RenderObjectsToTexturePass(settings.passTag, settings.Event, filter.PassNames, filter.RenderQueueType, filter.LayerMask, settings.cameraSettings); renderObjectsPass.overrideMaterial = settings.overrideMaterial; renderObjectsPass.overrideMaterialPassIndex = settings.overrideMaterialPassIndex; if (settings.overrideDepthState) { renderObjectsPass.SetDetphState(settings.enableWrite, settings.depthCompareFunction); } if (settings.stencilSettings.overrideStencilState) { renderObjectsPass.SetStencilState(settings.stencilSettings.stencilReference, settings.stencilSettings.stencilCompareFunction, settings.stencilSettings.passOperation, settings.stencilSettings.failOperation, settings.stencilSettings.zFailOperation); } m_SrcRenderTextureHandle.Init(settings.srcTextureId); m_DstRenderTextureHandle.Init(settings.dstTextureId); m_CameraColorTextureHandle.Init("_CameraColorTexture"); }
static public void Setup(Renderer2DData rendererData) { s_RendererData = rendererData; s_BlendStyles = rendererData.lightBlendStyles; if (s_RenderTargets == null) { s_RenderTargets = new RenderTargetHandle[s_BlendStyles.Length]; s_RenderTargets[0].Init("_ShapeLightTexture0"); s_RenderTargets[1].Init("_ShapeLightTexture1"); s_RenderTargets[2].Init("_ShapeLightTexture2"); s_RenderTargets[3].Init("_ShapeLightTexture3"); s_RenderTargetsDirty = new bool[s_BlendStyles.Length]; } if (s_NormalsTarget.id == 0) { s_NormalsTarget.Init("_NormalMap"); } // The array size should be determined by the number of 'feature bit' the material index has. See GetLightMaterialIndex(). // Not all slots must be filled because certain combinations of the feature bits don't make sense (e.g. sprite bit on + shape bit off). if (s_LightMaterials == null) { s_LightMaterials = new Material[k_NumberOfLightMaterials]; } }
public StencilRenderPass(ScreenSpacePlanarReflectionsSettings settings) { m_Settings = settings; m_RenderStateBlock = new RenderStateBlock(); m_RenderStateBlock.mask |= RenderStateMask.Depth; m_RenderStateBlock.depthState = new DepthState(false, CompareFunction.Always); m_RenderStateBlock.mask |= RenderStateMask.Stencil; StencilState stencilState = StencilState.defaultValue; stencilState.enabled = true; stencilState.SetCompareFunction(CompareFunction.Always); stencilState.SetPassOperation(StencilOp.Replace); stencilState.SetFailOperation(StencilOp.Zero); stencilState.SetZFailOperation(StencilOp.Keep); m_RenderStateBlock.stencilReference = settings.StencilValue; m_RenderStateBlock.stencilState = stencilState; m_FilteringSettings = new FilteringSettings(RenderQueueRange.opaque, settings.ReflectiveSurfaceLayer); m_ShaderTagIdList.Add(new ShaderTagId("DepthOnly")); m_DepthTexture.Init("_CameraDepthTexture"); }
public SsfPass( RenderPassEvent renderPassEvent, Material material, int blurryIterations, LayerMask layerMask, RenderQueueRange renderQueueRange) { this.renderPassEvent = renderPassEvent; this.material = material; filteringSettings = new FilteringSettings(renderQueueRange, layerMask); blurringTargetHandles = new RenderTargetHandle[blurryIterations]; for (var i = 0; i < blurryIterations; i++) { blurringTargetHandles[i].Init($"_BlurTemp{i}"); } depthTargetHandle.Init("_SsfDepthTexture"); depthNormalTargetHandle.Init("_SsfNormalTexture"); downSamplingPass = material.FindPass("DownSampling"); upSamplingPass = material.FindPass("UpSampling"); depthNormalPass = material.FindPass("DepthNormal"); litPass = material.FindPass("SsfLit"); }
public RippleEffect_RenderPass(RenderPassEvent renderPassEvent, FilterMode filterMode, int blitShaderPassIndex) { this.renderPassEvent = renderPassEvent; this.filterMode = filterMode; this.blitShaderPassIndex = blitShaderPassIndex; m_TemporaryColorTexture.Init("_TemporaryColorTexture"); // You can name this anything you want }
public TranslucentImageBlurRenderPass() { previewMaterial = new Material(Shader.Find("Hidden/FillCrop_UniversalRP")); //Fragile!!! Should request Unity for access afterPostProcessTexture.Init("_AfterPostProcessTexture"); }
/// <summary> /// Create the CopyColorPass /// </summary> public CloudRenderPass(Material blitMaterial, string tag) { this.blitMaterial = blitMaterial; this.renderPassEvent = RenderPassEvent.BeforeRenderingPostProcessing; m_ProfilerTag = tag; m_TemporaryColorTexture.Init("_TemporaryColorTexture"); }
public AdditionalLightsShadowCasterPass(RenderPassEvent evt) { renderPassEvent = evt; AdditionalShadowsConstantBuffer._AdditionalLightsWorldToShadow = Shader.PropertyToID("_AdditionalLightsWorldToShadow"); AdditionalShadowsConstantBuffer._AdditionalShadowParams = Shader.PropertyToID("_AdditionalShadowParams"); AdditionalShadowsConstantBuffer._AdditionalShadowOffset0 = Shader.PropertyToID("_AdditionalShadowOffset0"); AdditionalShadowsConstantBuffer._AdditionalShadowOffset1 = Shader.PropertyToID("_AdditionalShadowOffset1"); AdditionalShadowsConstantBuffer._AdditionalShadowOffset2 = Shader.PropertyToID("_AdditionalShadowOffset2"); AdditionalShadowsConstantBuffer._AdditionalShadowOffset3 = Shader.PropertyToID("_AdditionalShadowOffset3"); AdditionalShadowsConstantBuffer._AdditionalShadowmapSize = Shader.PropertyToID("_AdditionalShadowmapSize"); m_AdditionalLightsShadowmap.Init("_AdditionalLightsShadowmapTexture"); m_AdditionalShadowsBufferId = Shader.PropertyToID("_AdditionalShadowsBuffer"); m_AdditionalShadowsIndicesId = Shader.PropertyToID("_AdditionalShadowsIndices"); m_UseStructuredBuffer = RenderingUtils.useStructuredBuffer; m_SupportsBoxFilterForShadows = Application.isMobilePlatform || SystemInfo.graphicsDeviceType == GraphicsDeviceType.Switch; if (!m_UseStructuredBuffer) { // Preallocated a fixed size. CommandBuffer.SetGlobal* does allow this data to grow. int maxLights = UniversalRenderPipeline.maxVisibleAdditionalLights; m_AdditionalLightsWorldToShadow = new Matrix4x4[maxLights]; m_AdditionalLightsShadowParams = new Vector4[maxLights]; } }
public SSAOPostProcessPass(SSAOSettings settings) { this.settings = settings; m_Material = new Material(settings.blitShader); m_TemporaryColorTexture.Init("_TemporaryColorTexture"); }
public Renderer2D(Renderer2DData data) : base(data) { m_BlitMaterial = CoreUtils.CreateEngineMaterial(data.blitShader); m_ColorGradingLutPass = new ColorGradingLutPass(RenderPassEvent.BeforeRenderingOpaques, data.postProcessData); m_Render2DLightingPass = new Render2DLightingPass(data); m_PostProcessPass = new PostProcessPass(RenderPassEvent.BeforeRenderingPostProcessing, data.postProcessData, m_BlitMaterial); m_FinalPostProcessPass = new PostProcessPass(RenderPassEvent.AfterRenderingPostProcessing, data.postProcessData, m_BlitMaterial); m_FinalBlitPass = new FinalBlitPass(RenderPassEvent.AfterRendering + 1, m_BlitMaterial); #if POST_PROCESSING_STACK_2_0_0_OR_NEWER m_PostProcessPassCompat = new PostProcessPassCompat(RenderPassEvent.BeforeRenderingPostProcessing); #endif m_UseDepthStencilBuffer = data.useDepthStencilBuffer; // We probably should declare these names in the base class, // as they must be the same across all ScriptableRenderer types for camera stacking to work. k_ColorTextureHandle.Init("_CameraColorTexture"); k_DepthTextureHandle.Init("_CameraDepthAttachment"); k_AfterPostProcessColorHandle.Init("_AfterPostProcessTexture"); k_ColorGradingLutHandle.Init("_InternalGradingLut"); m_Renderer2DData = data; supportedRenderingFeatures = new RenderingFeatures() { cameraStacking = true, }; }
public SelectionOutlineRenderPass(string profilerTag, RenderPassEvent renderPassEvent, int layerMask, Material materialToBlit) { this.profilerTag = profilerTag; this.renderPassEvent = renderPassEvent; this.materialToBlit = materialToBlit; m_FilteringSettingsOpaque = new FilteringSettings(RenderQueueRange.opaque, layerMask); m_FilteringSettingsTransparent = new FilteringSettings(RenderQueueRange.transparent, layerMask); m_RenderStateBlock = new RenderStateBlock(RenderStateMask.Nothing); m_ShaderTagIdList.Add(new ShaderTagId("UniversalForward")); m_ShaderTagIdList.Add(new ShaderTagId("SRPDefaultUnlit")); m_blurTexture.Init("_MaskTexture"); m_blurTexture.Init("_BlurTexture"); }
public MainLightShadowCasterPass(RenderPassEvent evt) { renderPassEvent = evt; m_MainLightShadowMatrices = new Matrix4x4[k_MaxCascades + 1]; m_CascadeSlices = new ShadowSliceData[k_MaxCascades]; m_CascadeSplitDistances = new Vector4[k_MaxCascades]; MainLightShadowConstantBuffer._WorldToShadow = Shader.PropertyToID("_MainLightWorldToShadow"); MainLightShadowConstantBuffer._ShadowParams = Shader.PropertyToID("_MainLightShadowParams"); MainLightShadowConstantBuffer._CascadeShadowSplitSpheres0 = Shader.PropertyToID("_CascadeShadowSplitSpheres0"); MainLightShadowConstantBuffer._CascadeShadowSplitSpheres1 = Shader.PropertyToID("_CascadeShadowSplitSpheres1"); MainLightShadowConstantBuffer._CascadeShadowSplitSpheres2 = Shader.PropertyToID("_CascadeShadowSplitSpheres2"); MainLightShadowConstantBuffer._CascadeShadowSplitSpheres3 = Shader.PropertyToID("_CascadeShadowSplitSpheres3"); MainLightShadowConstantBuffer._CascadeShadowSplitSphereRadii = Shader.PropertyToID("_CascadeShadowSplitSphereRadii"); MainLightShadowConstantBuffer._ShadowOffset0 = Shader.PropertyToID("_MainLightShadowOffset0"); MainLightShadowConstantBuffer._ShadowOffset1 = Shader.PropertyToID("_MainLightShadowOffset1"); MainLightShadowConstantBuffer._ShadowOffset2 = Shader.PropertyToID("_MainLightShadowOffset2"); MainLightShadowConstantBuffer._ShadowOffset3 = Shader.PropertyToID("_MainLightShadowOffset3"); MainLightShadowConstantBuffer._ShadowmapSize = Shader.PropertyToID("_MainLightShadowmapSize"); m_MainLightShadowmap.Init("_MainLightShadowmapTexture"); m_SupportsBoxFilterForShadows = Application.isMobilePlatform || SystemInfo.graphicsDeviceType == GraphicsDeviceType.Switch; }
//private RenderTargetHandle m_TemporaryColorTexture; // Light Shafts public LightShaftsPass(Material material) { //TODO 这里不懂为啥用BeforeRenderingOpaques会导致Opaques物体渲染到LightShaftsLUT上,ColorGradingLUTPass为什么不会。 renderPassEvent = RenderPassEvent.BeforeRenderingPrepasses;// BeforeRenderingOpaques; // RenderPassEvent.AfterRenderingShadows; this.material = material; _lightShaftsLut.Init("_LightShaft"); }
public ComputePass(ComputeShader compute, string kernelName, Vector3Int size) { cs = compute; kernel = cs.FindKernel(kernelName); handle.Init("_Texture"); }
public AirDistortionRenderPass(RenderPassEvent renderPassEvent, Material blitMaterial) { this.renderPassEvent = renderPassEvent; this.blitMaterial = blitMaterial; m_ProfilerTag = "AirDistortion"; m_TemporaryColorTexture.Init("_TemporaryColorTexture"); }
public override void Create() { depthNormalsMaterial = CoreUtils.CreateEngineMaterial("Owlet/Utilities/DepthNormals"); depthNormalsPass = new DepthNormalsPass(RenderQueueRange.opaque, -1, depthNormalsMaterial); depthNormalsPass.renderPassEvent = RenderPassEvent.AfterRenderingPrePasses; depthNormalsTexture.Init("_CameraDepthNormalsTexture"); }
public RayMarchingComputeRenderPass(Setting setting) { cameraColourHandle.Init("_CameraColorTexture"); cameraDepthHandle.Init("_CameraDepthTexture"); rayMarchingTexHandle.Init("_RayMarchingTexture"); passSetting = setting; }
public PostProcessPassCompat(RenderPassEvent evt, bool renderOpaques = false) { m_IsOpaquePostProcessing = renderOpaques; m_TemporaryColorTexture.Init("_TemporaryColorTexture"); renderPassEvent = evt; }
private void Init() { if (m_Inited) { return; } m_RenderOpaqueForwardPass = new RenderOpaqueForwardPass(); m_DirectionalShadowPass = new DirectionalShadowPass(); m_ScreenSpaceShadowPass = new ScreenSpaceShadowResolvePass(); m_DepthOnlyPass = new DepthOnlyPass(); m_SetupForwardRenderingPass = new SetupForwardRenderingPass(); m_SetupLWDConstants = new SetupLWDConstantsPass(); m_FinalBlitPass = new FinalBlitPass(); m_BlurPass = new BlurPass(); ColorAttachment.Init("_CameraColorTexture"); DepthAttachment.Init("_CameraDepthAttachment"); DepthTexture.Init("_CameraDepthTexture"); OpaqueColor.Init("_CameraOpaqueTexture"); DirectionalShadowmap.Init("_DirectionalShadowmapTexture"); BluredDirectionalShadowmap.Init("_BluredDirectionalShadowmapTexture"); ScreenSpaceShadowmap.Init("_ScreenSpaceShadowmapTexture"); m_Inited = true; }
public RenderTargetBufferSystem(string name) { m_NameA = Shader.PropertyToID(name + "A"); m_NameB = Shader.PropertyToID(name + "B"); RTA.Init(name + "A"); RTB.Init(name + "B"); }
public RenderPass(string profilingName, Material material, int passIndex) : base() { this.profilingName = profilingName; this.material = material; this.materialPassIndex = passIndex; tempTextureHandle.Init("_TempBlitMaterialTexture"); }
public override void Create() { var passIndex = settings.blitMaterial != null ? settings.blitMaterial.passCount - 1 : 1; settings.blitMaterialPassIndex = Mathf.Clamp(settings.blitMaterialPassIndex, -1, passIndex); blitPass = new BlitPass(settings.Event, settings.blitMaterial, settings.blitMaterialPassIndex, name); m_RenderTextureHandle.Init(settings.textureId); }
public BlitPass(RenderPassEvent renderPassEvent, Material blitMaterial, int blitShaderPassIndex, string tag) { this.renderPassEvent = renderPassEvent; this.blitMaterial = blitMaterial; this.blitShaderPassIndex = blitShaderPassIndex; m_ProfilerTag = tag; m_TemporaryColorTexture.Init("_TemporaryColorTexture"); }
public WorldDepthPass(RenderPassEvent renderPassEvent, Material DepthMaterial, int DepthShaderPassIndex, string tag) { this.renderPassEvent = renderPassEvent; this.DepthMaterial = DepthMaterial; this.DepthShaderPassIndex = DepthShaderPassIndex; m_ProfilerTag = tag; m_TemporaryColorTexture.Init("_TemporaryColorTexture"); }
public OutlinePass(RenderPassEvent renderPassEvent, Material blitMaterial, int blitShaderPassIndex, string tag) { this.renderPassEvent = renderPassEvent; this.blitMaterial = blitMaterial; this.blitShaderPassIndex = blitShaderPassIndex; cmdTag = tag; temporaryColorTexture.Init("_TemporaryColorTexture"); }
public bool Setup(ref RenderingData renderingData) { m_MomentTextureHeight = renderingData.cameraData.cameraTargetDescriptor.height; m_MomentTextureWidth = renderingData.cameraData.cameraTargetDescriptor.width; m_MomentTextureHandle.Init("_MomentTexture"); return(true); }
public override void Create() { int passIndex = settings.mMat != null ? settings.mMat.passCount - 1 : 1; settings.blitMaterialPassIndex = Mathf.Clamp(settings.blitMaterialPassIndex, -1, passIndex); m_ScriptablePass = new HLRenderPass("HLPostEffectRender", settings.renderPassEvent, settings.mMat, settings.contrast); m_renderTargetHandle.Init(settings.textureId); }