Search Unity

Capture screenshots in batchmode

Discussion in 'Editor & General Support' started by bhubble_within, Aug 15, 2019.

  1. bhubble_within

    bhubble_within

    Joined:
    Jun 12, 2019
    Posts:
    2
    I am trying to run a unity service on a server which will take telemetry data and render out screenshots. However, though I can generate screenshots when running normally whenever I try to run my app in batchmode it produces only black images that match my screen size. I am even making sure to call Camera.Render before taking each screenshot.

    Does anyone know what I can do to get this working or am I trying to accomplish something that is impossible?
     
  2. gekidoslayer

    gekidoslayer

    Unity Technologies

    Joined:
    Sep 27, 2016
    Posts:
    134
    The server would need a dedicated GPU and be running a full desktop session in order for the rendering to actually do anything.

    If you run unity in 'actual' batch mode - ie headless, no graphics mode, well, there won't...be any graphics to save out. Unity has a specific mode in this case that is the graphics equivalent of outputting things to dev/null - designed for running game servers etc without a graphics card, etc...
     
  3. bhubble_within

    bhubble_within

    Joined:
    Jun 12, 2019
    Posts:
    2
    Thanks for the response. The server does have a graphics card, it is just not running a desktop session. I had thought that batchmode was still capable of rendering if you manually called Camera.Render and you did not include the no graphics flag but it sounds like the thing we are trying to do is not actually possible.
     
  4. within_john

    within_john

    Joined:
    Jul 18, 2018
    Posts:
    3
    I'm curious as to why there is a separate -nographics flag if -batchmode also disables graphics? What would be your recommended approach to doing what we are trying to do (automatic offline rendering)? We want to be able to control the application with batch or shell scripting.
     
  5. jirimotejlek

    jirimotejlek

    Joined:
    Nov 8, 2016
    Posts:
    20
    I would also like to know how to do this.
     
  6. makomarkus

    makomarkus

    Joined:
    Oct 28, 2020
    Posts:
    61