Press "Enter" to skip to content

The way using Blit in HDRP

内容纲要

The discussion link

    RTHandle rt;
    Material material;

    public override void Setup()
    {
        if (Shader.Find(kShaderName) != null)
            material = new Material(Shader.Find(kShaderName));
        else
            Debug.LogError($"Unable to find shader '{kShaderName}'. Post Process Volume TestPP is unable to load.");

        rt = RTHandles.Alloc(scaleFactor: Vector2.one * 0.25f, filterMode: FilterMode.Point, wrapMode: TextureWrapMode.Clamp, dimension: TextureDimension.Tex2D);
    }

    public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle destination)
    {
        if (material == null)
            return;

        HDUtils.BlitCameraTexture(cmd, source, rt, material, 0);
        cmd.Blit(rt, destination, 0, 0);
    }

    public override void Cleanup()
    {
        rt.Release();
        CoreUtils.Destroy(material);
    }
发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注