isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
10.64k stars 2.21k forks source link

Docker for Open3D #262

Closed takanokage closed 6 years ago

takanokage commented 6 years ago

Headless rendering on ubuntu:16.04 with Xvfb, x11vnc, lxde and bind mounting.

takanokage commented 6 years ago

Oh, please note that the CI can't do anything with docker at the moment. I can imagine all kinds of issues in attempting to add the docker path to CI so for the time being I recommend testing it manually. Worked for me.

takanokage commented 6 years ago

please hold the merge, I need to make some tweaks. for example the proxy settings are specific to my local machine and won't work anywhere else.

syncle commented 6 years ago

We had decided to use util for the new folder name, not utilities.

takanokage commented 6 years ago

ok, let me change that in a second.

syncle commented 6 years ago

Thanks @takanokage. Can you also make a new PR to submit a document for this? We will need instructions to use this. You can work on docs/advanced/ and make headless_rendering.rst.

takanokage commented 6 years ago

Yep, that was the plan from the beginning. For the purpose of this particular PR I added brief instructions to #17.

takanokage commented 6 years ago

I have written the headless rendering documentation page. I'm sure there are things that I missed. Please try the headless rendering demo and let me know what you would like improved. Let me know if/how I can help; I'd be happy to walk you trough if/when you get stuck.

syncle commented 6 years ago

Awesome. Thanks @takanokage! I am looking this PR. I will post any comments regarding this.

syncle commented 6 years ago

I just tested this PR. I was able to save both depth and color images. However, the saved color images are just filled with black color. Depth images looks fine. @takanokage, can you check on this?

takanokage commented 6 years ago

will do. could you please give me more info? how did you obtain the color images?

syncle commented 6 years ago

I just tried headless rendering from terminal and use the following scripts.

$ cd <Open3D path>/utilities/docker/ubuntu-xvfb/tools
$ ./build.sh
$ ./attach.sh
$ ./headless_sample.sh
takanokage commented 6 years ago

I'm doing the same thing but it looks like I'm only getting depth images in /Open3D/build/lib/TestData/depth. Did you do anything else?

syncle commented 6 years ago

Nope. I did not tweak anything.

I'm only getting depth images in /Open3D/build/lib/TestData/depth

I think you are also having same trouble. My case saves color images in /Open3D/build/lib/TestData/color, but they are just black images.

takanokage commented 6 years ago

ok, I confirm the images in /Open3D/build/lib/TestData/image are black. There seems to be a problem with visualizer.capture_screen_float_buffer(...). What's your opinion? I'm still ramping up on the Open3D code so any pointers would help.

takanokage commented 6 years ago

Another observation: I'm getting similar behavior (black images) when operating Open3D over VNC.

qianyizh commented 6 years ago

visualizer.capture_screen_float_buffer() is a wrapper of this function:

https://github.com/IntelVCL/Open3D/blob/master/src/Visualization/Visualizer/VisualizerRender.cpp#L147-L174

It is weird because it should be no difference to visualizer.capture_depth_float_buffer(): https://github.com/IntelVCL/Open3D/blob/39e432b5cd2179725cc5403b5d53255f3eb41b71/src/Visualization/Visualizer/VisualizerRender.cpp#L223-L285

Maybe try to use capture_screen_image and capture_depth_image first to see if it is a problem with headless rendering / glReadPixels. If not, then it is probably a bug. Need to go into the C++ functions and debug.

takanokage commented 6 years ago

capture_depth_image works. capture_screen_image doesn't work (saves black images).

syncle commented 6 years ago

I believe we need to revisit GLFW3.3 + OSMesa Option. With GLFW3.2, I am having

RandR gamma ramp support seems broken

Errors, and that is probably the reason. As @takanokage said, this may occur segfault errors though.

qianyizh commented 6 years ago

I thought we have discussed this in #17 and have decided to use only glfw3.3 dev branch for headless rendering?

syncle commented 6 years ago

True. I prefer GLFW3.3 dev. Dan tried this option before and he decide to keep using GLFW3.2 due to technical reason. This PR still based on GLFW 3.2. However, I believe this issue should be addressed with GLFW3.3 dev.

takanokage commented 6 years ago

well, we've discussed several topics related to #17.

a. Jaesik worked with glfw3.3 in order to get to headless rendering. I didn't try that path and don't know if it works. b. I worked with Docker in order to get to headless rendering. glfw3.3 crashes in the Docker setup but glfw3.2 doesn't.

takanokage commented 6 years ago

I'd also like to point out that rendering works just fine as confirmed by VNC into the Docker container.

takanokage commented 6 years ago

I propose we break this down into two parts:

  1. the current PR
  2. another PR for the limitations/issues of the current headless solution.

Advantages:

If we do this we need to list the current known limitations in a "release" doc.

syncle commented 6 years ago

I am revisiting option a) GLFW 3.3 dev + OSMesa. The segmentation fault comes from glew. Open3D's glew is outdated and does not support OSMesa. Let me keep working on this issue.

takanokage commented 6 years ago

that sounds great, good luck!

syncle commented 6 years ago

Good news! glew2.1 + OSMesa18.0 + glfw3.3 dev works for headless rendering. I was able to generate rendering images from terminal via clean Ubuntu 16.04. I don't have any black screen images. I don't need to make a fake display. It just runs out-of-box.

I will need to polish how I did: dependencies, modifying cmake tool chains, adding switch "headless rendering" for selective compilation. This switch will feed one of graphical library (OpenGL or OSMesa) for glew and glfw.

Edit: This method is addressed in #273

syncle commented 6 years ago

@takanokage, Can you remove rendering from termal part in this PR? I think this PR need to be polished as a generic docker image for Open3D.

takanokage commented 6 years ago

how about we close this PR and start a new one once all the polishing is done?

syncle commented 6 years ago

Sure. It may look not that admirable if a PR is opened but not merged for long time.

takanokage commented 6 years ago

closing until #273 is over.