Giter VIP home page Giter VIP logo

deepfacetx's Introduction

DeepFacetX

Implementation of "Microfacet theory for non-uniform heightfields" in Autodesk Maya Arnold plugin. This is a plugin that allow user use customizable non-linearly blended conductor and dielectric BSDF node. When viewing at a grazing angle, non-uniform heightfields are more likely to differ from linearly-blended ones.

Reference Paper Link: Microfacet theory for non-uniform heightfields (nvidia.com)

Before using it inside Arnold, make sure your diffuse ray depth in Arnold render setting is greater than 1, to get transmission material working.

Build

Setting environment variables

  • ARNOLD_PATH to C:\Program Files\Autodesk\Arnold\maya2023

  • ARNOLD_PLUGIN_PATH to your plugin folder, in this case is /plugin of this project

  • MTOA_TEMPLATES_PATH the same as ARNOLD_PLUGIN_PATH

  • Add %ARNOLD_PATH%\bin to your system's PATH variable

Build Commands

mkdir build & cd build & cmake ..

Then use your own tool to compile the project.

After generated the .dll file, make sure to copy the file under /plugin

Principles

Simulate Microsurface with Volumes

  • Used volumetric light transport of modified microflake model to do random walk on the microsurface.
  • Used optical depth to simplify the microfacet medium to several medium with uniform density.
  • Used the exact method to sample visible normal on microsurface (for sampling phase function). (A Simpler and Exact Sampling Routine for the GGX Distribution of Visible Normals)

The pseudo-code for random walk BSDF evaluation is as follow:

// wi and wo are incident and outgoing direction
// zs is the optical depth of the boundary of the two layers
// max_scattering_order is the maximum order of random walk
// sigma_a() and sigma_b() are functions that can compute the extinction coeff of a constant medium
// lambda_a() and lambda_b() are smith lambda functions for layer a and b
// rng() is a function that uniformly generate random numbers in [0,1]
// See supplemental material for "MicrofacetTheoryforNon-UniformHeightfields" for more info

function EvalAsymetricMicrofacet(wi, wo, zs, max_scattering_order):
	z = 0
	w = -wi
	output = 0
	i = 0
	while i < max_scattering_order:
		sigma_in = z > zs ? sigma_a(w) : sigma_b(w)
		sigma_out = z > zs ? sigma_b(w) : sigma_a(w)
		delta_z = w.z * (-log(rng()) / sigma_in)
		if (z < zs) != (z + delta_z < zs):
			delta_z = (zs - z) + (delta_z - zs + z) * sigma_in / sigma_out
		z = z + delta_z
		if z > 0:
			break
		p = z > zs ? evalPhaseFunctionA(w, wo) : evalPhaseFunctionB(w, wo)
		tau_exit = max(z, zs) * lambda_a(wo) + min(z - zs, 0) * lambda_b(wo)
		output += exp(tau_exit) * p
		w = z > zs ? samplePhaseFunctionA(w) : samplePhaseFunctionB(w)
	return output

Variance Reduction Techniques

  • For multiple importance sampling in Arnold, we need to provide pdf, eval and sample
  • We can’t know the exact pdf of the random walk, but can get an approximated pdf from single scatter plus diffuse (this is enough for unbiased path tracing)
  • Use analytical solution for single scattering (no randomness for first bounce)
  • Use bidirectional random walk for BSDF evaluation. Randomly starts from wi or wo. Accumulate NEE in random walks both from the wi and the wo.
  • Combine the result of single and multiple scattering using multiple importance sampling (can use an approximated pdf)
Weights for forward and backward walks in bidirectional eval
Unidirectional eval Bidirectional eval

As we can see from the result, bidirectional eval can greatly reduce fireflies due to randomness.

References

[1] Microfacet theory for non-uniform heightfields (nvidia.com)

[2] Multiple-Scattering Microfacet BSDFs with the Smith Model

[3] Physically Based Rendering: From Theory to Implementation (pbr-book.org)

[4] A Simpler and Exact Sampling Routine for the GGX Distribution of Visible Normals

[5] Additional Progress Towards the Unification of Microfacet and Microflake Theories

[6] Microfacet Models for Refraction through Rough Surfaces

Specially Thanks

Eugene d'Eon: One of the authors of the paper. We thank him for his help in clarifying some errors in the original paper.

Chang Liu: Alumni of Penn. We thank him for his help in interfacing with Arnold API.

deepfacetx's People

Contributors

bdwhst avatar

Watchers

 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.