diff --git a/.gitmodules b/.gitmodules index 1342e90..6933bf4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "3rdparty/eigen-git-mirror"] path = 3rdparty/eigen - url = https://github.com/eigenteam/eigen-git-mirror.git + url = https://gitlab.com/libeigen/eigen.git [submodule "3rdparty/Pangolin"] path = 3rdparty/Pangolin url = https://github.com/stevenlovegrove/Pangolin.git diff --git a/3rdparty/Pangolin b/3rdparty/Pangolin index ad8b5f8..73967b3 160000 --- a/3rdparty/Pangolin +++ b/3rdparty/Pangolin @@ -1 +1 @@ -Subproject commit ad8b5f83222291c51b4800d5a5873b0e90a0cf81 +Subproject commit 73967b39ad2cf84245cf877ce0879dc0909d3be4 diff --git a/3rdparty/eigen b/3rdparty/eigen index 8e47906..d71c30c 160000 --- a/3rdparty/eigen +++ b/3rdparty/eigen @@ -1 +1 @@ -Subproject commit 8e479068b48792b35e644937e747a512ed3634f7 +Subproject commit d71c30c47858effcbd39967097a2d99ee48db464 diff --git a/CMakeLists.txt b/CMakeLists.txt index b53f765..50dc6e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved -cmake_minimum_required(VERSION 2.6.0) +cmake_minimum_required(VERSION 3.22) project(Replica) @@ -14,12 +14,11 @@ if(NOT ${Eigen3_FOUND}) endif() # use system Pangolin if available -find_package(Pangolin) +find_package(Pangolin 0.9) if(NOT ${Pangolin_FOUND}) message(STATUS "Using 3rd party Pangolin") - set(Pangolin_INCLUDE_DIRS "${THIRD_PARTY}/Pangolin/build/src/include") - list(APPEND Pangolin_INCLUDE_DIRS "${THIRD_PARTY}/Pangolin/include") - set(Pangolin_LIBRARIES "${THIRD_PARTY}/Pangolin/build/src/libpangolin.so") + list(APPEND CMAKE_PREFIX_PATH "${THIRD_PARTY}/Pangolin/build") + find_package(Pangolin 0.9 REQUIRED) endif() find_package(dl REQUIRED) diff --git a/README.md b/README.md index 99d90e3..106e337 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ See the [technical report](https://arxiv.org/abs/1906.05797) for more details. The Replica SDK contained in this repository allows visual inspection of the datasets via the ReplicaViewer and gives an example of how to render out images -from the scenes headlessly via the ReplicaRenderer. +from the scenes headlessly via the ReplicaRenderer. For machine learning purposes each dataset also contains an export to the format employed by [AI Habitat](https://www.aihabitat.org/) and is therefore usable @@ -21,7 +21,7 @@ seamlessly in that framework for AI agent training and other ML tasks. If you use the Replica dataset in your research directly or indirectly via derivative datasets or frameworks, please cite the following [technical report](https://arxiv.org/abs/1906.05797): -``` +```bibtex @article{replica19arxiv, title = {The {R}eplica Dataset: A Digital Replica of Indoor Spaces}, author = {Julian Straub and Thomas Whelan and Lingni Ma and Yufan Chen and Erik Wijmans and Simon Green and Jakob J. Engel and Raul Mur-Artal and Carl Ren and Shobhit Verma and Anton Clarkson and Mingfei Yan and Brian Budge and Yajie Yan and Xiaqing Pan and June Yon and Yuyang Zou and Kimberly Leon and Nigel Carter and Jesus Briales and Tyler Gillingham and Elias Mueggler and Luis Pesqueira and Manolis Savva and Dhruv Batra and Hauke M. Strasdat and Renzo De Nardi and Michael Goesele and Steven Lovegrove and Richard Newcombe }, @@ -42,14 +42,14 @@ Each Replica contains the following assets: ``` ├── glass.sur ├── habitat - ├── mesh_semantic.ply + ├── mesh_semantic.ply ├── mesh_semantic.navmesh ├── info_semantic.json - ├── mesh_preseg_semantic.ply + ├── mesh_preseg_semantic.ply ├── mesh_preseg_semantic.navmesh ├── info_preseg_semantic.json ├── replica_stage.stage_config.json - └── sorted_faces.bin + └── sorted_faces.bin ├── mesh.ply ├── preseg.bin ├── preseg.json @@ -69,7 +69,7 @@ The different files contain the following: - `preseg.json` and `preseg.bin`: the presegmentation in terms of planes and non-planes of the scene. - `semantic.json` and `semantic.bin`: the semantic segmentation of the scene. - `textures`: the high resolution and high dynamic range textures of the scene. -- `habitat/mesh*semantic.ply`: the quad meshes including semantic or presegmentation information for AI Habitat. +- `habitat/mesh*semantic.ply`: the quad meshes including semantic or presegmentation information for AI Habitat. - `habitat/info*semantic.json`: mapping from instance IDs in the respective `mesh_*.ply` to semantic names. - `habitat/mesh*semantic.navmesh`: navigation grid for AI Habitat. - `habitat/replica_stage.stage_config.json`: configuration file defining scene level parameters for habitat-sim. @@ -77,14 +77,14 @@ The different files contain the following: ### Download on Mac OS and Linux Make sure `pigz`, `wget`, and `unzip` are installed: -``` +```bash # on Mac OS brew install wget pigz unzip # on Ubuntu sudo apt-get install wget pigz unzip ``` To download and decompress the dataset use the `download.sh` script: -``` +```bash ./download.sh /path/to/replica_v1 ``` @@ -97,7 +97,7 @@ Execute `win_download.bat` to download Replica. ### Setup After installing the dependencies of [Pangolin](https://github.com/stevenlovegrove/Pangolin), the Replica SDK can be compiled using the build script via -``` +```bash git submodule update --init ./build.sh ``` @@ -108,24 +108,24 @@ to be installed. If you wish to use the headless renderer ensure you have the li ### ReplicaViewer -ReplicaViewer is an interactive UI to explore the Replica Dataset. +ReplicaViewer is an interactive UI to explore the Replica Dataset. -``` +```bash ./build/bin/ReplicaViewer mesh.ply /path/to/atlases [mirrorFile] ``` ![ReplicaViewer](./assets/ReplicaViewer.png) The exposure value for rendering from the HDR textures can be adjusted on the -top left. +top left. ### ReplicaRenderer The ReplicaRenderer shows how to render out images from a Replica for a programmatically defined trajectory without UI. This executable can be run -headless on a server if so desired. +headless on a server if so desired. -``` +```bash ./build/bin/ReplicaRenderer mesh.ply textures glass.sur ``` @@ -133,11 +133,11 @@ headless on a server if so desired. To use Replica within AI Habitat checkout the AI Habitat Sim at [https://github.com/facebookresearch/habitat-sim](https://github.com/facebookresearch/habitat-sim). After building the project you can launch the test viewer to verify that everything works: -``` +```bash ./build/viewer --dataset /PATH/TO/REPLICA/replica.scene_dataset_config.json -- frl_apartment_0 ``` -## Team +## Team Julian Straub, Thomas Whelan, Lingni Ma, Yufan Chen, Erik Wijmans, Simon Green, Jakob J. Engel, Raul Mur-Artal, Carl Ren, Shobhit Verma, Anton Clarkson, Mingfei Yan, Brian Budge, Yajie Yan, Xiaqing Pan, June Yon, Yuyang Zou, Kimberly Leon, Nigel Carter, Jesus Briales, Tyler Gillingham Elias Mueggler, Luis Pesqueira, Manolis Savva, Dhruv Batra, Hauke M. Strasdat, Renzo De Nardi, Michael Goesele, Steven Lovegrove, and Richard Newcombe. diff --git a/ReplicaSDK/CMakeLists.txt b/ReplicaSDK/CMakeLists.txt index 3eb5162..4cf4169 100644 --- a/ReplicaSDK/CMakeLists.txt +++ b/ReplicaSDK/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved -cmake_minimum_required(VERSION 2.6.0) +cmake_minimum_required(VERSION 3.22) project(ReplicaSDK) @@ -10,7 +10,7 @@ set(PTEX_SHADER_DIR "${CMAKE_CURRENT_LIST_DIR}/shaders" CACHE PATH "Where the sh file(GLOB srcs_ptex ptex/*.cpp) file(GLOB hdrs include/*.h) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -msse2 -msse3 -Wall -std=c++11 -fopenmp -DSHADER_DIR=${PTEX_SHADER_DIR}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -msse2 -msse3 -Wall -fopenmp -DSHADER_DIR=${PTEX_SHADER_DIR}") add_library(ptex SHARED ${srcs_ptex} @@ -18,20 +18,21 @@ add_library(ptex SHARED ) target_link_libraries(ptex - ${Eigen_LIBRARIES} + Eigen3::Eigen ${Pangolin_LIBRARIES} ${dl_LIBRARIES} stdc++fs + X11 ) target_include_directories(ptex PUBLIC ${Pangolin_INCLUDE_DIRS} - ${Eigen_INCLUDE_DIRS} ${dl_INCLUDE_DIRS} ${CMAKE_CURRENT_LIST_DIR} ) +set_property(TARGET ptex PROPERTY CXX_STANDARD 17) + include_directories(${Pangolin_INCLUDE_DIRS}) -include_directories(${EIGEN3_INCLUDE_DIR}) include_directories(${dl_INCLUDE_DIRS}) include_directories("./include") @@ -56,3 +57,5 @@ target_link_libraries(ReplicaRenderer ptex stdc++fs ) + +install(TARGETS ptex ReplicaViewer ReplicaRenderer) diff --git a/ReplicaSDK/include/PTexLib.h b/ReplicaSDK/include/PTexLib.h index aa78514..8580b65 100644 --- a/ReplicaSDK/include/PTexLib.h +++ b/ReplicaSDK/include/PTexLib.h @@ -1,6 +1,6 @@ // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved #pragma once -#include +#include #include #include #include diff --git a/ReplicaSDK/ptex/EGL.cpp b/ReplicaSDK/ptex/EGL.cpp index 3d26d4c..b0215a8 100644 --- a/ReplicaSDK/ptex/EGL.cpp +++ b/ReplicaSDK/ptex/EGL.cpp @@ -130,7 +130,7 @@ EGLCtx::EGLCtx(const bool createCtx, const int cudaDevice, const bool createSurf display = eglGetPlatformDisplayEXT(EGL_PLATFORM_X11_KHR, x11, 0); } ASSERT(display != EGL_NO_DISPLAY, "Can't create EGL display"); - + EGLint major, minor; ASSERT(eglInitialize(display, &major, &minor), "Can't init EGL"); @@ -156,17 +156,19 @@ EGLCtx::EGLCtx(const bool createCtx, const int cudaDevice, const bool createSurf "Can't bind EGL context"); } +#ifdef HAVE_GLEW GLenum err = glewInit(); #ifdef GLEW_ERROR_NO_GLX_DISPLAY if (err == GLEW_ERROR_NO_GLX_DISPLAY) { std::cout << "Can't initialize EGL GLEW GLX display, may crash!" << std::endl; } - else + else #endif if (err != GLEW_OK) { ASSERT(false, "Can't initialize EGL, glewInit failing completely."); } +#endif // Setup default OpenGL parameters glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); diff --git a/ReplicaSDK/src/viewer.cpp b/ReplicaSDK/src/viewer.cpp index 50e5ce6..51f9594 100644 --- a/ReplicaSDK/src/viewer.cpp +++ b/ReplicaSDK/src/viewer.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include "GLCheck.h" #include "MirrorRenderer.h" @@ -29,9 +29,11 @@ int main(int argc, char* argv[]) { // Setup OpenGL Display (based on GLUT) pangolin::CreateWindowAndBind("ReplicaViewer", uiWidth + width, height); +#ifdef HAVE_GLEW if (glewInit() != GLEW_OK) { pango_print_error("Unable to initialize GLEW."); } +#endif if(!checkGLVersion()) { return 1; diff --git a/build.sh b/build.sh index 4f12fb1..17016f3 100755 --- a/build.sh +++ b/build.sh @@ -2,13 +2,9 @@ # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved cd 3rdparty/Pangolin -mkdir build -cd build -cmake .. -make -j +cmake -B build +cmake --build build -j -cd ../../../ -mkdir build -cd build -cmake .. -make -j +cd ../../ +cmake -B build +cmake --build build -j