/poisson_caustic_design

Portable C++ code that computes the shape of a transparant surface to cast an image as a shadow

Primary LanguageC++MIT LicenseMIT

Poisson-Based Continuous Surface Generation for Goal-Based Caustics

Overview

This project implements and builds upon the method described in the paper Poisson-Based Continuous Surface Generation for Goal-Based Caustics.

Result simulated with Blender using LuxRender: Alt text

Features

  • Implementation of the Poisson-based continuous surface generation algorithm.
  • exports a solidified .obj
  • the only c++17 non-standard dependancy is libpng
  • can export the the inverse transport map
  • multithreaded poisson solver

Installation

Prerequisites

  • C++ compiler with C++17 support for your platform
  • libpng (requires zlib)

Building from Source: Unix

  1. Clone the repository:

    git clone git@github.com:dylanmsu/caustic_engineering.git
  2. Navigate to the project directory:

    cd caustic_engineering
  3. Compile the source code:

    # create build directory
    mkdir build && cd build
    
    # generate build files
    cmake ..
    
    # build
    make
  4. Run the code:

    ./CausticEngineering [parameters]

Building from Source: Windows

  1. Clone the repository:

    git clone git@github.com:dylanmsu/caustic_engineering.git
  2. Navigate to the project directory:

    cd caustic_engineering
  3. Compile the source code:

    # create build directory
    mkdir build && cd build
    
    # generate build files (assumes C:/mingw64 to be the mingw64 path)
    & "C:/mingw64/bin/cmake.exe" -G "MinGW Makefiles" .. 
    
    # build
    & "C:/mingw64/bin/mingw32-make.exe"
  4. Run the code:

    ./CausticEngineering.exe [parameters]

Usage

Running the Program

  1. Parameters:

    •   --intput_png=[image path] # input image path
    •   --res_w=[grid resolution] # mesh resolution in the x-axis
    •   --width=[mesh width] # physical width of the mesh
    •   --focal_l=[focal length] # focal length
    •   --thickness=[lens thickness] # thickness of the final caustic lens
    •   --max_threads=[max number of threads] # sets the maximum cpu threads for the poisson solver
  2. Execute the program:

    ./CausticEngineering.exe --intput_png=../img/siggraph.png --res_w=100 --width=0.5 --focal_l=1.5 --thickness=0.1 --max_threads=16

Sample Output

input_image parameterization inverted parameterization 3d_model simulation
Lena (Mesh: 256 x 256) Lena Parameterization Lena Parameterization Lena Inverted Parameterization Lena 3D Model Lena Simulation
Siggraph logo (Mesh: 200 x 200) Lena Parameterization Siggraph Parameterization Siggraph Inverted Parameterization Siggraph 3D Model Siggraph Simulation
Hello World (Mesh: 256 x 128) Lena Parameterization Siggraph Parameterization Siggraph Inverted Parameterization Siggraph 3D Model Siggraph Simulation

transport from an image to an almost uniform distribution:

Alt text

Prototype

Machined acrylic prototype: Machined acrylic lens

Shadow of the machined prototype: Resulting Caustic Lens

Future plans

  1. least squares solver for the heightmap -> this will allow more freedom in the lens design
  2. reflective caustics -> is currently not that usefull because of the limited freedom in the height solver
  3. circular caustic lenses
  4. use the fast transport map algoritm from the paper: [https://gnader.github.io/publications/2018-ot-transport.html](Instant Transport Maps on 2D Grids)

Contributing

Contributions are welcome! If you'd like to contribute to this project, please follow these steps:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature)
  3. Make your changes
  4. Commit your changes (git commit -am 'Add new feature')
  5. Push to the branch (git push origin feature)
  6. Create a new Pull Request

License

This project uses the MIT License.

Acknowledgements

Thank you to Yue et al for their awesome research paper.

I would also like to thank Matt Ferraro for providing their informative article about the paper.