Skip to content

IMR-Hannover/Refloid

Repository files navigation

pyrefloid

A python-optix based pathtracer for simulating fringe projection profilometry systems

Use Cases

  • multireflection analysis and avoidance
  • pattern frequency simulation
  • accuracy prediction
  • ...

Getting started

On Docker with Linux Desktop/Server (recommended)

  1. Clone the repo

  2. Install and configure Cuda 12.x, nvida-container-toolkit >=1.13, libnvoptix and libnvidia-rtcore (available with apt install libnvidia-gl-$NVIDIA_DRIVER_VERSION after installation of cuda as part of the nvidia repo)

  3. Download the Nvidia Optix 7.6-install-script and put it in the dependencies directory

  4. Start the setup via docker compose up -d --build

  5. At the end of the setup a interactive shell should open and you are ready to start the renderer with python pyrefloid/FringeProjection.py

On Windows and Linux (locally)

You have to install: Optix 7.6, Cuda 12.x and Conda

  1. Install python with the necessary requirements

    • Options:
      • a) Install a conda enviroment including the dependencies via conda env create --file .\conda_environment.yml -n "YOUR_ENV_NAME"

      • b) Install Python and MSVC compiler for windows (GCC or Clang for Linux) and take care of the python deps (use the conda_enviroment.yml file as a reference for pip) unrecommended - (conflicting/ circular dependencies)

  2. Set Environment Variable

    • Linux
      • export OPTIX_PATH = xxxx (path of the NVIDA_OPTIX_SDK_7.6 direcotry)
      • export CUDA_PATH = xxxx
      • If using venv, add both paths to the PATH variable!
      • export PATH = $CUDA_PATH:$OPTIX_PATH:$PATH
    • Windows
      • Follow this Guide
      • Create both variables with names as above i.e. OPTIX_PATH with value "C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.6.0\"
      • Append both directorys to the PATH variable
  3. Activate the conda enviroment and install this repo via pip install -e .

  4. Start the simulation via python pyrefloid/FringeProjection.py

Tipps

General

  • The repo/package needs to be installed editable pip install -e ./pyrefloid as the compiler structure of cupy depends on relative pathes
  • Tested with
    • NVidia GV100, 4070Ti and 3090
    • Windows 10, Ubuntu 20.04/22.04 and Debian 12
    • Nvidia drivers 525.xxx - 545.xxx
  • WSL2 seems to not support optix (currently)

Docker

  • Make sure there are no errors during ./setup_docker.sh
  • Make sure that libnvoptix.so is present inside and outside of the docker container --> ls -la /lib/x86_64-linux-gnu/libnv*
  • Make sure that the version of libnvoptix.so links to a file that matches the installed driver version (>= 525) i.e. libnvoptix.so.525.147.05

  • Changes in docker-sessions are persistent
  • It is possible to attach and debug sessions via the vscode docker plugin
  • open3d visualizaitons should be streamed from the container to your local computer if started via the vscode docker plugin
  • A former session can be reopend via ./start_docker.sh
  • If you need a reset of the container use ./init_image.sh for a full rebuild use ./setup_docker.sh

Todo List

Performance

reduce the number of calls per rendering - pass list of extrinsics bevor rendering
implement Object rotation - currently only translation is possible
Spheric sampling
Uniform sampling
Cylindric sampling \

Features

Support for all BRDF models
Support for different light sources
Support for different materials
Support for orthographic cameras
Support depth of field \

Optimization

Pose Optimization
Optimization of the BRDF parameters
Optimization of the light source parameters
Optimization of the material parameters
Optimization of the camera parameters
Optimization of the depth of field parameters
Optimization of the sampling parameters \