├── LICENSE ├── README.md ├── rgb ├── Dockerfile ├── mtsimport-headless.sh └── xorg.conf └── spectral └── Dockerfile /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mitsuba-docker 2 | Dockerfile and instructions for building Mitsuba 3 | 4 | # Hello! 5 | 6 | The `Dockerfiles` in this repository represent complete instructions for building [Mitsuba](https://www.mitsuba-renderer.org/) on Ubuntu. You can use this to create a Docker image with Mitsuba in it. 7 | 8 | You can also consult this to figure out how to build Mitsuba. The RUN commands are thing you can run on the command line. Some of them will require `sudo`. 9 | 10 | The build comes in two flavors. `/rgb` builds Mitsuba in standard RGB mode. `/spectral` builds Mitsuba with 31 spectrum slices in the range 395nm-405nm. 11 | 12 | # Get the Docker Image 13 | 14 | The Docker images are hosted on DockerHub. See [rgb](https://hub.docker.com/r/ninjaben/mitsuba-rgb/) and [spectral](https://hub.docker.com/r/ninjaben/mitsuba-spectral/). You can obtain them locally with: 15 | ``` 16 | sudo docker pull ninjaben/mitsuba-rgb 17 | sudo docker pull ninjaben/mitsuba-spectral 18 | ``` 19 | 20 | Or you can build them yourself from the Dockerfile: 21 | ``` 22 | git clone https://github.com/benjamin-heasly/mitsuba-docker.git 23 | cd mitsuba-docker 24 | sudo docker build -t your-name/mitsuba-rgb ./rgb 25 | sudo docker build -t your-name/mitsuba-spectral ./spectral 26 | ``` 27 | 28 | # Run a Docker Container 29 | 30 | You can launch a Docker container from one of these images and use it just like a Mitsuba executable: 31 | ``` 32 | sudo docker run -ti ninjaben/mitsuba-rgb mitsuba -h 33 | # or 34 | sudo docker run -ti ninjaben/mitsuba-spectral mitsuba -h 35 | ``` 36 | 37 | To give the container access to your Mitsuba scene files, mount in the current folder as a temporary volume: 38 | ``` 39 | sudo docker run -ti --rm -v `pwd`:`pwd` ninjaben/mitsuba-rgb mitsuba myScene.xml 40 | # or 41 | sudo docker run -ti --rm -v `pwd`:`pwd` ninjaben/mitsuba-spectral mitsuba myScene.xml 42 | ``` 43 | -------------------------------------------------------------------------------- /rgb/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | 3 | LABEL authors="Ben Heasly , Marceli Wac " 4 | 5 | ### headless X server dependencies 6 | RUN apt-get update \ 7 | && apt-get install -y \ 8 | libx11-dev \ 9 | libxxf86vm-dev \ 10 | x11-xserver-utils \ 11 | x11proto-xf86vidmode-dev \ 12 | x11vnc \ 13 | xpra \ 14 | xserver-xorg-video-dummy \ 15 | && apt-get clean \ 16 | && apt-get autoclean \ 17 | && apt-get autoremove 18 | 19 | ### mitsuba dependencies 20 | RUN apt-get update \ 21 | && apt-get install -y \ 22 | build-essential \ 23 | scons \ 24 | git \ 25 | qt4-dev-tools \ 26 | libpng12-dev \ 27 | libjpeg-dev \ 28 | libilmbase-dev \ 29 | libxerces-c-dev \ 30 | libboost-all-dev \ 31 | libopenexr-dev \ 32 | libglewmx-dev \ 33 | libxxf86vm-dev \ 34 | libpcrecpp0 \ 35 | libeigen3-dev \ 36 | libfftw3-dev \ 37 | wget \ 38 | && apt-get clean \ 39 | && apt-get autoclean \ 40 | && apt-get autoremove 41 | 42 | WORKDIR /mitsuba 43 | 44 | RUN wget http://www.mitsuba-renderer.org/releases/current/trusty/collada-dom-dev_2.4.0-1_amd64.deb \ 45 | && wget http://www.mitsuba-renderer.org/releases/current/trusty/collada-dom_2.4.0-1_amd64.deb \ 46 | && dpkg --install collada-dom*.deb 47 | 48 | ### build Mitsuba 49 | RUN git clone https://www.github.com/mitsuba-renderer/mitsuba.git 50 | RUN cd mitsuba && git checkout 2f9bf64cb49c2b4c1c945e73c50c1c0da9507add && cd .. 51 | WORKDIR /mitsuba/mitsuba 52 | RUN cp build/config-linux-gcc.py config.py \ 53 | && scons 54 | 55 | ### set up Mitsuba lib and bin paths, like in Mitsuba's own setpath.sh 56 | ENV MITSUBA_DIR /mitsuba/mitsuba 57 | ENV PYTHONPATH /mitsuba/mitsuba/dist/python:/mitsuba/mitsuba/dist/python/2.7: 58 | ENV PATH /mitsuba/mitsuba/wrapper:/mitsuba/mitsuba/dist:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 59 | ENV LD_LIBRARY_PATH /mitsuba/mitsuba/dist: 60 | 61 | ### configure headless X server 62 | ### this allows the Mitsba scene importer "mtsimport" to use OpenGL for triagle computations 63 | COPY xorg.conf /etc/X11/xorg.conf 64 | ENV DISPLAY :0 65 | 66 | ### wrapper to start headless xserver when using mtsimport 67 | COPY ./mtsimport-headless.sh /mitsuba/mitsuba/wrapper/mtsimport 68 | -------------------------------------------------------------------------------- /rgb/mtsimport-headless.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # start a headless x server so that Mitsuba can triangulate with OpenGL 4 | xpra start :0 --no-pulseaudio 5 | 6 | # hack to let the x server come up 7 | sleep 1 8 | 9 | # proceed with mtsimport 10 | /mitsuba/mitsuba/dist/mtsimport "$@" 11 | 12 | -------------------------------------------------------------------------------- /rgb/xorg.conf: -------------------------------------------------------------------------------- 1 | # This xorg configuration file is meant to be used by xpra 2 | # to start a dummy X11 server. 3 | # For details, please see: 4 | # https://xpra.org/Xdummy.html 5 | 6 | Section "ServerFlags" 7 | Option "DontVTSwitch" "true" 8 | Option "AllowMouseOpenFail" "true" 9 | Option "PciForceNone" "true" 10 | Option "AutoEnableDevices" "false" 11 | Option "AutoAddDevices" "false" 12 | EndSection 13 | 14 | Section "InputDevice" 15 | Identifier "dummy_mouse" 16 | Option "CorePointer" "true" 17 | Driver "void" 18 | EndSection 19 | 20 | Section "InputDevice" 21 | Identifier "dummy_keyboard" 22 | Option "CoreKeyboard" "true" 23 | Driver "void" 24 | EndSection 25 | 26 | Section "Device" 27 | Identifier "dummy_videocard" 28 | Driver "dummy" 29 | Option "ConstantDPI" "true" 30 | #VideoRam 4096000 31 | #VideoRam 256000 32 | VideoRam 192000 33 | EndSection 34 | 35 | Section "Monitor" 36 | Identifier "dummy_monitor" 37 | HorizSync 5.0 - 1000.0 38 | VertRefresh 5.0 - 200.0 39 | #This can be used to get a specific DPI, but only for the default resolution: 40 | #DisplaySize 508 317 41 | #NOTE: the highest modes will not work without increasing the VideoRam 42 | # for the dummy video card. 43 | Modeline "32768x32768" 15226.50 32768 35800 39488 46208 32768 32771 32781 32953 44 | Modeline "32768x16384" 7516.25 32768 35544 39192 45616 16384 16387 16397 16478 45 | Modeline "16384x8192" 2101.93 16384 16416 24400 24432 8192 8390 8403 8602 46 | Modeline "8192x4096" 424.46 8192 8224 9832 9864 4096 4195 4202 4301 47 | Modeline "5496x1200" 199.13 5496 5528 6280 6312 1200 1228 1233 1261 48 | Modeline "5280x1080" 169.96 5280 5312 5952 5984 1080 1105 1110 1135 49 | Modeline "5280x1200" 191.40 5280 5312 6032 6064 1200 1228 1233 1261 50 | Modeline "5120x3200" 199.75 5120 5152 5904 5936 3200 3277 3283 3361 51 | Modeline "4800x1200" 64.42 4800 4832 5072 5104 1200 1229 1231 1261 52 | Modeline "3840x2880" 133.43 3840 3872 4376 4408 2880 2950 2955 3025 53 | Modeline "3840x2560" 116.93 3840 3872 4312 4344 2560 2622 2627 2689 54 | Modeline "3840x2048" 91.45 3840 3872 4216 4248 2048 2097 2101 2151 55 | Modeline "3840x1080" 100.38 3840 3848 4216 4592 1080 1081 1084 1093 56 | Modeline "3600x1200" 106.06 3600 3632 3984 4368 1200 1201 1204 1214 57 | Modeline "3288x1080" 39.76 3288 3320 3464 3496 1080 1106 1108 1135 58 | Modeline "2048x2048" 49.47 2048 2080 2264 2296 2048 2097 2101 2151 59 | Modeline "2048x1536" 80.06 2048 2104 2312 2576 1536 1537 1540 1554 60 | Modeline "2560x1600" 47.12 2560 2592 2768 2800 1600 1639 1642 1681 61 | Modeline "2560x1440" 42.12 2560 2592 2752 2784 1440 1475 1478 1513 62 | Modeline "1920x1440" 69.47 1920 1960 2152 2384 1440 1441 1444 1457 63 | Modeline "1920x1200" 26.28 1920 1952 2048 2080 1200 1229 1231 1261 64 | Modeline "1920x1080" 23.53 1920 1952 2040 2072 1080 1106 1108 1135 65 | Modeline "1680x1050" 20.08 1680 1712 1784 1816 1050 1075 1077 1103 66 | Modeline "1600x1200" 22.04 1600 1632 1712 1744 1200 1229 1231 1261 67 | Modeline "1600x900" 33.92 1600 1632 1760 1792 900 921 924 946 68 | Modeline "1440x900" 30.66 1440 1472 1584 1616 900 921 924 946 69 | ModeLine "1366x768" 72.00 1366 1414 1446 1494 768 771 777 803 70 | Modeline "1280x1024" 31.50 1280 1312 1424 1456 1024 1048 1052 1076 71 | Modeline "1280x800" 24.15 1280 1312 1400 1432 800 819 822 841 72 | Modeline "1280x768" 23.11 1280 1312 1392 1424 768 786 789 807 73 | Modeline "1360x768" 24.49 1360 1392 1480 1512 768 786 789 807 74 | Modeline "1024x768" 18.71 1024 1056 1120 1152 768 786 789 807 75 | Modeline "768x1024" 19.50 768 800 872 904 1024 1048 1052 1076 76 | 77 | 78 | #common resolutions for android devices (both orientations): 79 | Modeline "800x1280" 25.89 800 832 928 960 1280 1310 1315 1345 80 | Modeline "1280x800" 24.15 1280 1312 1400 1432 800 819 822 841 81 | Modeline "720x1280" 30.22 720 752 864 896 1280 1309 1315 1345 82 | Modeline "1280x720" 27.41 1280 1312 1416 1448 720 737 740 757 83 | Modeline "768x1024" 24.93 768 800 888 920 1024 1047 1052 1076 84 | Modeline "1024x768" 23.77 1024 1056 1144 1176 768 785 789 807 85 | Modeline "600x1024" 19.90 600 632 704 736 1024 1047 1052 1076 86 | Modeline "1024x600" 18.26 1024 1056 1120 1152 600 614 617 631 87 | Modeline "536x960" 16.74 536 568 624 656 960 982 986 1009 88 | Modeline "960x536" 15.23 960 992 1048 1080 536 548 551 563 89 | Modeline "600x800" 15.17 600 632 688 720 800 818 822 841 90 | Modeline "800x600" 14.50 800 832 880 912 600 614 617 631 91 | Modeline "480x854" 13.34 480 512 560 592 854 873 877 897 92 | Modeline "848x480" 12.09 848 880 920 952 480 491 493 505 93 | Modeline "480x800" 12.43 480 512 552 584 800 818 822 841 94 | Modeline "800x480" 11.46 800 832 872 904 480 491 493 505 95 | #resolutions for android devices (both orientations) 96 | #minus the status bar 97 | #38px status bar (and width rounded up) 98 | Modeline "800x1242" 25.03 800 832 920 952 1242 1271 1275 1305 99 | Modeline "1280x762" 22.93 1280 1312 1392 1424 762 780 783 801 100 | Modeline "720x1242" 29.20 720 752 856 888 1242 1271 1276 1305 101 | Modeline "1280x682" 25.85 1280 1312 1408 1440 682 698 701 717 102 | Modeline "768x986" 23.90 768 800 888 920 986 1009 1013 1036 103 | Modeline "1024x730" 22.50 1024 1056 1136 1168 730 747 750 767 104 | Modeline "600x986" 19.07 600 632 704 736 986 1009 1013 1036 105 | Modeline "1024x562" 17.03 1024 1056 1120 1152 562 575 578 591 106 | Modeline "536x922" 16.01 536 568 624 656 922 943 947 969 107 | Modeline "960x498" 14.09 960 992 1040 1072 498 509 511 523 108 | Modeline "600x762" 14.39 600 632 680 712 762 779 783 801 109 | Modeline "800x562" 13.52 800 832 880 912 562 575 578 591 110 | Modeline "480x810" 12.59 480 512 552 584 810 828 832 851 111 | Modeline "848x442" 11.09 848 880 920 952 442 452 454 465 112 | Modeline "480x762" 11.79 480 512 552 584 762 779 783 801 113 | EndSection 114 | 115 | Section "Screen" 116 | Identifier "dummy_screen" 117 | Device "dummy_videocard" 118 | Monitor "dummy_monitor" 119 | DefaultDepth 24 120 | SubSection "Display" 121 | Viewport 0 0 122 | Depth 24 123 | #Modes "32768x32768" "32768x16384" "16384x8192" "8192x4096" "5120x3200" "3840x2880" "3840x2560" "3840x2048" "2048x2048" "2560x1600" "1920x1440" "1920x1200" "1920x1080" "1600x1200" "1680x1050" "1600x900" "1400x1050" "1440x900" "1280x1024" "1366x768" "1280x800" "1024x768" "1024x600" "800x600" "320x200" 124 | Modes "5120x3200" "3840x2880" "3840x2560" "3840x2048" "2048x2048" "2560x1600" "1920x1440" "1920x1200" "1920x1080" "1600x1200" "1680x1050" "1600x900" "1400x1050" "1440x900" "1280x1024" "1366x768" "1280x800" "1024x768" "1024x600" "800x600" "320x200" 125 | #Virtual 32000 32000 126 | #Virtual 16384 8192 127 | Virtual 8192 4096 128 | #Virtual 5120 3200 129 | EndSubSection 130 | EndSection 131 | 132 | Section "ServerLayout" 133 | Identifier "dummy_layout" 134 | Screen "dummy_screen" 135 | InputDevice "dummy_mouse" 136 | InputDevice "dummy_keyboard" 137 | EndSection 138 | -------------------------------------------------------------------------------- /spectral/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ninjaben/mitsuba-rgb 2 | 3 | LABEL authors="Ben Heasly , Marceli Wac " 4 | 5 | WORKDIR /mitsuba/mitsuba 6 | 7 | ### edit mitsuba source and config for 31 spectrum bands in 395-705nm 8 | RUN sed 's/SAMPLES=[0-9]*/SAMPLES=31/' build/config-linux-gcc.py > config.py 9 | RUN sed -e 's/SPECTRUM_MIN_WAVELENGTH[ ^I]*[0-9]*$/SPECTRUM_MIN_WAVELENGTH 395/' \ 10 | -e 's/SPECTRUM_MAX_WAVELENGTH[ ^I]*[0-9]*$/SPECTRUM_MAX_WAVELENGTH 705/' \ 11 | --in-place include/mitsuba/core/spectrum.h 12 | 13 | ### replace previous rgb build with new spectral build 14 | RUN scons 15 | --------------------------------------------------------------------------------