camera.Render and Graphics.Blit

Sorry for many confusing question.

I want to use like Graphics.Blit(rt1,rt2,mat).

camera’s target is rt1.
and I think blit makes rt1 → rt2(with shader effect).
and I make material of static mesh 's main texture rt2.
is my usage wrong?

        _camera.Render();
        PolySpatialObjectUtils.MarkDirty(rt1);
        Graphics.Blit(rt1,rt2, blurmat);
        PolySpatialObjectUtils.MarkDirty(rt2);
        GetComponent<MeshRenderer>().material.mainTexture = rt2;
        PolySpatialObjectUtils.MarkDirty(GetComponent<MeshRenderer>());

Technically, the only call to MarkDirty that you need in this case should be MarkDirty(rt2). Cameras should automatically mark the RenderTexture dirty when you render to them (but you’re not sending rt1 via PolySpatial anyway, so it doesn’t matter if it’s dirty) and the MeshRenderer should automatically be marked dirty when you change the material (such as via using the .material accessor to create a new material instance).

Otherwise, that looks correct to me. If it’s not working, please submit a bug report with a repro case and let us know the incident number (IN-#####) so that we can investigate.

I have been using MarkDirty excessively - is there a best practice on where to use it? Right after Render(), right after .Blit(), or where?

It doesn’t matter, as long as you do it on or before the Unity LateUpdate. Anything flagged as dirty on a given frame will be transferred over PolySpatial after the LateUpdate. As for what you need to use it on, it’s for RenderTextures that are updated outside of a call to Camera.Render.

if you call markDirty() just once per Update, it should be fine?

Yes. Anything marked dirty is just added to a set that’s processed after LateUpdate.