Git Product home page Git Product logo

spsir's Introduction

Single-pass stratified importance resampling

Implementation of our paper "Single-pass stratified importance resampling" by Ege Ciklabakkal, Adrien Gruson, Iliyan Georgiev, Derek Nowrouzezahrai, and Toshiya Hachisuka.

The implementation builds on the pbrt, version 3 renderer. The project can be built in the same way as pbrt.

For further details, we refer to the project webpage.

Building Spsir

Built the same way as pbrt.

$ git clone --recursive [email protected]:EgeCiklabakkal/spsir.git
$ cd spsir
$ mkdir build
$ cd build
$ cmake ..
$ make -j8

Scenes

We include the scenes used to generate the renderings in the paper. For further details on the scenes we refer to README.

Note that in all scenes, ray per pixel is set to 1 and these primary rays go through the center of the pixels. We do so to focus on the variance (reduction) from resampled importance sampling (RIS). Our method can be extended to multiple sample per pixel by using a low-discrepancy sequence to sample the primary rays and querying the blue-noise mask with independent offsets. Previous work has found that the R2-sequence is a good choice for such offset.

To reproduce the exact figures, some modifications to the code would be necessary (For example, fig. 6 reorders the candidates after they are generated, which is not our exact algorithm), however our main method is implemented to cover each sampling problem we present in the paper.

Code Organization

The following is the list of changed / new files for our method:

1. src/core/api.cpp

Parse and make medium HomogeneousBlockingMedium

2. src/core/dithermask.*

Class for DitherMask of any dimension. Should be used with dither masks created by Dithering Mask Generator

3. src/core/hilbertcurve.*

Class for HilbertCurve of any dimension. The main interface is the sample function which returns the primary sample space candidate (all components in [0,1)) along the Hilbert Curve, given a random number u. There is also the simpler 2D version HilbertCurve2D for better performance.

4. src/core/integrator.*

Includes many functions implementing our method.

[Reservoir,InverseCDF,BidirectionalCDF]LightOnly(...) functions implement RIS with 2D candidates of light samples, using reservoir sampling, inverse CDF sampling, and our bidirectional CDF sampling respectively. Reservoir sampling doesn't utilize our Hilbert Curve reordering and instead uses low-discrepancy sequences (this is also the case for other sampling problems). It serves as a reasonable baseline. The other methods do utilize the Hilbert Curve reordering.

[Reservoir,InverseCDF,BidirectionalCDF]BSDFEnvMIS(...) functions implement RIS with candidates generated by sampling either the BSDF or the environment light. The candidates are then weighted by multiple importance sampling (MIS). This weighting is the same as Sec. 4.6.1 Multiple Importance Sampling applied to Proposals from Talbot's thesis These functions assume that there is only the environment map as the light. Our goal here is to show that we can combine our method with MIS.

There are also functions related to volume sampling.

5. src/core/light.*

Virtual method so sample light and return pdf in area measure (instead of solid angle measure).

6. src/core/medium.h

enum class of volume sampling strategies RISReservoir, RISInverseCDF, RISBidirectionalCDF along virtual methods for our volume sampling experiments.

7. src/core/reservoir.h

Implements the Reservoir class, also includes the classes for candidates.

8. src/core/sampler.*

Implements the R2-sequence to offset the DitherMask. This offset is controlled by a seed provided by the user. Different offsets can be used to generate multiple outputs to be averaged.

9. src/core/shape.*

Virtual method to help return area measure when sampling lights.

10. src/integrators/directlighting.* and src/integrators/volpath.*

Integrator modified to read variables needed for our methods and call them appropriately.

11. src/lights/diffuse.* and src/lights/point.*

Sample lights and return pdf in area measure.

12. src/media/homogeneousblocking.*

Implements the HomogeneousBlockingMedium that represents the volume such that the ray inside it always samples a medium interaction. In other words, the objects inside the medium are never shaded, but they affect the maximum distance if the ray. Therefore we can see the objects in a way, however they are not shaded. This medium allows us to focus only on sampling a distance along the ray. In our experiments, the volume always exists throughout the whole scene (it is not confined in an object).

For the first experiment, we consider a single point light inside the homogeneous medium and single scattering as the sampling problem (i.e. sampling distance along primary rays). The relevant method is SampleLightDriven(...) (samples according to the given light) which calls SampleRIS[Reservoir,iCDF,Bidirectional]LightDriven(...) similarly to our 2D direct lighting experiments.

For the second experiment, our goal is to sample distance along the ray and a direction to some (area) light so that our candidates are 3D. The relevant method is SampleDistDir(...) which calls SampleRIS[Reservoir,Bidirectional]DistDir(...).

How to cite

@article{Ciklabakkal:2022:StratifiedResampling,
  author = {Ege Ciklabakkal and Adrien Gruson and Iliyan Georgiev and Derek Nowrouzezahrai and Toshiya Hachisuka},
  title = {Single-pass stratified importance resampling},
  journal = {Computer Graphics Forum (Proceedings of EGSR)},
  year = {2022},
  number = {4},
  volume = {41}
}

spsir's People

Contributors

mmp avatar tunabrain avatar syoyo avatar nyue avatar wjakob avatar twinklebear avatar egeciklabakkal avatar aaronmk avatar tdapper avatar mjhsnps avatar nextdesign1 avatar ambakshi avatar mudream4869 avatar phg1024 avatar rcythr avatar zq317157782 avatar samsymons avatar kapsler avatar srombauts avatar tristanpenman avatar shadeops avatar lifta42 avatar chaosink avatar mwkm avatar soma-arc avatar sriravic avatar tsulej avatar mx7f avatar matt77hias avatar kojinakamaru avatar

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.