diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index d2bdd56e9f5..40894774db1 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -33,9 +33,7 @@ jobs: strategy: fail-fast: false matrix: - # macos-13 is Intel runner, macos-14 is Apple Silicon - # https://github.com/actions/runner-images - os: [macos-13, macos-14] + os: [macos-14] CONFIG: [ON, OFF] env: BUILD_SHARED_LIBS: ${{ matrix.CONFIG }} @@ -133,50 +131,6 @@ jobs: path: build/bin/open3d-*-app-macosx-10_15-${{ runner.arch }}.zip if-no-files-found: error - fuse-viewer: - permissions: - contents: write # Release upload - name: Fuse x64 and ARM64 viewer app - runs-on: [macos-13] - needs: [MacOS] - steps: - - name: Checkout source code # for gh release upload - uses: actions/checkout@v4 - - name: Download viewer apps - uses: actions/download-artifact@v4 - with: - pattern: open3d-app-macosx-10_15-* - merge-multiple: true - - - name: Fuse x64 and arm64 viewer apps - run: | - unzip open3d-*-app-macosx-10_15-X64.zip -d x64 - unzip open3d-*-app-macosx-10_15-ARM64.zip -d arm64 - APP_NAME=$(ls open3d-*-app-macosx-10_15-X64.zip) - APP_NAME=${APP_NAME/-X64/-universal2} # includes version - for i in arm64/Open3D.app/Contents/MacOS/*; do - filepath=Open3D.app/Contents/MacOS/$(basename $i) - lipo -create arm64/${filepath} x64/${filepath} -output arm64/${filepath} - done - mv arm64/Open3D.app Open3D.app - zip -rv "${APP_NAME}" Open3D.app - - - name: Upload Open3D viewer app - uses: actions/upload-artifact@v4 - with: - name: open3d-app-macosx-10_15-universal2 - path: open3d-*-app-macosx-10_15-universal2.zip - if-no-files-found: error - - - name: Update viewer devel release - if: ${{ github.ref == 'refs/heads/main' }} - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release upload main-devel open3d-*-app-macosx-10_15-universal2.zip --clobber - gh release view main-devel - - build-wheel: name: Build wheel permissions: @@ -186,9 +140,7 @@ jobs: fail-fast: false # https://github.community/t/how-to-conditionally-include-exclude-items-in-matrix-eg-based-on-branch/16853/6 matrix: - # macos-13 is Intel runner, macos-14 is Apple Silicon - # https://github.com/actions/runner-images - os: [macos-13, macos-14] + os: [macos-14] python_version: ['3.10', '3.11', '3.12', '3.13'] is_main: - ${{ github.ref == 'refs/heads/main' }} @@ -283,75 +235,6 @@ jobs: path: build/lib/python_package/pip_package/${{ env.PIP_PKG_NAME }} if-no-files-found: error - - fuse-wheel: - name: Fuse universal2 wheel - permissions: - contents: write # Release upload - runs-on: [macos-13] - needs: [build-wheel] - strategy: - fail-fast: false - # https://github.community/t/how-to-conditionally-include-exclude-items-in-matrix-eg-based-on-branch/16853/6 - matrix: - python_version: ['3.10', '3.11', '3.12', '3.13'] - is_main: - - ${{ github.ref == 'refs/heads/main' }} - exclude: - - is_main: false - python_version: '3.10' - - is_main: false - python_version: '3.11' - - is_main: false - python_version: '3.12' - steps: - - name: Checkout source code # for gh release upload - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python_version }} - - - name: Download X64 wheels - uses: actions/download-artifact@v4 - with: - pattern: open3d-*macosx*_x86_64.whl - path: x64_wheels - merge-multiple: true - - - name: Download ARM64 wheels - uses: actions/download-artifact@v4 - with: - pattern: open3d-*macosx*_arm64.whl - path: arm64_wheels - merge-multiple: true - - - name: Fuse x64 and ARM64 wheels - env: - python_version: ${{ matrix.python_version }} - run: | - PYTAG="-cp$(echo ${{ env.python_version }} | tr -d '.')" - mkdir universal_wheels - pip install delocate - delocate-merge -v -w universal_wheels x64_wheels/open3d-*${PYTAG}*.whl arm64_wheels/open3d-*${PYTAG}*.whl - NEW_WHL_NAME=$(basename universal_wheels/open3d-*${PYTAG}*.whl) - echo "PIP_PKG_NAME=$NEW_WHL_NAME" >> $GITHUB_ENV - - - name: Upload merged wheels - uses: actions/upload-artifact@v4 - with: - name: ${{ env.PIP_PKG_NAME }} - path: universal_wheels/${{ env.PIP_PKG_NAME }} - if-no-files-found: error - - - name: Update devel release - if: ${{ github.ref == 'refs/heads/main' }} - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release upload main-devel universal_wheels/${{ env.PIP_PKG_NAME }} --clobber - gh release view main-devel - test-wheel: name: Test wheel permissions: @@ -361,7 +244,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-13, macos-14] + os: [macos-14] python_version: ['3.10', '3.11', '3.12', '3.13'] is_main: - ${{ github.ref == 'refs/heads/main' }} diff --git a/.github/workflows/ubuntu-sycl.yml b/.github/workflows/ubuntu-sycl.yml index fe4132abffc..f4ce0af8aa4 100644 --- a/.github/workflows/ubuntu-sycl.yml +++ b/.github/workflows/ubuntu-sycl.yml @@ -69,7 +69,7 @@ jobs: GH_TOKEN: ${{ github.token }} run: | if [ ${{ matrix.BUILD_SHARED_LIBS }} == 'ON' ] ; then - gh release upload main-devel open3d-*.whl --clobber + gh release upload main-devel open3d*.whl --clobber gh release upload main-devel open3d-devel-*.tar.xz --clobber fi gh release view main-devel diff --git a/.github/workflows/ubuntu-wheel.yml b/.github/workflows/ubuntu-wheel.yml index 73ce681fd18..c333f565605 100644 --- a/.github/workflows/ubuntu-wheel.yml +++ b/.github/workflows/ubuntu-wheel.yml @@ -46,7 +46,7 @@ jobs: env: DEVELOPER_BUILD: ${{ github.event.inputs.developer_build || 'ON' }} PYTHON_VERSION: ${{ matrix.python_version }} - CCACHE_TAR_NAME: open3d-ubuntu-2004-cuda-ci-ccache + CCACHE_TAR_NAME: open3d-ubuntu-2204-cuda-ci-ccache OPEN3D_CPU_RENDERING: true steps: - name: Checkout source code @@ -90,6 +90,14 @@ jobs: ${{ env.PIP_PKG_NAME }} ${{ env.PIP_CPU_PKG_NAME }} if-no-files-found: error + - name: Update devel release + if: ${{ github.ref == 'refs/heads/main' }} + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release upload main-devel ${GITHUB_WORKSPACE}/${{ env.PIP_PKG_NAME }} \ + ${GITHUB_WORKSPACE}/${{ env.PIP_CPU_PKG_NAME }} --clobber + gh release view main-devel - name: GCloud CLI auth if: ${{ github.ref == 'refs/heads/main' }} uses: 'google-github-actions/auth@v2' @@ -106,14 +114,6 @@ jobs: if: ${{ github.ref == 'refs/heads/main' }} run: | gsutil cp ${GITHUB_WORKSPACE}/${{ env.CCACHE_TAR_NAME }}.tar.xz gs://open3d-ci-cache/ - - name: Update devel release - if: ${{ github.ref == 'refs/heads/main' }} - env: - GH_TOKEN: ${{ github.token }} - run: | - gh release upload main-devel ${GITHUB_WORKSPACE}/${{ env.PIP_PKG_NAME }} \ - ${GITHUB_WORKSPACE}/${{ env.PIP_CPU_PKG_NAME }} --clobber - gh release view main-devel test-wheel-cpu: name: Test wheel CPU diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 765abfd21b8..b68e8814dc2 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -98,7 +98,7 @@ jobs: - name: Set up Python version uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.12' - name: Checkout Open3D-ML uses: actions/checkout@v4 @@ -111,7 +111,7 @@ jobs: run: | if ( '${{ matrix.BUILD_CUDA_MODULE }}' -eq 'ON' ) { # python -m pip install -r open3d_ml/requirements-torch-cuda.txt - python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cu124 + python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cu126 } else { python -m pip install -r open3d_ml/requirements-torch.txt } diff --git a/3rdparty/filament/filament_build.cmake b/3rdparty/filament/filament_build.cmake index 432f55a28c0..7c0e4d7a06c 100644 --- a/3rdparty/filament/filament_build.cmake +++ b/3rdparty/filament/filament_build.cmake @@ -13,20 +13,21 @@ if(NOT is_multi_config) endif() set(filament_LIBRARIES - filameshio - filament - filamat_lite - filamat - filaflat - filabridge - geometry - backend - bluegl - ibl - image - meshoptimizer - smol-v - utils + filameshio + filament + filaflat + filabridge + geometry + backend + bluegl + bluevk + ibl + image + ktxreader + meshoptimizer + smol-v + utils + vkshaders ) # Locate byproducts @@ -43,7 +44,7 @@ set(lib_byproducts ${filament_LIBRARIES}) list(TRANSFORM lib_byproducts PREPEND ${FILAMENT_ROOT}/${lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}) list(TRANSFORM lib_byproducts APPEND ${CMAKE_STATIC_LIBRARY_SUFFIX}) -set(filament_cxx_flags "${CMAKE_CXX_FLAGS} -Wno-deprecated") +set(filament_cxx_flags "${CMAKE_CXX_FLAGS} -Wno-deprecated" "-Wno-pass-failed=transform-warning" "-Wno-error=nonnull") if(NOT WIN32) # Issue Open3D#1909, filament#2146 set(filament_cxx_flags "${filament_cxx_flags} -fno-builtin") @@ -52,8 +53,8 @@ endif() ExternalProject_Add( ext_filament PREFIX filament - URL https://github.com/isl-org/filament/archive/d1d873d27f43ba0cee1674a555cc0f18daac3008.tar.gz - URL_HASH SHA256=00c3f41af0fcfb2df904e1f77934f2678d943ddac5eb889788a5e22590e497bd + URL https://github.com/google/filament/archive/refs/tags/v1.54.0.tar.gz + URL_HASH SHA256=f4cb4eb81e3a5d66a9612ac131d16183e118b694f4f34c051506c523a8389e8d DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/filament" UPDATE_COMMAND "" CMAKE_ARGS @@ -69,9 +70,9 @@ ExternalProject_Add( -DCMAKE_INSTALL_PREFIX=${FILAMENT_ROOT} -DUSE_STATIC_CRT=${STATIC_WINDOWS_RUNTIME} -DUSE_STATIC_LIBCXX=ON - -DFILAMENT_SUPPORTS_VULKAN=OFF + -DFILAMENT_SKIP_SDL2=ON -DFILAMENT_SKIP_SAMPLES=ON -DFILAMENT_OPENGL_HANDLE_ARENA_SIZE_IN_MB=20 # to support many small entities -DSPIRV_WERROR=OFF - BUILD_BYPRODUCTS ${lib_byproducts} -) + BUILD_BYPRODUCTS ${lib_byproducts} +) \ No newline at end of file diff --git a/3rdparty/filament/filament_download.cmake b/3rdparty/filament/filament_download.cmake index f21cc91c31b..5cac69ab9bb 100644 --- a/3rdparty/filament/filament_download.cmake +++ b/3rdparty/filament/filament_download.cmake @@ -1,6 +1,6 @@ include(FetchContent) -set(filament_LIBRARIES filameshio filament filamat_lite filaflat filabridge geometry backend bluegl bluevk ibl image meshoptimizer smol-v utils vkshaders) +set(filament_LIBRARIES filameshio filament filaflat filabridge geometry backend bluegl bluevk ibl image ktxreader meshoptimizer smol-v utils vkshaders) if (FILAMENT_PRECOMPILED_ROOT) if (EXISTS "${FILAMENT_PRECOMPILED_ROOT}") @@ -13,51 +13,38 @@ else() set(lib_dir lib) # Setup download links if(WIN32) - set(FILAMENT_URL https://github.com/google/filament/releases/download/v1.9.9/filament-v1.9.9-windows.tgz) - set(FILAMENT_SHA256 3a937a54a0c6b693c833737878761f8ba8ee02744be3c2f9ec33b1c6399ba31b) - # Required for filament v1.9.9 - # Older versions of filament do not contain vkshaders. - # They also have a different directory structure. - # Remove vkshaders here so we can use newer versions with FILAMENT_PRECOMPILED_ROOT. - list(REMOVE_ITEM filament_LIBRARIES vkshaders) + set(FILAMENT_URL https://github.com/google/filament/releases/download/v1.54.0/filament-v1.54.0-windows.tgz) + set(FILAMENT_SHA256 370b85dbaf1a3be26a5a80f60c912f11887748ddd1c42796a83fe989f5805f7b) if (STATIC_WINDOWS_RUNTIME) string(APPEND lib_dir /x86_64/mt) else() string(APPEND lib_dir /x86_64/md) endif() elseif(APPLE) - if (APPLE_AARCH64) - set(FILAMENT_URL https://github.com/isl-org/open3d_downloads/releases/download/filament/filament-v1.9.19-macos_arm64.tgz) - set(FILAMENT_SHA256 3422bdff451d90144fbb69e625d8dcaeaf3222dc2c28879536067937955bc362) - string(APPEND lib_dir /arm64) - # Our arm64 builds use FILAMENT_SUPPORTS_VULKAN=OFF - list(REMOVE_ITEM filament_LIBRARIES bluevk) - else() - set(FILAMENT_URL https://github.com/google/filament/releases/download/v1.9.19/filament-v1.9.19-mac.tgz) - set(FILAMENT_SHA256 2765d0ce60647fc17d1880c4618cf7d6b5343d8be4dad87978c3917d9c723b4e) - string(APPEND lib_dir /x86_64) - endif() + set(FILAMENT_URL https://github.com/google/filament/releases/download/v1.54.0/filament-v1.54.0-mac.tgz) + set(FILAMENT_SHA256 9b71642bd697075110579ccb55a2e8f319b05bbd89613c72567745534936186e) else() # Linux: Check glibc version and use open3d filament binary if new (Ubuntu 20.04 and similar) execute_process(COMMAND ldd --version OUTPUT_VARIABLE ldd_version) string(REGEX MATCH "([0-9]+\.)+[0-9]+" glibc_version ${ldd_version}) - if(${glibc_version} VERSION_LESS "2.31") + if(${glibc_version} VERSION_LESS "2.33") set(FILAMENT_URL - https://github.com/isl-org/open3d_downloads/releases/download/filament/filament-v1.9.19-linux.tgz) - set(FILAMENT_SHA256 f0c0b05a543dd0c82b1cd571957a90f28e72cfeee36d19a527c17ac9de4733d5) + https://github.com/isl-org/open3d_downloads/releases/download/filament/filament-v1.49.1-ubuntu20.04.tgz) + set(FILAMENT_SHA256 f4ba020f0ca63540e2f86b36d1728a1ea063ddd5eb55b0ba6fc621ee815a60a7) message(STATUS "GLIBC version ${glibc_version} found: Using " - "Google Filament binary.") + "Open3D built Filament binary for Ubuntu 20.04.") else() set(FILAMENT_URL - https://github.com/isl-org/open3d_downloads/releases/download/filament/filament-v1.9.19-linux-20.04.tgz) - set(FILAMENT_SHA256 c756fd76f5c6a40ca554f8c3cca424354a2a22ea6fce3c8ea893d4c4aa39514c) + https://github.com/google/filament/releases/download/v1.54.0/filament-v1.54.0-linux.tgz) + set(FILAMENT_SHA256 f07fbe8fcb6422a682f429d95fa2e097c538d0d900c62f0a835f595ab3909e8e) message(STATUS "GLIBC version ${glibc_version} found: Using " - "Open3D Filament binary.") + "Google Filament binary.") endif() endif() set(lib_byproducts ${filament_LIBRARIES}) list(TRANSFORM lib_byproducts PREPEND /${lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}) list(TRANSFORM lib_byproducts APPEND ${CMAKE_STATIC_LIBRARY_SUFFIX}) + message(STATUS "Filament byproducts: ${lib_byproducts}") if(WIN32) set(lib_byproducts_debug ${filament_LIBRARIES}) @@ -68,20 +55,21 @@ else() # ExternalProject_Add happens at build time. ExternalProject_Add( - ext_filament - PREFIX filament - URL ${FILAMENT_URL} - URL_HASH SHA256=${FILAMENT_SHA256} - DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/filament" - UPDATE_COMMAND "" - CONFIGURE_COMMAND "" - BUILD_IN_SOURCE ON - BUILD_COMMAND "" - INSTALL_COMMAND "" - BUILD_BYPRODUCTS ${lib_byproducts} + ext_filament + PREFIX filament + URL ${FILAMENT_URL} + URL_HASH SHA256=${FILAMENT_SHA256} + DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/filament" + UPDATE_COMMAND "" + CONFIGURE_COMMAND "" + BUILD_IN_SOURCE ON + BUILD_COMMAND "" + INSTALL_COMMAND "" + BUILD_BYPRODUCTS ${lib_byproducts} ) ExternalProject_Get_Property(ext_filament SOURCE_DIR) + message(STATUS "Filament source dir is ${SOURCE_DIR}") set(FILAMENT_ROOT ${SOURCE_DIR}) endif() -message(STATUS "Filament is located at ${FILAMENT_ROOT}") +message(STATUS "Filament is located at ${FILAMENT_ROOT}") \ No newline at end of file diff --git a/3rdparty/find_dependencies.cmake b/3rdparty/find_dependencies.cmake index b95b97bd1ab..241f2771e64 100644 --- a/3rdparty/find_dependencies.cmake +++ b/3rdparty/find_dependencies.cmake @@ -1315,22 +1315,25 @@ if(BUILD_GUI) else() message(STATUS "Using prebuilt third-party library Filament") include(${Open3D_3RDPARTY_DIR}/filament/filament_download.cmake) - # Set lib directory for filament v1.9.9 on Windows. - # Assume newer version if FILAMENT_PRECOMPILED_ROOT is set. - if (WIN32 AND NOT FILAMENT_PRECOMPILED_ROOT) - if (STATIC_WINDOWS_RUNTIME) - set(FILAMENT_RUNTIME_VER "x86_64/mt$<$:d>") - else() - set(FILAMENT_RUNTIME_VER "x86_64/md$<$:d>") - endif() - endif() endif() - if (APPLE) + if (UNIX AND NOT APPLE) + if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)$") + set(FILAMENT_RUNTIME_VER aarch64) + else() + set(FILAMENT_RUNTIME_VER x86_64) + endif() + elseif (APPLE) if (APPLE_AARCH64) set(FILAMENT_RUNTIME_VER arm64) else() set(FILAMENT_RUNTIME_VER x86_64) endif() + else() # WIN32 + if (STATIC_WINDOWS_RUNTIME) + set(FILAMENT_RUNTIME_VER "x86_64/mt$<$:d>") + else() + set(FILAMENT_RUNTIME_VER "x86_64/md$<$:d>") + endif() endif() open3d_import_3rdparty_library(3rdparty_filament HEADER diff --git a/3rdparty/openblas/openblas.cmake b/3rdparty/openblas/openblas.cmake index 1c97dbd8429..87220ba5086 100644 --- a/3rdparty/openblas/openblas.cmake +++ b/3rdparty/openblas/openblas.cmake @@ -9,8 +9,8 @@ endif() ExternalProject_Add( ext_openblas PREFIX openblas - URL https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.29/OpenBLAS-0.3.29.tar.gz - URL_HASH SHA256=38240eee1b29e2bde47ebb5d61160207dc68668a54cac62c076bb5032013b1eb + URL https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.30/OpenBLAS-0.3.30.tar.gz + URL_HASH SHA256=27342cff518646afb4c2b976d809102e368957974c250a25ccc965e53063c95d DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/openblas" CMAKE_ARGS ${ExternalProject_CMAKE_ARGS} diff --git a/3rdparty/webrtc/Dockerfile.webrtc b/3rdparty/webrtc/Dockerfile.webrtc index b935d0e8ef7..8c127c97b6d 100644 --- a/3rdparty/webrtc/Dockerfile.webrtc +++ b/3rdparty/webrtc/Dockerfile.webrtc @@ -13,7 +13,7 @@ # - docker run --rm --entrypoint cat open3d-webrtc:abi1 \ # webrtc_60e6748_cxx-abi-1.tar.gz > webrtc_60e6748_cxx-abi-1.tar.gz -FROM ubuntu:20.04 +FROM ubuntu:22.04 ARG SUDO=command COPY 3rdparty/webrtc 3rdparty/webrtc diff --git a/CHANGELOG.md b/CHANGELOG.md index ff978597cd5..2d11a94b796 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,7 +63,7 @@ - Exposed `get_plotly_fig` and modified `draw_plotly` to return the `Figure` it creates. (PR #7258) - Fix build with librealsense v2.44.0 and upcoming VS 2022 17.13 (PR #7074) - Fix `deprecated-declarations` warnings when compiling code with C++20 standard (PR #7303) - +- macOS x86_64 not longer supported, only macOS arm64 is supported. ## 0.13 - CUDA support 10.1 -> 11.0. Tensorflow 2.3.1 -> 2.4.1. PyTorch 1.6.0 -> 1.7.1 (PR #3049). This requires a custom PyTorch wheel from due to PyTorch issue #52663 diff --git a/CMakeLists.txt b/CMakeLists.txt index 4133c356742..5d4a9c42130 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -591,4 +591,4 @@ add_custom_target(apply-cpp-style ) include(Open3DPrintConfigurationSummary) -open3d_print_configuration_summary() +open3d_print_configuration_summary() \ No newline at end of file diff --git a/cmake/Open3DAddCompiledMaterials.cmake b/cmake/Open3DAddCompiledMaterials.cmake index 171e57e6376..edb92c3e8a1 100644 --- a/cmake/Open3DAddCompiledMaterials.cmake +++ b/cmake/Open3DAddCompiledMaterials.cmake @@ -35,7 +35,7 @@ function(open3d_add_compiled_materials target) if (IOS OR ANDROID) set(FILAMENT_MATC_ARGS "--platform=mobile") else() - set(FILAMENT_MATC_ARGS "--platform=desktop") + set(FILAMENT_MATC_ARGS "--api=all") endif() get_filename_component(OUTPUT_DIRECTORY_FULL_PATH "${ARG_OUTPUT_DIRECTORY}" ABSOLUTE) diff --git a/cpp/open3d/geometry/TriangleMesh.cpp b/cpp/open3d/geometry/TriangleMesh.cpp index bb5f9571e09..c5f122a376b 100644 --- a/cpp/open3d/geometry/TriangleMesh.cpp +++ b/cpp/open3d/geometry/TriangleMesh.cpp @@ -293,6 +293,16 @@ std::shared_ptr TriangleMesh::FilterSmoothSimple( std::swap(mesh->vertex_colors_, prev_vertex_colors); } } + if (filter_vertex) { + const double epsilon = 1e-15; + for (auto &vertex : mesh->vertices_) { + for (int i = 0; i < 3; ++i) { + if (std::abs(vertex(i)) < epsilon) { + vertex(i) = 0.0; + } + } + } + } return mesh; } @@ -386,6 +396,16 @@ std::shared_ptr TriangleMesh::FilterSmoothLaplacian( std::swap(mesh->vertex_colors_, prev_vertex_colors); } } + if (filter_vertex) { + const double epsilon = 1e-15; + for (auto &vertex : mesh->vertices_) { + for (int i = 0; i < 3; ++i) { + if (std::abs(vertex(i)) < epsilon) { + vertex(i) = 0.0; + } + } + } + } return mesh; } @@ -434,6 +454,16 @@ std::shared_ptr TriangleMesh::FilterSmoothTaubin( std::swap(mesh->vertex_colors_, prev_vertex_colors); } } + if (filter_vertex) { + const double epsilon = 1e-15; + for (auto &vertex : mesh->vertices_) { + for (int i = 0; i < 3; ++i) { + if (std::abs(vertex(i)) < epsilon) { + vertex(i) = 0.0; + } + } + } + } return mesh; } diff --git a/cpp/open3d/visualization/CMakeLists.txt b/cpp/open3d/visualization/CMakeLists.txt index 833ca2ae40f..b73941f0176 100644 --- a/cpp/open3d/visualization/CMakeLists.txt +++ b/cpp/open3d/visualization/CMakeLists.txt @@ -2,6 +2,8 @@ open3d_ispc_add_library(visualization OBJECT) open3d_ispc_add_library(visualization_impl OBJECT) set_target_properties(visualization_impl PROPERTIES CXX_VISIBILITY_PRESET hidden) +# filament uses C++20 designated initializers +set_property(TARGET visualization_impl visualization PROPERTY CXX_STANDARD 20) target_sources(visualization_impl PRIVATE shader/GeometryRenderer.cpp diff --git a/cpp/open3d/visualization/gui/Application.cpp b/cpp/open3d/visualization/gui/Application.cpp index 85b260a0182..8f2630b9973 100644 --- a/cpp/open3d/visualization/gui/Application.cpp +++ b/cpp/open3d/visualization/gui/Application.cpp @@ -148,9 +148,9 @@ struct Application::Impl { InitWindowSystem(); // Initialize rendering - visualization::rendering::EngineInstance::SelectBackend( - visualization::rendering::EngineInstance::RenderingType:: - kOpenGL); + // NOTE: This is where we used to manually select a backend for Filament + // but we feel comfortable now allowing Filament to select the best + // backend for the platform so there's no code here anymore } void CleanupAfterRunning() { diff --git a/cpp/open3d/visualization/gui/BitmapWindowSystem.cpp b/cpp/open3d/visualization/gui/BitmapWindowSystem.cpp index f40e5545556..3db9d0cefef 100644 --- a/cpp/open3d/visualization/gui/BitmapWindowSystem.cpp +++ b/cpp/open3d/visualization/gui/BitmapWindowSystem.cpp @@ -129,16 +129,7 @@ struct BitmapWindowSystem::Impl { }; BitmapWindowSystem::BitmapWindowSystem(Rendering mode /*= Rendering::NORMAL*/) - : impl_(new BitmapWindowSystem::Impl()) { - if (mode == Rendering::HEADLESS) { -#if !defined(__APPLE__) && !defined(_WIN32) && !defined(_WIN64) - rendering::EngineInstance::EnableHeadless(); -#else - utility::LogWarning( - "BitmapWindowSystem(): HEADLESS is only supported on Linux."); -#endif - } -} + : impl_(new BitmapWindowSystem::Impl()) {} BitmapWindowSystem::~BitmapWindowSystem() {} diff --git a/cpp/open3d/visualization/gui/BitmapWindowSystem.h b/cpp/open3d/visualization/gui/BitmapWindowSystem.h index a0558c6898b..c058b5b42fe 100644 --- a/cpp/open3d/visualization/gui/BitmapWindowSystem.h +++ b/cpp/open3d/visualization/gui/BitmapWindowSystem.h @@ -27,6 +27,7 @@ struct TextInputEvent; class BitmapWindowSystem : public WindowSystem { public: + // Not needed anymore - may be removed enum class Rendering { NORMAL, // normal OpenGL rendering, requires X11, Win32, or Cocoa HEADLESS // uses EGL, does not require the OS to have a window system. diff --git a/cpp/open3d/visualization/gui/CMakeLists.txt b/cpp/open3d/visualization/gui/CMakeLists.txt index 822de19a93b..adc53bd65f8 100644 --- a/cpp/open3d/visualization/gui/CMakeLists.txt +++ b/cpp/open3d/visualization/gui/CMakeLists.txt @@ -59,6 +59,9 @@ else() NativeLinux.cpp ) endif() +# filament uses C++20 designated initializers +set_property(TARGET GUI PROPERTY CXX_STANDARD 20) + open3d_show_and_abort_on_warning(GUI) open3d_set_global_properties(GUI) diff --git a/cpp/open3d/visualization/gui/GLFWWindowSystem.cpp b/cpp/open3d/visualization/gui/GLFWWindowSystem.cpp index 852f6e3db24..c4dc52163a8 100644 --- a/cpp/open3d/visualization/gui/GLFWWindowSystem.cpp +++ b/cpp/open3d/visualization/gui/GLFWWindowSystem.cpp @@ -150,16 +150,18 @@ GLFWWindowSystem::OSWindow GLFWWindowSystem::CreateOSWindow(Window* o3d_window, int height, const char* title, int flags) { - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); - glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); - glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); - // NOTE: Setting alpha and stencil bits to match GLX standard default - // values. GLFW sets these internally to 8 and 8 respectively if not - // specified which causes problems with Filament on Linux with Nvidia binary - // driver - glfwWindowHint(GLFW_ALPHA_BITS, 0); - glfwWindowHint(GLFW_STENCIL_BITS, 0); + glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); + // glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); + // glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); + // glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); + // glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + // // NOTE: Setting alpha and stencil bits to match GLX standard default + // // values. GLFW sets these internally to 8 and 8 respectively if not + // // specified which causes problems with Filament on Linux with Nvidia + // binary + // // driver + // glfwWindowHint(GLFW_ALPHA_BITS, 0); + // glfwWindowHint(GLFW_STENCIL_BITS, 0); #if __APPLE__ glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_TRUE); diff --git a/cpp/open3d/visualization/gui/ImguiFilamentBridge.cpp b/cpp/open3d/visualization/gui/ImguiFilamentBridge.cpp index 73d773b2cb7..f7c7ade055c 100644 --- a/cpp/open3d/visualization/gui/ImguiFilamentBridge.cpp +++ b/cpp/open3d/visualization/gui/ImguiFilamentBridge.cpp @@ -22,6 +22,11 @@ * limitations under the License. */ +// clang-format off +// NOTE: this must precede header files that bring in Filament headers +#include +// clang-format on + #include "open3d/visualization/gui/ImguiFilamentBridge.h" // 4068: Filament has some clang-specific vectorizing pragma's that MSVC flags @@ -38,6 +43,11 @@ #include #include +#include +#include +#include +#include + #ifdef _MSC_VER #pragma warning(pop) #endif // _MSC_VER @@ -45,11 +55,6 @@ #include #include -#include -#include -#include -#include - #include "open3d/utility/FileSystem.h" #include "open3d/visualization/gui/Application.h" #include "open3d/visualization/gui/Color.h" diff --git a/cpp/open3d/visualization/gui/Materials/img_blit.mat b/cpp/open3d/visualization/gui/Materials/img_blit.mat index d112a184bde..341a5398554 100644 --- a/cpp/open3d/visualization/gui/Materials/img_blit.mat +++ b/cpp/open3d/visualization/gui/Materials/img_blit.mat @@ -20,7 +20,6 @@ fragment { void material(inout MaterialInputs material) { prepareMaterial(material); vec2 uv = getUV0(); - uv.y = 1.0 - uv.y; /* OpenGL spec 8.4.4.4 says that texture().a is 1.0 if there is no alpha channel, so this shader can handle both RGB and RGBA images */ diff --git a/cpp/open3d/visualization/gui/SceneWidget.cpp b/cpp/open3d/visualization/gui/SceneWidget.cpp index d0df7af860e..3f116de3c70 100644 --- a/cpp/open3d/visualization/gui/SceneWidget.cpp +++ b/cpp/open3d/visualization/gui/SceneWidget.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include diff --git a/cpp/open3d/visualization/rendering/RendererHandle.h b/cpp/open3d/visualization/rendering/RendererHandle.h index 8f328accb51..df25467c53b 100644 --- a/cpp/open3d/visualization/rendering/RendererHandle.h +++ b/cpp/open3d/visualization/rendering/RendererHandle.h @@ -165,10 +165,10 @@ struct formatter< template auto format(const open3d::visualization::rendering::REHandle_abstract& uid, FormatContext& ctx) const -> decltype(ctx.out()) { - return format_to(ctx.out(), "[{}, {}, hash: {}]", - open3d::visualization::rendering::REHandle_abstract:: - TypeToString(uid.type), - uid.GetId(), uid.Hash()); + return fmt::format_to(ctx.out(), "[{}, {}, hash: {}]", + open3d::visualization::rendering:: + REHandle_abstract::TypeToString(uid.type), + uid.GetId(), uid.Hash()); } template diff --git a/cpp/open3d/visualization/rendering/filament/FilamentCamera.cpp b/cpp/open3d/visualization/rendering/filament/FilamentCamera.cpp index e7a1580c4e9..9fd3cd82e92 100644 --- a/cpp/open3d/visualization/rendering/filament/FilamentCamera.cpp +++ b/cpp/open3d/visualization/rendering/filament/FilamentCamera.cpp @@ -40,15 +40,17 @@ Camera::Transform FilamentToCameraTransform(const filament::math::mat4& ft) { return Camera::Transform(m); } -Camera::Transform FilamentToCameraTransform(const filament::math::mat4f& ft) { - Camera::Transform::MatrixType m; - - m << ft(0, 0), ft(0, 1), ft(0, 2), ft(0, 3), ft(1, 0), ft(1, 1), ft(1, 2), - ft(1, 3), ft(2, 0), ft(2, 1), ft(2, 2), ft(2, 3), ft(3, 0), - ft(3, 1), ft(3, 2), ft(3, 3); - - return Camera::Transform(m); -} +// Camera::Transform FilamentToCameraTransform(const filament::math::mat4f& ft) +// { +// Camera::Transform::MatrixType m; +// +// m << ft(0, 0), ft(0, 1), ft(0, 2), ft(0, 3), ft(1, 0), ft(1, 1), ft(1, +// 2), +// ft(1, 3), ft(2, 0), ft(2, 1), ft(2, 2), ft(2, 3), ft(3, 0), +// ft(3, 1), ft(3, 2), ft(3, 3); +// +// return Camera::Transform(m); +// } filament::math::mat4f CameraToFilamentTransformF(const Camera::Transform& t) { auto e_matrix = t.matrix(); @@ -240,7 +242,8 @@ void FilamentCamera::LookAt(const Eigen::Vector3f& center, Eigen::Vector3f FilamentCamera::GetPosition() const { auto cam_pos = camera_->getPosition(); - return {cam_pos.x, cam_pos.y, cam_pos.z}; + return {static_cast(cam_pos.x), static_cast(cam_pos.y), + static_cast(cam_pos.z)}; } Eigen::Vector3f FilamentCamera::GetForwardVector() const { @@ -314,7 +317,7 @@ void FilamentCamera::SetModelMatrix(const Eigen::Vector3f& forward, const Eigen::Vector3f& up) { using namespace filament; - math::mat4f ftransform = camera_->getModelMatrix(); + math::mat4 ftransform = camera_->getModelMatrix(); ftransform[0].xyz = math::float3(left.x(), left.y(), left.z()); ftransform[1].xyz = math::float3(up.x(), up.y(), up.z()); ftransform[2].xyz = math::float3(forward.x(), forward.y(), forward.z()); diff --git a/cpp/open3d/visualization/rendering/filament/FilamentEngine.cpp b/cpp/open3d/visualization/rendering/filament/FilamentEngine.cpp index f90b00d5a03..85ffba2c555 100644 --- a/cpp/open3d/visualization/rendering/filament/FilamentEngine.cpp +++ b/cpp/open3d/visualization/rendering/filament/FilamentEngine.cpp @@ -33,13 +33,10 @@ static std::shared_ptr g_instance = nullptr; } // namespace EngineInstance::RenderingType EngineInstance::type_ = RenderingType::kDefault; -bool EngineInstance::is_headless_ = false; std::string EngineInstance::resource_path_ = ""; void EngineInstance::SelectBackend(RenderingType type) { type_ = type; } -void EngineInstance::EnableHeadless() { is_headless_ = true; } - void EngineInstance::SetResourcePath(const std::string& resource_path) { resource_path_ = resource_path; if (!utility::filesystem::DirectoryExists(resource_path_)) { @@ -74,10 +71,6 @@ EngineInstance& EngineInstance::Get() { void EngineInstance::DestroyInstance() { g_instance.reset(); } -/// external function defined in custom Filament EGL backend for headless -/// rendering -extern "C" filament::backend::Platform* CreateEGLHeadlessPlatform(); - EngineInstance::EngineInstance() { filament::backend::Backend backend = filament::backend::Backend::DEFAULT; switch (type_) { @@ -95,17 +88,7 @@ EngineInstance::EngineInstance() { break; } - filament::backend::Platform* custom_platform = nullptr; - if (is_headless_) { -#ifdef __linux__ - utility::LogInfo("EGL headless mode enabled."); - custom_platform = CreateEGLHeadlessPlatform(); -#else - utility::LogError("EGL Headless is not supported on this platform."); -#endif - } - - engine_ = filament::Engine::create(backend, custom_platform); + engine_ = filament::Engine::create(backend); resource_manager_ = new FilamentResourceManager(*engine_); } diff --git a/cpp/open3d/visualization/rendering/filament/FilamentEngine.h b/cpp/open3d/visualization/rendering/filament/FilamentEngine.h index f270279ff97..7b4e6c64963 100644 --- a/cpp/open3d/visualization/rendering/filament/FilamentEngine.h +++ b/cpp/open3d/visualization/rendering/filament/FilamentEngine.h @@ -28,10 +28,6 @@ class EngineInstance { // If not called, platform available default backend will be used. static void SelectBackend(RenderingType type); - /// Initialize Engine for headless rendering. Must be called before first - /// access to the Engine (GetInstance). - static void EnableHeadless(); - // Specifies path to load shaders and skyboxes from. Must be called before // instance usage, or default path will be used. static void SetResourcePath(const std::string& resource_path); @@ -53,7 +49,6 @@ class EngineInstance { EngineInstance(); static RenderingType type_; - static bool is_headless_; static std::string resource_path_; filament::Engine* engine_; FilamentResourceManager* resource_manager_; diff --git a/cpp/open3d/visualization/rendering/filament/FilamentGeometryBuffersBuilder.h b/cpp/open3d/visualization/rendering/filament/FilamentGeometryBuffersBuilder.h index 40bbd32d349..34cbc09133a 100644 --- a/cpp/open3d/visualization/rendering/filament/FilamentGeometryBuffersBuilder.h +++ b/cpp/open3d/visualization/rendering/filament/FilamentGeometryBuffersBuilder.h @@ -26,9 +26,11 @@ #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable : 4068 4146 4293) -// Filament uses OPAQUE and TRANSPARENT as enums which conflicts with windows.h +// Filament uses these as enums / local variables that conflict with windows.h #undef OPAQUE #undef TRANSPARENT +#undef near +#undef far #endif // _MSC_VER #include diff --git a/cpp/open3d/visualization/rendering/filament/FilamentResourceManager.cpp b/cpp/open3d/visualization/rendering/filament/FilamentResourceManager.cpp index dd10e441f59..b21d1b91d68 100644 --- a/cpp/open3d/visualization/rendering/filament/FilamentResourceManager.cpp +++ b/cpp/open3d/visualization/rendering/filament/FilamentResourceManager.cpp @@ -33,8 +33,7 @@ #include #include #include -#include -#include +#include #ifdef _MSC_VER #pragma warning(pop) @@ -596,8 +595,10 @@ RenderTargetHandle FilamentResourceManager::CreateRenderTarget( } auto rt = RenderTarget::Builder() - .texture(RenderTarget::COLOR, color_tex.get()) - .texture(RenderTarget::DEPTH, depth_tex.get()) + .texture(RenderTarget::AttachmentPoint::COLOR, + color_tex.get()) + .texture(RenderTarget::AttachmentPoint::DEPTH, + depth_tex.get()) .build(engine_); handle = RegisterResource(engine_, rt, render_targets_); return handle; @@ -615,11 +616,11 @@ IndirectLightHandle FilamentResourceManager::CreateIndirectLight( &error_str)) { using namespace filament; // will be destroyed later by image::ktx::createTexture - auto* ibl_ktx = new image::KtxBundle( + auto* ibl_ktx = new image::Ktx1Bundle( reinterpret_cast(ibl_data.data()), std::uint32_t(ibl_data.size())); - auto* ibl_texture = - image::ktx::createTexture(&engine_, ibl_ktx, false); + auto* ibl_texture = ktxreader::Ktx1Reader::createTexture( + &engine_, ibl_ktx, false); filament::math::float3 bands[9] = {}; if (!ibl_ktx->getSphericalHarmonics(bands)) { @@ -684,11 +685,11 @@ SkyboxHandle FilamentResourceManager::CreateSkybox( &error_str)) { using namespace filament; // will be destroyed later by image::ktx::createTexture - auto* sky_ktx = new image::KtxBundle( + auto* sky_ktx = new image::Ktx1Bundle( reinterpret_cast(sky_data.data()), std::uint32_t(sky_data.size())); - auto* sky_texture = - image::ktx::createTexture(&engine_, sky_ktx, false); + auto* sky_texture = ktxreader::Ktx1Reader::createTexture( + &engine_, sky_ktx, false); auto skybox = Skybox::Builder() .environment(sky_texture) diff --git a/cpp/open3d/visualization/rendering/filament/FilamentScene.cpp b/cpp/open3d/visualization/rendering/filament/FilamentScene.cpp index 0afb898538a..4ca8c0bf1e7 100644 --- a/cpp/open3d/visualization/rendering/filament/FilamentScene.cpp +++ b/cpp/open3d/visualization/rendering/filament/FilamentScene.cpp @@ -13,6 +13,7 @@ // 32 so that x >> 32 gives a warning. (Or maybe the compiler can't // determine the if statement does not run.) // 4305: LightManager.h needs to specify some constants as floats +#include #include #ifdef _MSC_VER @@ -659,12 +660,21 @@ void FilamentScene::UpdateGeometry(const std::string& object_name, } // Update the geometry to reflect new geometry count + // ******** NOTE ******** setGeometryAt changed - this code path needs + // to be tested!!!! if (geometry_update_needed) { auto& renderable_mgr = engine_.getRenderableManager(); auto inst = renderable_mgr.getInstance(g->filament_entity); +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnonnull" +#endif renderable_mgr.setGeometryAt( inst, 0, filament::RenderableManager::PrimitiveType::POINTS, - 0, n_vertices); + nullptr, nullptr, 0, n_vertices); +#if defined(__clang__) +#pragma clang diagnostic pop +#endif } } } @@ -1959,4 +1969,4 @@ void FilamentScene::HideRefractedMaterials(bool hide) { } // namespace rendering } // namespace visualization -} // namespace open3d +} // namespace open3d \ No newline at end of file diff --git a/cpp/open3d/visualization/rendering/filament/FilamentView.cpp b/cpp/open3d/visualization/rendering/filament/FilamentView.cpp index 1f8656bf6af..201c8cb581f 100644 --- a/cpp/open3d/visualization/rendering/filament/FilamentView.cpp +++ b/cpp/open3d/visualization/rendering/filament/FilamentView.cpp @@ -57,7 +57,8 @@ FilamentView::FilamentView(filament::Engine& engine, FilamentResourceManager& resource_mgr) : engine_(engine), resource_mgr_(resource_mgr) { view_ = engine_.createView(); - view_->setSampleCount(4); + filament::MultiSampleAntiAliasingOptions msaao({true, 4, false}); + view_->setMultiSampleAntiAliasingOptions(msaao); SetAntiAliasing(true, false); SetPostProcessing(true); SetAmbientOcclusion(true, false); @@ -86,7 +87,14 @@ FilamentView::FilamentView(filament::Engine& engine, } FilamentView::~FilamentView() { +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnonnull" +#endif view_->setCamera(nullptr); +#if defined(__clang__) +#pragma clang diagnostic pop +#endif view_->setScene(nullptr); camera_.reset(); @@ -140,9 +148,16 @@ void FilamentView::SetWireframe(bool enable) { } } -void FilamentView::SetSampleCount(int n) { view_->setSampleCount(n); } +void FilamentView::SetSampleCount(int n) { + auto msaao = view_->getMultiSampleAntiAliasingOptions(); + msaao.sampleCount = n; + view_->setMultiSampleAntiAliasingOptions(msaao); +} -int FilamentView::GetSampleCount() const { return view_->getSampleCount(); } +int FilamentView::GetSampleCount() const { + auto msaao = view_->getMultiSampleAntiAliasingOptions(); + return msaao.sampleCount; +} void FilamentView::SetViewport(std::int32_t x, std::int32_t y, @@ -180,14 +195,12 @@ void FilamentView::SetBloom(bool enabled, } void FilamentView::SetAntiAliasing(bool enabled, bool temporal /* = false */) { - if (enabled) { - filament::View::TemporalAntiAliasingOptions options; - options.enabled = temporal; - view_->setAntiAliasing(filament::View::AntiAliasing::FXAA); - view_->setTemporalAntiAliasingOptions(options); - } else { - view_->setAntiAliasing(filament::View::AntiAliasing::NONE); - } + auto options = view_->getTemporalAntiAliasingOptions(); + auto msaao = view_->getMultiSampleAntiAliasingOptions(); + options.enabled = temporal; + msaao.enabled = enabled; + view_->setMultiSampleAntiAliasingOptions(msaao); + view_->setTemporalAntiAliasingOptions(options); } void FilamentView::SetShadowing(bool enabled, ShadowType type) { @@ -227,30 +240,30 @@ void FilamentView::SetColorGrading(const ColorGradingParams& color_grading) { break; } - filament::ColorGrading::ToneMapping tm = - filament::ColorGrading::ToneMapping::LINEAR; - switch (color_grading.GetToneMapping()) { - case ColorGradingParams::ToneMapping::kAcesLegacy: - tm = filament::ColorGrading::ToneMapping::ACES_LEGACY; - break; - case ColorGradingParams::ToneMapping::kAces: - tm = filament::ColorGrading::ToneMapping::ACES; - break; - case ColorGradingParams::ToneMapping::kFilmic: - tm = filament::ColorGrading::ToneMapping::FILMIC; - break; - case ColorGradingParams::ToneMapping::kUchimura: - tm = filament::ColorGrading::ToneMapping::UCHIMURA; - break; - case ColorGradingParams::ToneMapping::kReinhard: - tm = filament::ColorGrading::ToneMapping::REINHARD; - break; - case ColorGradingParams::ToneMapping::kDisplayRange: - tm = filament::ColorGrading::ToneMapping::DISPLAY_RANGE; - break; - default: - break; - } + // filament::ColorGrading::ToneMapping tm = + // filament::ColorGrading::ToneMapping::LINEAR; + // switch (color_grading.GetToneMapping()) { + // case ColorGradingParams::ToneMapping::kAcesLegacy: + // tm = filament::ColorGrading::ToneMapping::ACES_LEGACY; + // break; + // case ColorGradingParams::ToneMapping::kAces: + // tm = filament::ColorGrading::ToneMapping::ACES; + // break; + // case ColorGradingParams::ToneMapping::kFilmic: + // tm = filament::ColorGrading::ToneMapping::FILMIC; + // break; + // case ColorGradingParams::ToneMapping::kUchimura: + // tm = filament::ColorGrading::ToneMapping::UCHIMURA; + // break; + // case ColorGradingParams::ToneMapping::kReinhard: + // tm = filament::ColorGrading::ToneMapping::REINHARD; + // break; + // case ColorGradingParams::ToneMapping::kDisplayRange: + // tm = filament::ColorGrading::ToneMapping::DISPLAY_RANGE; + // break; + // default: + // break; + // } if (color_grading_) { engine_.destroy(color_grading_); @@ -258,7 +271,7 @@ void FilamentView::SetColorGrading(const ColorGradingParams& color_grading) { color_grading_ = filament::ColorGrading::Builder() .quality(q) - .toneMapping(tm) + // .toneMapping(tm) .whiteBalance(color_grading.GetTemperature(), color_grading.GetTint()) .channelMixer( @@ -285,7 +298,7 @@ void FilamentView::SetColorGrading(const ColorGradingParams& color_grading) { } void FilamentView::ConfigureForColorPicking() { - view_->setSampleCount(1); + SetSampleCount(1); SetPostProcessing(false); SetAmbientOcclusion(false, false); SetShadowing(false, ShadowType::kPCF); @@ -355,7 +368,8 @@ void FilamentView::CopySettingsFrom(const FilamentView& other) { if (other.color_grading_) { view_->setColorGrading(other.color_grading_); } - view_->setSampleCount(other.view_->getSampleCount()); + view_->setMultiSampleAntiAliasingOptions( + other.view_->getMultiSampleAntiAliasingOptions()); auto ao_options = other.view_->getAmbientOcclusionOptions(); view_->setAmbientOcclusionOptions(ao_options); auto aa_mode = other.view_->getAntiAliasing(); @@ -386,8 +400,8 @@ void FilamentView::PreRender() { const auto n = camera_->GetNativeCamera()->getNear(); FilamentMaterialModifier(selected_material, material_handle) - .SetParameter("cameraNear", n) - .SetParameter("cameraFar", f) + .SetParameter("cameraNear", static_cast(n)) + .SetParameter("cameraFar", static_cast(f)) .Finish(); } } else if (mode_ == Mode::Normals) { @@ -463,4 +477,4 @@ void FilamentView::PostRender() {} } // namespace rendering } // namespace visualization -} // namespace open3d +} // namespace open3d \ No newline at end of file diff --git a/cpp/open3d/visualization/rendering/filament/LineSetBuffers.cpp b/cpp/open3d/visualization/rendering/filament/LineSetBuffers.cpp index 2e14cfbca48..573402289fa 100644 --- a/cpp/open3d/visualization/rendering/filament/LineSetBuffers.cpp +++ b/cpp/open3d/visualization/rendering/filament/LineSetBuffers.cpp @@ -181,7 +181,6 @@ LineSetBuffersBuilder::Buffers LineSetBuffersBuilder::ConstructThinLines() { VertexBuffer::AttributeType::FLOAT3, ColoredVertex::GetPositionOffset(), sizeof(ColoredVertex)) - .normalized(VertexAttribute::COLOR) .attribute(VertexAttribute::COLOR, 0, VertexBuffer::AttributeType::FLOAT4, ColoredVertex::GetColorOffset(), @@ -303,7 +302,6 @@ LineSetBuffersBuilder::Buffers LineSetBuffersBuilder::ConstructBuffers() { VertexBuffer::AttributeType::FLOAT4, ColoredVertex::GetNextOffset(), sizeof(ColoredVertex)) - .normalized(VertexAttribute::COLOR) .attribute(VertexAttribute::COLOR, 0, VertexBuffer::AttributeType::FLOAT4, ColoredVertex::GetColorOffset(), diff --git a/cpp/open3d/visualization/rendering/filament/PointCloudBuffers.cpp b/cpp/open3d/visualization/rendering/filament/PointCloudBuffers.cpp index f88db292b1f..774c1e1be6b 100644 --- a/cpp/open3d/visualization/rendering/filament/PointCloudBuffers.cpp +++ b/cpp/open3d/visualization/rendering/filament/PointCloudBuffers.cpp @@ -174,12 +174,10 @@ GeometryBuffersBuilder::Buffers PointCloudBuffersBuilder::ConstructBuffers() { VertexBuffer::AttributeType::FLOAT3, ColoredVertex::GetPositionOffset(), sizeof(ColoredVertex)) - .normalized(VertexAttribute::COLOR) .attribute(VertexAttribute::COLOR, 0, VertexBuffer::AttributeType::FLOAT4, ColoredVertex::GetColorOffset(), sizeof(ColoredVertex)) - .normalized(VertexAttribute::TANGENTS) .attribute(VertexAttribute::TANGENTS, 0, VertexBuffer::AttributeType::FLOAT4, ColoredVertex::GetTangentOffset(), @@ -350,10 +348,8 @@ GeometryBuffersBuilder::Buffers TPointCloudBuffersBuilder::ConstructBuffers() { .vertexCount(uint32_t(n_vertices)) .attribute(VertexAttribute::POSITION, 0, VertexBuffer::AttributeType::FLOAT3) - .normalized(VertexAttribute::COLOR) .attribute(VertexAttribute::COLOR, 1, VertexBuffer::AttributeType::FLOAT3) - .normalized(VertexAttribute::TANGENTS) .attribute(VertexAttribute::TANGENTS, 2, VertexBuffer::AttributeType::FLOAT4) .attribute(VertexAttribute::CUSTOM0, 2, diff --git a/cpp/open3d/visualization/rendering/filament/TriangleMeshBuffers.cpp b/cpp/open3d/visualization/rendering/filament/TriangleMeshBuffers.cpp index 776e7011191..d413496c96e 100644 --- a/cpp/open3d/visualization/rendering/filament/TriangleMeshBuffers.cpp +++ b/cpp/open3d/visualization/rendering/filament/TriangleMeshBuffers.cpp @@ -127,7 +127,6 @@ VertexBuffer* BuildFilamentVertexBuffer(filament::Engine& engine, VertexBuffer::AttributeType::FLOAT3, GetVertexPositionOffset(), stride) - .normalized(VertexAttribute::TANGENTS) .attribute(VertexAttribute::TANGENTS, 0, VertexBuffer::AttributeType::FLOAT4, GetVertexTangentOffset(), stride) @@ -137,10 +136,9 @@ VertexBuffer* BuildFilamentVertexBuffer(filament::Engine& engine, stride); if (has_colors) { - builder.normalized(VertexAttribute::COLOR) - .attribute(VertexAttribute::COLOR, 0, - VertexBuffer::AttributeType::FLOAT4, - GetVertexColorOffset(), stride); + builder.attribute(VertexAttribute::COLOR, 0, + VertexBuffer::AttributeType::FLOAT4, + GetVertexColorOffset(), stride); } if (has_uvs) { @@ -633,10 +631,8 @@ GeometryBuffersBuilder::Buffers TMeshBuffersBuilder::ConstructBuffers() { .vertexCount(uint32_t(n_vertices)) .attribute(VertexAttribute::POSITION, 0, VertexBuffer::AttributeType::FLOAT3) - .normalized(VertexAttribute::COLOR) .attribute(VertexAttribute::COLOR, 1, VertexBuffer::AttributeType::FLOAT3) - .normalized(VertexAttribute::TANGENTS) .attribute(VertexAttribute::TANGENTS, 2, VertexBuffer::AttributeType::FLOAT4) .attribute(VertexAttribute::CUSTOM0, 2, diff --git a/cpp/open3d/visualization/visualizer/ViewControlWithCustomAnimation.cpp b/cpp/open3d/visualization/visualizer/ViewControlWithCustomAnimation.cpp index dc4d9a77408..8d147dfbc7c 100644 --- a/cpp/open3d/visualization/visualizer/ViewControlWithCustomAnimation.cpp +++ b/cpp/open3d/visualization/visualizer/ViewControlWithCustomAnimation.cpp @@ -161,7 +161,7 @@ std::string ViewControlWithCustomAnimation::GetStatusString() const { if (view_trajectory_.view_status_.empty()) { buffer = "empty trajectory"; } else { - buffer = fmt::format(buffer, "#{} frame ({} in total{})", + buffer = fmt::format("#{} frame ({} in total{})", (unsigned int)CurrentFrame() + 1, (unsigned int)view_trajectory_.NumOfFrames(), view_trajectory_.is_loop_ ? ", looped" : ""); diff --git a/cpp/open3d/visualization/visualizer/VisualizerWithCustomAnimation.cpp b/cpp/open3d/visualization/visualizer/VisualizerWithCustomAnimation.cpp index fa13111961e..e01fbb76adb 100644 --- a/cpp/open3d/visualization/visualizer/VisualizerWithCustomAnimation.cpp +++ b/cpp/open3d/visualization/visualizer/VisualizerWithCustomAnimation.cpp @@ -107,17 +107,18 @@ void VisualizerWithCustomAnimation::Play( view_control.ConvertToPinholeCameraParameters(parameter); trajectory_ptr->parameters_.push_back(parameter); } - std::string buffer; if (recording_depth) { - buffer = fmt::format(recording_depth_filename_format_.c_str(), - recording_file_index_); - CaptureDepthImage( - recording_depth_basedir_ + std::string(buffer), false); + auto buffer = fmt::format( + fmt::runtime(recording_depth_basedir_ + + recording_depth_filename_format_), + recording_file_index_); + CaptureDepthImage(buffer, false); } else { - buffer = fmt::format(recording_image_filename_format_.c_str(), - recording_file_index_); - CaptureScreenImage( - recording_image_basedir_ + std::string(buffer), false); + auto buffer = fmt::format( + fmt::runtime(recording_depth_basedir_ + + recording_image_filename_format_), + recording_file_index_); + CaptureScreenImage(buffer, false); } } view_control.Step(1.0); diff --git a/cpp/pybind/visualization/rendering/rendering.cpp b/cpp/pybind/visualization/rendering/rendering.cpp index 417f8d9d2ad..fd3ea179092 100644 --- a/cpp/pybind/visualization/rendering/rendering.cpp +++ b/cpp/pybind/visualization/rendering/rendering.cpp @@ -35,9 +35,6 @@ class PyOffscreenRenderer { gui::InitializeForPython(resource_path, true); width_ = width; height_ = height; - // NOTE: OffscreenRenderer now always uses headless so that a window - // system is never required - EngineInstance::EnableHeadless(); renderer_ = new FilamentRenderer(EngineInstance::GetInstance(), width, height, EngineInstance::GetResourceManager()); diff --git a/docker/Dockerfile.ci b/docker/Dockerfile.ci index 18432c8cbc6..cbad785399e 100755 --- a/docker/Dockerfile.ci +++ b/docker/Dockerfile.ci @@ -165,7 +165,7 @@ RUN source util/ci_utils.sh \ RUN mkdir -p /etc/apt/keyrings \ && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \ | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ - && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" \ + && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" \ | tee /etc/apt/sources.list.d/nodesource.list \ && apt-get update \ && apt-get install -y nodejs \ diff --git a/docker/Dockerfile.wheel b/docker/Dockerfile.wheel index e685faaf79f..08a3ae5a583 100644 --- a/docker/Dockerfile.wheel +++ b/docker/Dockerfile.wheel @@ -1,5 +1,5 @@ # FROM must be called before other ARGS except for ARG BASE_IMAGE -ARG BASE_IMAGE=nvidia/cuda:12.1.0-cudnn8-devel-ubuntu20.04 +ARG BASE_IMAGE=nvidia/cuda:12.6.3-cudnn-devel-ubuntu22.04 FROM ${BASE_IMAGE} # Customizable build arguments from cuda.yml @@ -119,7 +119,7 @@ RUN source /root/Open3D/util/ci_utils.sh \ && install_python_dependencies with-jupyter # Open3D Jupyter dependencies -RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \ +RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ && apt-get install -y nodejs \ && rm -rf /var/lib/apt/lists/* \ && node --version diff --git a/docker/docker_build.sh b/docker/docker_build.sh index 582aaa459bb..733b587d858 100755 --- a/docker/docker_build.sh +++ b/docker/docker_build.sh @@ -72,8 +72,9 @@ OPTION: HOST_OPEN3D_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. >/dev/null 2>&1 && pwd)" # Shared variables -CMAKE_VERSION=cmake-3.29.2-linux-x86_64 -CMAKE_VERSION_AARCH64=cmake-3.24.4-linux-aarch64 +AARCH="$(uname -m)" +# do cmake pending on the architecture +CMAKE_VERSION=cmake-3.31.8-linux-${AARCH} CUDA_VERSION=12.6.3-cudnn CUDA_VERSION_LATEST=12.6.3-cudnn @@ -106,7 +107,7 @@ openblas_export_env() { export DOCKER_TAG=open3d-ci:openblas-arm64 export BASE_IMAGE=arm64v8/ubuntu:22.04 export CONDA_SUFFIX=aarch64 - export CMAKE_VERSION=${CMAKE_VERSION_AARCH64} + export CMAKE_VERSION=${CMAKE_VERSION} else echo "Invalid platform." print_usage_and_exit_docker_build diff --git a/examples/cpp/OffscreenRendering.cpp b/examples/cpp/OffscreenRendering.cpp index 18bc71d3b76..4d5cd37015d 100644 --- a/examples/cpp/OffscreenRendering.cpp +++ b/examples/cpp/OffscreenRendering.cpp @@ -16,7 +16,7 @@ using namespace open3d::visualization::rendering; // Headless rendering requires Open3D to be compiled with OSMesa support. // Add -DENABLE_HEADLESS_RENDERING=ON when you run CMake. -static const bool kUseHeadless = false; +static const bool kUseHeadless [[maybe_unused]] = false; static const std::string kOutputFilename = "offscreen.png"; @@ -26,9 +26,6 @@ int main(int argc, const char *argv[]) { auto &app = Application::GetInstance(); app.Initialize(argc, argv); - if (kUseHeadless) { - EngineInstance::EnableHeadless(); - } auto *renderer = new FilamentRenderer(EngineInstance::GetInstance(), width, height, diff --git a/util/ci_utils.sh b/util/ci_utils.sh index dc5182f159b..9ea4cbd3f65 100644 --- a/util/ci_utils.sh +++ b/util/ci_utils.sh @@ -31,8 +31,8 @@ TENSORFLOW_VER="2.19.0" TORCH_VER="2.7.1" TORCH_REPO_URL="https://download.pytorch.org/whl/torch/" # Python -PIP_VER="24.3.1" -PROTOBUF_VER="4.24.0" +PIP_VER="25.1.1" +PROTOBUF_VER="6.31.1" OPEN3D_INSTALL_DIR=~/open3d_install OPEN3D_SOURCE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. >/dev/null 2>&1 && pwd)" @@ -140,7 +140,14 @@ build_pip_package() { echo "Building Open3D wheel" options="$(echo "$@" | tr ' ' '|')" - BUILD_FILAMENT_FROM_SOURCE=OFF + AARCH="$(uname -m)" + if [[ "$AARCH" == "aarch64" ]]; then + echo "Building for aarch64 architecture" + BUILD_FILAMENT_FROM_SOURCE=ON + else + echo "Building for x86_64 architecture" + BUILD_FILAMENT_FROM_SOURCE=OFF + fi set +u if [[ -f "${OPEN3D_ML_ROOT}/set_open3d_ml_root.sh" ]] && [[ "$BUILD_TENSORFLOW_OPS" == "ON" || "$BUILD_PYTORCH_OPS" == "ON" ]]; then @@ -165,9 +172,11 @@ build_pip_package() { if [[ "build_jupyter" =~ ^($options)$ ]]; then echo "Building Jupyter extension in Python wheel." BUILD_JUPYTER_EXTENSION=ON + BUILD_WEBRTC_FROM_SOURCE=ON else echo "Jupyter extension disabled in Python wheel." BUILD_JUPYTER_EXTENSION=OFF + BUILD_WEBRTC_FROM_SOURCE=OFF fi set -u @@ -184,6 +193,7 @@ build_pip_package() { "-DBUILD_PYTORCH_OPS=$BUILD_PYTORCH_OPS" "-DBUILD_FILAMENT_FROM_SOURCE=$BUILD_FILAMENT_FROM_SOURCE" "-DBUILD_JUPYTER_EXTENSION=$BUILD_JUPYTER_EXTENSION" + "-DBUILD_WEBRTC=$BUILD_WEBRTC_FROM_SOURCE" "-DCMAKE_INSTALL_PREFIX=$OPEN3D_INSTALL_DIR" "-DCMAKE_BUILD_TYPE=Release" "-DBUILD_UNIT_TESTS=OFF"