Giter Club home page Giter Club logo

manifold-visualizer's Introduction

2D Specular Manifold Visualizer

Header

Introduction

This is a helper tool written while working on the 2020 SIGGRAPH paper "Specular Manifold Sampling for Rendering High-Frequency Caustics and Glints" by Tizian Zeltner, Iliyan Georgiev, and Wenzel Jakob. Its main use is visualize some of the ideas behind the specular manifold constraint framework in a simplified 2D setting, e.g. to prototype new ideas or to generate animations.

It also includes visualizations for previous work

The implementation is written in a combination of C++ (for ray tracing against primitives such as Bezier curves), and Python (for the main algorithms and the GUI).

Usage

Basics

basics

  • The first two parts of the GUI allow you to choose between different test scenes (left), and the current mode (right).
  • There is also a button to reload the current scene (keyboard shortcut: R).
  • The selected scene can be moved with Shift+Left mouse click+drag and zoomed in/out with Scroll wheel
  • Please have a look at python/scenes.py to define more scenes.
  • You can also switch between the available three modes using the number keys 1, 2, and 3.

Raytracing

raytracing

In the Raytracing mode, there is one movable point for the beginning of the light path. Its position can be moved along the surface with Left mouse click+drag and the ray direction can be rotated with Alt+Left mouse click+drag.

Options:

  • Toggle normals and tangents for ray intersections on specular surfaces.

Manifold exploration

manifold_exploration

In the Manifold exploration mode, there is a movable point that corresponds to the end of the light path. Moving it (Left mouse click+drag) will attempt to perform a manifold walk that moves the complete light path while a) keeping the start point fixed, and b) keeping all specular contraints along the path fulfilled. Switch to the Raytracing mode in order to move the start of the path instead.

Options:

  • Toggle normals and tangents for ray intersections on specular surfaces.

  • Switch between the original specular constraints (left) based on projected half-vectors (Jakob and Marschner 2012) or the new constraints (right) based on angle differences (Zeltner et al. 2020).

  • Instead of doing full manifold walks, just move the specular vertices up to a first-order approximation (left toggle) and visualize the updated light path after projecting it back onto the specular manifold (right toggle). This is useful to visualize the first iteration of the underlying Newton solver.

  • Set the max. number of iterations (N) and the threshold value (eps) to determine the success of the underlying Newton solver.

Specular manifold sampling (SMS) and manifold next event estimation (MNEE)

specular_manifold_sampling

In the Specular manifold sampling mode, there are three movable (Left mouse click+drag) points: the two endpoints of the path, and a position on a specular surface. The algorithm will try to refine the initial path derived from their configuration into a valid light path using a Newton solver.

Options:

  • Toggle between Manifold next event estimation (left toggle) or Specular manifold sampling (right toggle).
  • Set the number of specular bounces (N) that are required to sample a full path. This will usually be set appropriately based on the selected scene.

  • Switch between the original specular constraints (left) based on projected half-vectors (Jakob and Marschner 2012) or the new constraints (right) based on angle differences (Zeltner et al. 2020).
  • Toggle if the constraints should be visualized ("show"), and if the alternative set of constraints should be shown for the case of angle differences.

  • Set the max. number of iterations (N) and the threshold value (eps) to determine the success of the underlying Newton solver.

  • Toggle if the paths at intermediate steps of the Newton solver should be shown. They will use a color scheme from start/red -> end/green.
  • Set a scale factor for all Newton solver steps.

  • "Go" will sample a set of "N" random points on the specular surface that will be converted to initial paths that are given to the Newton solver.
  • "Show seeds" will toggle whether the initial paths should also be shown alongside the converged paths.

  • "Go" will sample a set of "N" offset microfacet normals with a given variance (value in parentheses) for the current path that will then be used as the surface normals for the specular constraints. (See offset manifold walks in Jakob and Marschner 2012 and two-stage sampling in Zeltner et al. 2020.

Building

Clone the repository recursively with all dependencies and use CMake to generate project files for your favourite IDE or build system. Unix example using make:

git clone https://github.com/tizian/manifold-visualizer --recursive
cd manifold-visualizer
mkdir build
cd build
cmake ..
make

This will compile the C++ components of this project into a Python libray also build the nanogui dependency at the same time.

Running

Simply run the Python file in /python/viewer.py, but make sure both the manifolds and nanogui Python libraries are somewhere on the PYTHONPATH, e.g.:

export PYTHONPATH=<path_to_project>/build:<path_to_project>/build/ext/nanogui:$PYTHONPATH
python <path_to_project>/python/viewer.py

Third party code

This project depends on the following libraries:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.