Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headless mode #564

Open
5Mixer opened this issue Oct 8, 2020 · 6 comments
Open

Headless mode #564

5Mixer opened this issue Oct 8, 2020 · 6 comments

Comments

@5Mixer
Copy link
Contributor

5Mixer commented Oct 8, 2020

Is your feature request related to a problem? Please describe.
Cannot render sprite atlases with GPU acceleration.

Describe the solution you'd like
An API or target that allows typical GPU rendering to framebuffers, without requiring an open window.

Describe alternatives you've considered
CPU rendering is currently possible with pure haxe, however is slow. Exporting to HTML5 (from Kha) and using a headless browser might work but has significant overhead.

@luboslenco
Copy link
Contributor

In the meantime you could prevent the window from showing up via https://github.com/Kode/Kinc/blob/master/Sources/kinc/window.h#L39.
Super old example: https://github.com/luboslenco/make_atlas.

@5Mixer
Copy link
Contributor Author

5Mixer commented Oct 8, 2020

Very nice, thanks @luboslenco!

@Clockwork-Muse
Copy link

Unfortunately, this doesn't actually work for my use case, for a few reasons:

  • For whatever reason, on an Ubuntu 20.04 machine it still pops a window up.
  • Attempting to run it in a docker container requires mapping an X11 port (because of the window), which would require the host be running an X11 process, and thus that the container be specifically configured for the host (because of authorization to access the port - this either requires knowing some additional info about the host, or building the container on the host).
  • Attempting to use Vulkan fails here:
uint32_t formatCount;
err = fpGetPhysicalDeviceSurfaceFormatsKHR(gpu, surface, &formatCount, nullptr);
assert(!err);

err is -3, VK_ERROR_INITIALIZATION_FAILED, but it's not clear why. I can get OpenGL to run, though.

(Buildable dockerfile for vulkan failures, run from sample repository root).

Note that it's possible in general to have applications/deployments that aren't subject to these issues - UnrealEngine, for example, is able to run in a container (although it only got the ability to run vulkan headless recently - 4.25.2 or so, about a couple of months ago)

@Clockwork-Muse
Copy link

Note that I haven't been able to get things to run on a headless server (yet). I'm keeping looking, but I'm not too confident.
From some cursory research, I think all that needs to happen is that EGL support is extended to linux, but I'm not sure of the work required, or what else might be required here.

@anon-cs
Copy link

anon-cs commented Jul 4, 2021

@Clockwork-Muse @5Mixer Were you able to get this to work? If so, could you please write what you did that eventually enabled you render things in the background using Kha?

@luboslenco How did you prevent the window from showing up? I'm not sure what I need to change in line 39 of window.h. Could you elaborate on this please? Would this change allow me to do rendering in background for Armory?

@RobDangerous Would you be able give us some points on how one can do rendering in the background using Kha? Really appreciate it

@Clockwork-Muse
Copy link

@anon-cs - I ended up switch to Panda3d. Blender integration via armory isn't relevant to my final use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants