Search Unity

Question Attempts to record a frame from MainCamera using Recorder give a blank image.

Discussion in 'Audio & Video' started by JulianNeil, Feb 4, 2024.

  1. JulianNeil

    JulianNeil

    Joined:
    Jun 27, 2022
    Posts:
    78
    I can record frames from the Game View using the Recorder, but aliasing is awful. So I tried to record from the main camera instead.

    But the images recorded are always blank. I am using 2022.3.15f1, in a 2D URP project. I have a single camera.

    Any help would be appreciated.
     
  2. JulianNeil

    JulianNeil

    Joined:
    Jun 27, 2022
    Posts:
    78
    After checking more settings - I had turned off post processing in my 2DRendererData , and in disabled anti aliasing in the camera settings, which explains why i had no antialiasing when recording the Game View.

    Still blank output when recording a camera - which I dont understand.
     
  3. JulianNeil

    JulianNeil

    Joined:
    Jun 27, 2022
    Posts:
    78
    And now no matter what I do I cannot get the background to be transparent.
     
  4. JulianNeil

    JulianNeil

    Joined:
    Jun 27, 2022
    Posts:
    78
    ok.. so I changed the camera to output to a rendure texture asset, and changed the recorder to use that asset, and now I have transparency finally.
    Man.. that was a lot harder than it should have been.

    I would still like to know why i cant use the recorder with cameras directly.
     
  5. marief_unity

    marief_unity

    Unity Technologies

    Joined:
    Oct 9, 2018
    Posts:
    142
    Hi there !

    Glad you found a workaround ! Each type of input comes with a set of features and/or constraints, that's what makes it sometimes hard to figure out what is the best input to use.
    We always try to improve the documentation to help with that, so your feedback is appreciated !

    That said, feels to me you are hitting is a bug (blank result with camera input). The doc mentions that Active Camera can't be used in SRPs but Main Camera / Tagged Camera should work. I was able to repro the issue you have in a 2D URP project (works in a 3D URP project, though).
    I'll make sure the bug is reported.

    Thanks for following up and posting your progress !
     
  6. thomastt_unity

    thomastt_unity

    Unity Technologies

    Joined:
    Nov 6, 2018
    Posts:
    13
    Hi!

    After further investigation, turns out the URP 2D renderer is missing a pass in their render graph that would allow Recorder to capture the image from the Camera. The issue does not come from your project.
    I've reported it to the appropriate team.

    In the meantime, using a RenderTexture is a good alternative. Thanks!
     
    JulianNeil likes this.