x


Rendering to file in batchmode?

We're trying to write a server-side app in Unity Pro. Part of its function is to generate images and serve them to a browser. This works fine if the app is started the regular, windowed way. Ideally, we'd like the app to run headless. The problem is, as far as I understand, Unity's "-batchmode" flag disables the rendering pipeline completely.

Is there a way to run Unity in headless mode whilst retaining its rendering capabilities?

more ▼

asked Apr 20 '10 at 02:49 PM

CaptainKeytar gravatar image

CaptainKeytar
32 1 2 1

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

This totally works, however I found you have to ensure you are using a forward renderer, and force the camera to render prior to running a screen capture.

Something like:

....
    camera.Render();
screenShot.ReadPixels(new Rect(0, 0, resWidth, resHeight), 0, 0);
....
more ▼

answered Apr 06 '12 at 01:54 AM

vade gravatar image

vade
32 2 3 3

(comments are locked)
10|3000 characters needed characters left

Perhaps this commandline might work? It's the reference DX renderer which MIGHT work without a gpu since it's pure cpu, although I doubt it :)

"-force-d3d9-ref (Windows only) Make the game run using Direct3D's "Reference" software renderer. DirectX SDK has to be installed for this to work. This is mostly useful for building automated test suites, where you want to ensure rendering is exactly the same no matter what's the graphics card."

more ▼

answered Jun 09 '10 at 01:45 AM

Vectrex gravatar image

Vectrex
116 1 1 6

(comments are locked)
10|3000 characters needed characters left

I don't believe it's possible to run a standalone player in batch mode without automatically disabling the rendering. As per the documentation:

-batchmode
Run the game in "headless" mode. The game will not display anything and won't accept user input. This is mostly useful for running servers of networked games.

Looks like you're going to either have to think up another solution, or run the game normally unfortunately.

more ▼

answered Jun 08 '10 at 11:02 PM

qJake gravatar image

qJake
11.6k 43 78 161

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3735
x412
x193
x119
x33

asked: Apr 20 '10 at 02:49 PM

Seen: 1947 times

Last Updated: Apr 06 '12 at 01:54 AM