Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Headless Scene Render to Snapshot Image

Discussion in 'General Graphics' started by simonchronos, Aug 21, 2023.

  1. simonchronos

    simonchronos

    Joined:
    Jul 28, 2022
    Posts:
    1
    I have a multiplayer Unity game where players can take screenshots of their avatars wearing different assets (clothing, accessories, etc), and those resulting screenshots get uploaded to a central server for other players to see.

    However, due to manipulation, the players are able to change the local client-side assets (in-memory manipulation, raw files, etc), so that in their local client they add undesirable things (changing shirts to have swastikas, etc). The resulting screenshot gets uploaded, but contains these bad elements. The "good" assets are known, and exist on the server, they are only being modified in the client.

    Leave aside for the moment doing further work to make it harder to do this kind of thing in the client. I wanted to explore the idea of making this screen-shotting process occur server-side so that the rendering of the screenshots can use only the approved assets, free of player manipulation. However, this would seem to require that the entire current as-is scene be transferred as is to a server, re-rendered, then screenshot. Perhaps just culled to the viewpoint of the camera in the client. The server does not need to run the full game loop, just load the static scene assets, render it, and output a screenshot.

    1. What options exist for this kind of thing? Can this be done with a headless unity setup?

    2. Are there pre-existing examples or demos of this kind of thing?

    3. Technically, in order to do this, what kind of information would need to be exported from the Unity client, in a lightweight, minimal way, to provide this information to the server? And more importantly, is this kind of minimalistic export possible from the Unity client?

    4. Is this a misguided way to think about the whole thing? :) If so, any interesting alternatives?

    Thanks!
     
  2. c0d3_m0nk3y

    c0d3_m0nk3y

    Joined:
    Oct 21, 2021
    Posts:
    568
    This is kind of funny, even though it's sad.

    You could simply (asynchronously) render the screenshots of all avatars on the clients and cache them. That's how it was done in a MMO that I worked on.

    I don't think a headless Unity server will be able to render things. Servers could use software rendering library like Mesa 3D (something I did in another project), but that's not something that Unity supports.
     
    Last edited: Aug 21, 2023