- Home /
render images on headless ubuntu server
I am trying to render images via a Unity build on an Ubuntu ssh server without a graphical interface. In the player log file the render is always a null device. How do I get a renderer?
In windows 10 it works even in -batchmode it finds a renderer and save the "test_pic".
I am also trying to debug this issue with a Ubuntu virtual machine but in the log file it also says: " No supported renderers found, exiting". When I am using the -bachmode cammand line argument it saves an image but it is gray because there is no renderer.
Thank you for any help I am stuck on this problem for a while now...
If you need any further information please let me know.
I have the following script attached to the camera:
public class test : MonoBehaviour
{
void Start()
{
StartCoroutine(CapturePNGasBytes());
}
private IEnumerator CapturePNGasBytes()
{
Camera currentCamera = GetComponent<Camera>();
yield return new WaitForEndOfFrame();
int width = new int();
int height = new int();
width = 256;
height = 256;
//create rendertexture, Texture2D and
RenderTexture rt = new RenderTexture(width, height, 24, RenderTextureFormat.ARGB32);
Texture2D sceneTexture = new Texture2D(width, height, TextureFormat.RGB24, false);
Rect rectangle = new Rect(0,0,width,height);
currentCamera.targetTexture = rt;
currentCamera.Render();
RenderTexture.active = rt;
sceneTexture.ReadPixels(rectangle,0,0);
sceneTexture.Apply();
//clean up
currentCamera.targetTexture = null;
RenderTexture.active = null;
//save image
byte[] bytesPNG = sceneTexture.EncodeToPNG();
System.IO.File.WriteAllBytes("test_pic.PNG", bytesPNG);
}
}
My PlayerLog file:
Multi-casting "[IP] 129.206.117.192 [Port] 55137 [Flags] 3 [Guid] 3521465150 [EditorId] 3375015719 [Version] 1048832 [Id] LinuxPlayer(129.206.117.192) [Debug] 1 [PackageName] LinuxPlayer" to [225.0.0.222:54997]...
Waiting for connection from host on [0.0.0.0:55137]...
Remaining time:8s
Remaining time:7s
Remaining time:6s
Remaining time:5s
Remaining time:4s
Remaining time:3s
Remaining time:2s
Remaining time:1s
Remaining time:0s
Timed out. Continuing without host connection.
Started listening to [0.0.0.0:55137]
Starting managed debugger on port 56150
Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,server=y,suspend=n,address=0.0.0.0:56150
Preloaded 'ScreenSelector.so'
PlayerConnection already initialized - listening to [0.0.0.0:55137]
Initialize engine version: 2019.2.10f1 (923acd2d43aa)
[XR] Discovering subsystems at path /net/hcihome/storage/rhaecker/scratch/documents/newupload/testpic_Data/UnitySubsystems
Forcing GfxDevice: Null
GfxDevice: creating device client; threaded=0
NullGfxDevice:
Version: NULL 1.0 [1.0]
Renderer: Null Device
Vendor: Unity Technologies
Begin MonoManager ReloadAssembly
- Completed reload, in 0.341 seconds
UnloadTime: 1.052370 ms
Setting up 16 worker threads for Enlighten.
Thread -> id: 7f8366fb2700 -> priority: 1
Thread -> id: 7f83667b1700 -> priority: 1
Thread -> id: 7f8365fb0700 -> priority: 1
Thread -> id: 7f83657af700 -> priority: 1
Thread -> id: 7f8364fae700 -> priority: 1
Thread -> id: 7f8343fff700 -> priority: 1
Thread -> id: 7f83437fe700 -> priority: 1
Thread -> id: 7f8342ffd700 -> priority: 1
Thread -> id: 7f83427fc700 -> priority: 1
Thread -> id: 7f8341ffb700 -> priority: 1
Thread -> id: 7f83417fa700 -> priority: 1
Thread -> id: 7f8340ff9700 -> priority: 1
Thread -> id: 7f8323fff700 -> priority: 1
Thread -> id: 7f83237fe700 -> priority: 1
Thread -> id: 7f8322ffd700 -> priority: 1
Thread -> id: 7f83227fc700 -> priority: 1
##utp:{"type":"MemoryLeaks","version":2,"phase":"Immediate","time":1572882315208,"processId":7294,"allocatedMemory":5259,"memoryLabels":[{"Default":1584},{"NewDelete":109},{"Thread":-192},{"Manager":256},{"Audio":192},{"Physics":32},{"Serialization":40},{"Terrain":88},{"String":1886},{"DynamicArray":64},{"PoolAlloc":-88},{"VR":1288}]}
Comment
Answer by Bunny83 · Nov 04, 2019 at 05:16 PM
This sounds like a similar issues as it was mentioned over here
Your answer
Follow this Question
Related Questions
Render to 'RenderTexture' in 'Headless Mode' 0 Answers
Changing two different objects renderer colour 1 Answer
Camera can see an Object 1 Answer
Problem with open world games 3 Answers