Ejemplo n.º 1
0
        public SRP_Reflection(SRD_PlanarReflectionData _data, ComputeShader _reflectionCS)
        {
            m_CoreBlurs     = new PPCore_Blurs();
            m_PropertyBlock = new MaterialPropertyBlock();
            m_Data          = _data;
            m_CoreBlurs.OnValidate(_data.m_BlurParam);
            m_ReflectionPasses = new SRP_PlanarReflectionBase[C_MaxReflectionTextureCount];
            for (int i = 0; i < C_MaxReflectionTextureCount; i++)
            {
                switch (_data.m_ReflectionType)
                {
                case enum_ReflectionSpace.ScreenSpace:
                    m_ReflectionPasses[i] = new SRP_PlanarReflection_ScreenSpace(this, _reflectionCS);
                    break;

                case enum_ReflectionSpace.MirrorSpace:
                    m_ReflectionPasses[i] = new SRP_PlanarReflection_MirrorSpace(this);
                    break;
                }
            }
        }
Ejemplo n.º 2
0
 protected override void GenerateTarget(ScriptableRenderContext context, ref RenderingData renderingData, CommandBuffer cmd,
                                        RenderTextureDescriptor _descriptor, RenderTargetIdentifier _target, SRD_PlanarReflectionData _data, ref GPlane _plane)
 {
     ref CameraData cameraData = ref renderingData.cameraData;
Ejemplo n.º 3
0
        protected override void GenerateTarget(ScriptableRenderContext context, ref RenderingData renderingData, CommandBuffer cmd,
                                               RenderTextureDescriptor _descriptor, RenderTargetIdentifier _target, SRD_PlanarReflectionData _data, ref GPlane _plane)
        {
            cmd.SetComputeIntParam(m_ReflectionComputeShader, ID_SampleCount, _data.m_Sample);
            cmd.SetComputeVectorParam(m_ReflectionComputeShader, ID_PlaneNormal, _plane.normal.normalized);
            cmd.SetComputeVectorParam(m_ReflectionComputeShader, ID_PlanePosition, _plane.distance * _plane.normal);
            cmd.SetComputeVectorParam(m_ReflectionComputeShader, ID_Result_TexelSize, _descriptor.GetTexelSize());

            cmd.SetComputeTextureParam(m_ReflectionComputeShader, m_Kernels, ID_Input, m_Renderer.cameraColorTarget);
            cmd.SetComputeTextureParam(m_ReflectionComputeShader, m_Kernels, ID_Result, _target);
            cmd.DispatchCompute(m_ReflectionComputeShader, m_Kernels, m_ThreadGroups.m_X, m_ThreadGroups.m_Y, 1);
        }
Ejemplo n.º 4
0
 protected override void ConfigureColorDescriptor(ref RenderTextureDescriptor _descriptor, SRD_PlanarReflectionData _data)
 {
     base.ConfigureColorDescriptor(ref _descriptor, _data);
     _descriptor.enableRandomWrite = true;
     _descriptor.colorFormat       = RenderTextureFormat.ARGB32;
     m_Kernels      = m_ReflectionComputeShader.FindKernel("Generate");
     m_ThreadGroups = new Int2(_descriptor.width / 8, _descriptor.height / 8);
 }
Ejemplo n.º 5
0
 protected abstract void GenerateTarget(ScriptableRenderContext context, ref RenderingData renderingData, CommandBuffer cmd,
                                        RenderTextureDescriptor _descriptor, RenderTargetIdentifier _target, SRD_PlanarReflectionData _data, ref GPlane _plane);
Ejemplo n.º 6
0
        protected virtual void ConfigureColorDescriptor(ref RenderTextureDescriptor _descriptor, SRD_PlanarReflectionData _data)
        {
            int downSample = Mathf.Max(_data.m_DownSample, 1);

            _descriptor.width  /= downSample;
            _descriptor.height /= downSample;
        }