Ejemplo n.º 1
0
        public CostumRenderPipeline(bool DynamicBatching, bool Instancing, bool batcher, ComputeShader cs, bool useCS, Texture skyboxTexture, bool useAA, Color color, float seed)
        {
            //set up variables
            m_UseAA              = useAA;
            m_useCS              = useCS;
            m_computShader       = cs;
            m_useDynamicBatching = DynamicBatching;
            m_GPUInstancing      = Instancing;
            GraphicsSettings.useScriptableRenderPipelineBatching = batcher;
            Debug.Log("Creating pipeline asset!");
            //cleanup camera info if new RP asset gets created // RP asset gets changed
            foreach (Camera cam in Camera.allCameras)
            {
                cam.depthTextureMode = DepthTextureMode.Depth;
                cam.depthTextureMode = DepthTextureMode.DepthNormals;
                cam.depthTextureMode = DepthTextureMode.MotionVectors;
                CamerInfoComponent info = cam.GetComponent <CamerInfoComponent>();
                //Create info if null
                if (info == null)
                {
                    info = cam.gameObject.AddComponent <CamerInfoComponent>();
                }
                //Init ray casting
                m_RayCastMaster = new RayCastMaster();
                m_RayCastMaster.Init(m_computShader, Camera.main, skyboxTexture, color, seed, Camera.main.GetComponent <CamerInfoComponent>());
                info.Init(m_UseAA, m_useCS, m_RayCastMaster);
            }

            //Init new renderer
            m_renderer = new CameraRenderer();
        }
Ejemplo n.º 2
0
    public void OnEnable()
    {
        m_sr  = GetComponent <SpriteRenderer>();
        m_tex = m_sr?.sprite.texture;
        float max = Mathf.Max(m_tex.width, m_tex.height);
        float pow = Mathf.Ceil(max / 64.0f);

        if (pow == 1)
        {
            TexSize    = TextureMode.TEX64;
            Dimensions = 64;
        }
        if (pow == 2)
        {
            TexSize    = TextureMode.TEX128;
            Dimensions = 128;
        }
        if (pow == 3 || pow == 4)
        {
            TexSize    = TextureMode.TEX256;
            Dimensions = 256;
        }
        if (pow >= 5 && pow <= 8)
        {
            TexSize    = TextureMode.TEX512;
            Dimensions = 512;
        }


        Rebuild = true;
        RayCastMaster.SubscribeTexture(this);
        m_sr = GetComponent <SpriteRenderer>();
    }
Ejemplo n.º 3
0
 public void Init(bool useAntiAliasing, bool useRT, RayCastMaster raycaster)
 {
     SampleCount   = 0;
     RayCaster     = raycaster;
     UseAA         = useAntiAliasing;
     UseRayTracing = useRT;
 }
Ejemplo n.º 4
0
        private void ExecuteComputeShader(RayCastMaster master)
        {
            if (master == null)
            {
                Debug.LogError("Ray casting master is null!");
                return;
            }
            InitPostProcessing();
            if (m_firstDraw)
            {
                m_previousDepth = m_DepthRT;
                m_firstDraw     = false;
            }



            RenderTexture rt = master.Render();


            m_RTPostProcessing.SetRenderTextures(rt, m_DepthRT, m_previousDepth, m_previousTextures, m_albedo);

            rt = m_RTPostProcessing.Render();
            //   m_previousTextures.Insert(0, rt);
            //   m_buffer.Blit(rt, master.ConvergedRT, m_AAMaterial);
            //    m_buffer.Blit(m_RTPostProcessing.Render(), master.ConvergedRT);

            //m_buffer.Blit(rt, master.ConvergedRT);
            m_buffer.Blit(rt, master.ConvergedRT, m_AAMaterial);

            m_buffer.Blit(master.ConvergedRT, BuiltinRenderTextureType.RenderTexture);

            //m_AAMaterial);
            //  m_buffer.Blit(rt, BuiltinRenderTextureType.RenderTexture);



            //m_previousDepth.Create();

            //Trimm last list element
            while (m_previousTextures.Count > 10)
            {
                m_previousTextures.RemoveAt(m_previousTextures.Count - 1);
            }


            m_camInfo.SampleCount++;
        }
 public void OnEnable()
 {
     Debug.Log("on Enable!");
     NeedsRebuilding = true;
     RayCastMaster.SubscribeSphere(this);
 }
 private void OnDisable()
 {
     RayCastMaster.UnSubscribeSphere(this);
 }
Ejemplo n.º 7
0
 public void OnDisable()
 {
     RayCastMaster.UnSubscribeTexture(this);
 }
Ejemplo n.º 8
0
 private void OnDisable()
 {
     RayCastMaster.UnsubscribeMesh(this);
 }
Ejemplo n.º 9
0
 public void OnEnable()
 {
     NeedsRebuilding = true;
     RayCastMaster.SubscribeMesh(this);
 }