/* * private static int SSR_ProjectionMatrix_ID = Shader.PropertyToID("_SSR_ProjectionMatrix"); * private static int SSR_InverseProjectionMatrix_ID = Shader.PropertyToID("_SSR_InverseProjectionMatrix"); * private static int SSR_WorldToCameraMatrix_ID = Shader.PropertyToID("_SSR_WorldToCameraMatrix"); * private static int SSR_CameraToWorldMatrix_ID = Shader.PropertyToID("_SSR_CameraToWorldMatrix"); * private static int SSR_ProjectToPixelMatrix_ID = Shader.PropertyToID("_SSR_ProjectToPixelMatrix"); */ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void Init(PipelineResources res) { StochasticScreenSpaceReflectionMaterial = new Material(res.shaders.ssrShader); ssrDatas = new ComputeBuffer(1, sizeof(SSRData), ComputeBufferType.Constant); rand = new Random((uint)System.Guid.NewGuid().GetHashCode()); propertySetEvent = RenderPipeline.GetEvent <PropertySetEvent>(); }
protected override void Init(PipelineResources resources) { proper = RenderPipeline.GetEvent <PropertySetEvent>(); probeBuffer = new ComputeBuffer(maximumProbe, sizeof(ReflectionData)); lightingEvents = RenderPipeline.GetEvent <LightingEvent>(); reflectionIndices = new ComputeBuffer(CBDRSharedData.XRES * CBDRSharedData.YRES * CBDRSharedData.ZRES * (maximumProbe + 1), sizeof(int)); string old = "_ReflectionCubeMap"; string newStr = new string(' ', old.Length + 1); reflectionCubemapIDs = new NativeList <int>(maximumProbe, maximumProbe, Allocator.Persistent); fixed(char *ctr = old) { fixed(char *newCtr = newStr) { for (int i = 0; i < old.Length; ++i) { newCtr[i] = ctr[i]; } for (int i = 0; i < reflectionCubemapIDs.Length; ++i) { newCtr[old.Length] = (char)(i + 48); reflectionCubemapIDs[i] = Shader.PropertyToID(newStr); } } } reflectionMat = new Material(resources.shaders.reflectionShader); ssrEvents.Init(resources); }
public void Prepare(PipelineResources.CameraRenderingPath renderingPath) { RequireEventAttribute requireEvt = GetType().GetCustomAttribute <RequireEventAttribute>(true); this.renderingPath = renderingPath; if (requireEvt != null) { if (dependingEvents == null) { dependingEvents = new List <PipelineEvent>(requireEvt.events.Length); } foreach (var t in requireEvt.events) { PipelineEvent targetevt = RenderPipeline.GetEvent(renderingPath, t); if (targetevt != null) { if (targetevt.dependedEvents == null) { targetevt.dependedEvents = new List <PipelineEvent>(); } targetevt.dependedEvents.Add(this); dependingEvents.Add(targetevt); } } } }
protected override void Init(PipelineResources resources) { // debugMat = new Material(debug); downSampleDepthMat = new Material(resources.shaders.depthDownSample); GTAOMaterial = new Material(resources.shaders.gtaoShader); propertySetEvent = RenderPipeline.GetEvent <PropertySetEvent>(); }
protected override void Init(PipelineResources resources) { proper = RenderPipeline.GetEvent <PropertySetEvent>(); if (useTBDR) { minMaxBoundMat = new Material(resources.shaders.minMaxDepthBounding); } needCheckedShadows = new NativeList <ShadowAvaliable>(20, Allocator.Persistent); cbdr = new CBDRSharedData(resources); for (int i = 0; i < cascadeShadowMapVP.Length; ++i) { cascadeShadowMapVP[i] = Matrix4x4.identity; } cubeDepthMaterial = new Material(resources.shaders.cubeDepthShader); spotBuffer = new RenderSpotShadowCommand(); spotBuffer.Init(resources.shaders.spotLightDepthShader); whiteTex = new Texture2DArray(1, 1, 1, TextureFormat.ARGB32, false, false); whiteTex.SetPixels(new Color[] { Color.white }, 0); if (iesTextures.Length > 0) { ComputeShader texCopyShader = resources.shaders.texCopyShader; iesAtlas = new RenderTexture(new RenderTextureDescriptor { colorFormat = RenderTextureFormat.R8, dimension = TextureDimension.Tex2DArray, width = 256, height = 1, volumeDepth = iesTextures.Length, enableRandomWrite = true, msaaSamples = 1 }); ((RenderTexture)iesAtlas).Create(); UpdateIESTexture(texCopyShader); } }
// public Shader debug; // private Material debugMat; /* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* */ protected override void Init(PipelineResources resources) { // debugMat = new Material(debug); GTAOMaterial = new Material(resources.shaders.gtaoShader); propertySetEvent = RenderPipeline.GetEvent <PropertySetEvent>(); dataBuffer = new ComputeBuffer(1, sizeof(AOData), ComputeBufferType.Constant); proper = RenderPipeline.GetEvent <PropertySetEvent>(); }
public void Init(PipelineResources res) { getDataFunc = (c) => new SSRCameraData(new Vector2Int(c.cam.pixelWidth, c.cam.pixelHeight), 2); StochasticScreenSpaceReflectionMaterial = new Material(res.shaders.ssrShader); ssrDatas = new ComputeBuffer(1, sizeof(SSRData), ComputeBufferType.Constant); rand = new Random((uint)System.Guid.NewGuid().GetHashCode()); propertySetEvent = RenderPipeline.GetEvent <PropertySetEvent>(); }
public void Init(PipelineResources res) { cbdrShader = res.shaders.cbdrShader; proper = RenderPipeline.GetEvent <PropertySetEvent>(); lightingEvt = RenderPipeline.GetEvent <LightingEvent>(); decalBuffer = new ComputeBuffer(INITCOUNT, sizeof(DecalStrct)); sortJob.sortedDecalDatas = new NativeList <DecalStrct>(INITCOUNT, Allocator.Persistent); minMaxBoundMat = new Material(res.shaders.minMaxDepthBounding); }
protected override void Init(PipelineResources resources) { cbdr = new CBDRSharedData(resources); volumetricEvent = RenderPipeline.GetEvent <VolumetricLightEvent>(renderingPath); for (int i = 0; i < cascadeShadowMapVP.Length; ++i) { cascadeShadowMapVP[i] = Matrix4x4.identity; } cubeDepthMaterial = new Material(resources.shaders.cubeDepthShader); spotBuffer = new RenderSpotShadowCommand(); spotBuffer.Init(resources.shaders.spotLightDepthShader); }
public void Init(PipelineResources res) { cbdrShader = res.shaders.cbdrShader; copyMat = new Material(res.shaders.copyShader); proper = RenderPipeline.GetEvent <PropertySetEvent>(); lightingEvt = RenderPipeline.GetEvent <LightingEvent>(); decalBuffer = new ComputeBuffer(INITCOUNT, sizeof(DecalStrct)); decalIndexBuffer = new ComputeBuffer(CBDRSharedData.XRES * CBDRSharedData.YRES * CBDRSharedData.ZRES * (CBDRSharedData.MAXLIGHTPERCLUSTER + 1), sizeof(int)); if (decalAlbedoAtlasNames.Length > 0) { decalAlbedoAtlas = new RenderTexture(new RenderTextureDescriptor { width = atlasWidth, height = atlasHeight, volumeDepth = decalAlbedoAtlasNames.Length, dimension = TextureDimension.Tex2DArray, msaaSamples = 1, colorFormat = RenderTextureFormat.ARGB32 }); } if (decalNormalAtlasNames.Length > 0) { decalNormalAtlas = new RenderTexture(new RenderTextureDescriptor { width = atlasWidth, height = atlasHeight, volumeDepth = decalAlbedoAtlasNames.Length, dimension = TextureDimension.Tex2DArray, msaaSamples = 1, colorFormat = RenderTextureFormat.RGHalf }); } for (int i = 0; i < decalAlbedoAtlasNames.Length; ++i) { Graphics.SetRenderTarget(decalAlbedoAtlas.colorBuffer, decalAlbedoAtlas.depthBuffer, 0, CubemapFace.Unknown, i); Texture tex = Resources.Load <Texture>(decalAlbedoAtlasNames[i]); copyMat.SetTexture(ShaderIDs._MainTex, tex); copyMat.SetPass(0); Graphics.DrawMeshNow(GraphicsUtility.mesh, Matrix4x4.identity); Resources.UnloadAsset(tex); } for (int i = 0; i < decalNormalAtlasNames.Length; ++i) { Graphics.SetRenderTarget(decalNormalAtlas.colorBuffer, decalNormalAtlas.depthBuffer, 0, CubemapFace.Unknown, i); Texture tex = Resources.Load <Texture>(decalNormalAtlasNames[i]); copyMat.SetTexture(ShaderIDs._MainTex, tex); copyMat.SetPass(1); Graphics.DrawMeshNow(GraphicsUtility.mesh, Matrix4x4.identity); Resources.UnloadAsset(tex); } Object.DestroyImmediate(copyMat); }
protected override void Init(PipelineResources resources) { lightingData = RenderPipeline.GetEvent <LightingEvent>(); randomBuffer = new ComputeBuffer(downSampledSize.x * downSampledSize.y * downSampledSize.z, sizeof(uint)); NativeArray <uint> randomArray = new NativeArray <uint>(randomBuffer.count, Allocator.Temp, NativeArrayOptions.UninitializedMemory); uint *randPtr = randomArray.Ptr(); for (int i = 0; i < randomArray.Length; ++i) { randPtr[i] = (uint)-System.Guid.NewGuid().GetHashCode(); } randomBuffer.SetData(randomArray); randomArray.Dispose(); }
protected override void Init(PipelineResources resources) { linearMat = new Material(resources.shaders.linearDepthShader); linearDrawerMat = new Material(resources.shaders.linearDrawerShader); motionVecMat = new Material(resources.shaders.motionVectorShader); if (useHiZ) { hizDepth.InitHiZ(resources, new Vector2(Screen.width, Screen.height)); clusterMat = new Material(resources.shaders.clusterRenderShader); } ao = RenderPipeline.GetEvent <AOEvents>(); reflection = RenderPipeline.GetEvent <ReflectionEvent>(); proper = RenderPipeline.GetEvent <PropertySetEvent>(); downSampleMat = new Material(resources.shaders.depthDownSample); }
protected override void Init(PipelineResources resources) { proper = RenderPipeline.GetEvent <PropertySetEvent>(); if (useEmissionGeometry) { geometry.Init(); } if (useNoiseEvents) { noiseEvents.Init(resources); } lightingData = RenderPipeline.GetEvent <LightingEvent>(); reflectData = RenderPipeline.GetEvent <ReflectionEvent>(); lightingMat = new Material(resources.shaders.volumetricShader); cameraNormalBuffer = new ComputeBuffer(3, sizeof(float3)); }
public void Prepare() { RequireEventAttribute requireEvt = GetType().GetCustomAttribute <RequireEventAttribute>(true); if (requireEvt != null) { foreach (var t in requireEvt.events) { PipelineEvent targetevt = RenderPipeline.GetEvent(t); if (targetevt != null) { targetevt.dependedEvents.Add(new UIntPtr(MUnsafeUtility.GetManagedPtr(this))); dependingEvents.Add(new UIntPtr(MUnsafeUtility.GetManagedPtr(targetevt))); } } } }
protected override void Init(PipelineResources resources) { proper = RenderPipeline.GetEvent <PropertySetEvent>(); if (useEmissionGeometry) { geometry.Init(); } if (useNoiseEvents) { noiseEvents.Init(resources); } lightingData = RenderPipeline.GetEvent <LightingEvent>(); reflectData = RenderPipeline.GetEvent <ReflectionEvent>(); lightingMat = new Material(resources.shaders.volumetricShader); cameraNormalBuffer = new ComputeBuffer(3, sizeof(float3)); blackCB = new Cubemap(1, TextureFormat.ARGB32, false); blackCB.SetPixel(CubemapFace.NegativeX, 0, 0, Color.black); blackCB.SetPixel(CubemapFace.NegativeY, 0, 0, Color.black); blackCB.SetPixel(CubemapFace.NegativeZ, 0, 0, Color.black); blackCB.SetPixel(CubemapFace.PositiveX, 0, 0, Color.black); blackCB.SetPixel(CubemapFace.PositiveX, 0, 0, Color.black); blackCB.SetPixel(CubemapFace.PositiveX, 0, 0, Color.black); volumeDesc = new RenderTextureDescriptor { autoGenerateMips = false, bindMS = false, colorFormat = RenderTextureFormat.ARGBHalf, depthBufferBits = 0, dimension = TextureDimension.Tex3D, enableRandomWrite = true, height = downSampledSize.y, width = downSampledSize.x, memoryless = RenderTextureMemoryless.None, msaaSamples = 1, shadowSamplingMode = ShadowSamplingMode.None, sRGB = false, useMipMap = false, volumeDepth = downSampledSize.z, vrUsage = VRTextureUsage.None }; volumeTex = new RenderTexture(volumeDesc); volumeTex.filterMode = FilterMode.Bilinear; volumeTex.wrapMode = TextureWrapMode.Clamp; volumeTex.Create(); }
protected override void Init(PipelineResources resources) { proper = RenderPipeline.GetEvent <PropertySetEvent>(); if (useTBDR) { minMaxBoundMat = new Material(resources.shaders.minMaxDepthBounding); } needCheckedShadows = new NativeList <ShadowAvaliable>(20, Allocator.Persistent); cbdr = new CBDRSharedData(resources); for (int i = 0; i < cascadeShadowMapVP.Length; ++i) { cascadeShadowMapVP[i] = Matrix4x4.identity; } cubeDepthMaterial = new Material(resources.shaders.cubeDepthShader); spotBuffer = new RenderSpotShadowCommand(); spotBuffer.Init(resources.shaders.spotLightDepthShader); lightingMaterial = new Material(resources.shaders.lightingShader); }
protected override void Init(PipelineResources resources) { decalEvt.Init(resources); linearMat = new Material(resources.shaders.linearDepthShader); linearDrawerMat = new Material(resources.shaders.linearDrawerShader); if (useHiZ) { #if UNITY_EDITOR if (Application.isPlaying) { #endif hizDepth.InitHiZ(resources); clusterMat = new Material(resources.shaders.clusterRenderShader); #if UNITY_EDITOR } #endif } ao = RenderPipeline.GetEvent <AOEvents>(); reflection = RenderPipeline.GetEvent <ReflectionEvent>(); proper = RenderPipeline.GetEvent <PropertySetEvent>(); }
protected override void Init(PipelineResources resources) { proper = RenderPipeline.GetEvent <PropertySetEvent>(); if (useEmissionGeometry) { geometry.Init(); } if (useNoiseEvents) { noiseEvents.Init(resources); } lightingData = RenderPipeline.GetEvent <LightingEvent>(); reflectData = RenderPipeline.GetEvent <ReflectionEvent>(); lightingMat = new Material(resources.shaders.volumetricShader); cameraNormalBuffer = new ComputeBuffer(3, sizeof(float3)); blackCB = new Cubemap(1, TextureFormat.ARGB32, false); blackCB.SetPixel(CubemapFace.NegativeX, 0, 0, Color.black); blackCB.SetPixel(CubemapFace.NegativeY, 0, 0, Color.black); blackCB.SetPixel(CubemapFace.NegativeZ, 0, 0, Color.black); blackCB.SetPixel(CubemapFace.PositiveX, 0, 0, Color.black); blackCB.SetPixel(CubemapFace.PositiveX, 0, 0, Color.black); blackCB.SetPixel(CubemapFace.PositiveX, 0, 0, Color.black); }
protected override void Init(PipelineResources resources) { decalEvt.Init(resources); linearMat = new Material(resources.shaders.linearDepthShader); linearDrawerMat = new Material(resources.shaders.linearDrawerShader); motionVecMat = new Material(resources.shaders.motionVectorShader); if (useHiZ) { #if UNITY_EDITOR if (Application.isPlaying) { #endif hizDepth.InitHiZ(resources, new Vector2(Screen.width, Screen.height)); clusterMat = new Material(resources.shaders.clusterRenderShader); #if UNITY_EDITOR } #endif } ao = RenderPipeline.GetEvent <AOEvents>(); reflection = RenderPipeline.GetEvent <ReflectionEvent>(); proper = RenderPipeline.GetEvent <PropertySetEvent>(); downSampleMat = new Material(resources.shaders.depthDownSample); }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected override void Init(PipelineResources resources) { proper = RenderPipeline.GetEvent <PropertySetEvent>(); SSGi_Material = new Material(resources.shaders.ssgiShader); }
protected override void Init(PipelineResources resources) { proper = RenderPipeline.GetEvent <PropertySetEvent>(); }
protected override void Init(PipelineResources resources) { taaMat = new Material(resources.shaders.taaShader); proper = RenderPipeline.GetEvent <PropertySetEvent>(); }
protected override void Init(PipelineResources resources) { lightingData = RenderPipeline.GetEvent <LightingEvent>(); reflectData = RenderPipeline.GetEvent <ReflectionEvent>(); lightingMat = new Material(resources.shaders.lightingShader); }
/* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* */ protected override void Init(PipelineResources resources) { GTAOMaterial = new Material(resources.shaders.gtaoShader); propertySetEvent = RenderPipeline.GetEvent <PropertySetEvent>(); }
public void Init() { proper = RenderPipeline.GetEvent <PropertySetEvent>(); decalTargets = new RenderTargetIdentifier[2]; }
protected override void Init(PipelineResources resources) { proper = RenderPipeline.GetEvent <PropertySetEvent>(); blur.Init(resources.shaders.rapidBlurShader); }
protected override void Init(PipelineResources resources) { lightingData = RenderPipeline.GetEvent <LightingEvent>(); }
protected override void Init(PipelineResources resources) { lightingEvt = RenderPipeline.GetEvent <LightingEvent>(); decalCountBuffer = new ComputeBuffer(CBDRSharedData.XRES * CBDRSharedData.YRES * CBDRSharedData.ZRES * (maxDecalPerCluster + 1), sizeof(uint)); decalBuffer = new ComputeBuffer(decalInitCount, sizeof(DecalData)); }