Search Unity

Camera.targetTexture has unintended behaviour with HDR?

Discussion in 'Image Effects' started by KAJed, Jul 25, 2019.

  1. KAJed

    KAJed

    Joined:
    Mar 15, 2013
    Posts:
    8
    I am attempting to composite a PixelPerfect camera properly with other cameras. In the process I am using Camera.targetTexture. I set it to a low res texture in OnPreCull and back to null in OnPostRender.

    There are two issues that arise:

    1- It never actually renders to the texture I gave it. Instead it chooses to create it's own copy in a temp buffer and write to that instead. Which I could live with if...

    2- After the camera has completed drawing I blit the results in OnRenderImage with an alpha blended material so that I can composite it. However, this happens to occur on a texture that is of format Default (ie: ARGB32). I have attempted to move this blit into a command buffer but the result is always the same: blitting to a non HDR texture.

    If anyone has any insight, especially the Unity folk who wrote the PixelPerfectCamera originally it would be helpful.
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,866
    Don't use OnRenderImage with OnPreRender and OnPostRender.
     
  3. KAJed

    KAJed

    Joined:
    Mar 15, 2013
    Posts:
    8
    Note: I have attempted to move this blit into a command buffer but the result is always the same: blitting to a non HDR texture.

    I am aware that is not the correct way to do things. But it doesn't change the issue.
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,866
    I am not talking about a command bugger.

    I am talking about setting the targettexture in onPreRender, then doing your blitting in onPostRender.