Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node for directionally varying emission. #1262

Conversation

niklasharrysson
Copy link
Contributor

@niklasharrysson niklasharrysson commented Feb 27, 2023

This change list adds a new node to pbrlib: generalized_schlick_edf.

  <!--
    Node: <generalized_schlick_edf>
    Modifies an EDF with a directional factor. Attenuates the emission distribution of the base EDF according to
    a generalized Schlick fresnel function.
  -->
  <nodedef name="ND_generalized_schlick_edf" node="generalized_schlick_edf" nodegroup="pbr" doc="Modifies an EDF with a directional factor.">
    <input name="color0" type="color3" value="1.0, 1.0, 1.0" />
    <input name="color90" type="color3" value="1.0, 1.0, 1.0" />
    <input name="exponent" type="float" value="5.0" />
    <input name="base" type="EDF" value="" />
    <output name="out" type="EDF" />
  </nodedef>

This node can be used to create a directionally varying / Fresnel-like modulation to emission, using the generalized Schlick Fresnel curve. The main idea is to use this to approximate how emission is attenuated when placed under a coating, which is supported in shading models like Standard Surface.

Using the new node the graph implementation of Standard Surface is updated, to address this as reported in #1057.

Note that this is a simple solution that only account for the Fresnel effect. The roughness of the coat, or multiple scattering in the coat layer, is not considered. We are limited to what can be represented in all the shading languages that MaterialX needs to support. Directionally varying emission was not supported in MDL util recently, and this new node matches what can be expressed in MDL (from version 1.7).

Simple example to show the node result, here modulating a uniform white emission with yellow->red for facing->gracing angles:
Screenshot 2023-02-27 19 15 49

Example to show the improved implementation of Standard Surface (top = old implementation, bottom = new implementation):
Screenshot 2023-02-27 20 07 20
Screenshot 2023-02-27 20 07 31

@niklasharrysson
Copy link
Contributor Author

Comparing GLSL (top) with OSL (bottom):

generalized_schlick_edf_test_out_glsl
generalized_schlick_edf_test_out_osl

Copy link
Member

@jstone-lucasfilm jstone-lucasfilm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me, thanks @niklasharrysson!

@jstone-lucasfilm jstone-lucasfilm merged commit 99f5f45 into AcademySoftwareFoundation:main Mar 10, 2023
Michaelredaa pushed a commit to Michaelredaa/MaterialX that referenced this pull request Oct 21, 2023
…on#1262)

This change list adds a new node to pbrlib: generalized_schlick_edf.

This node can be used to create a directionally varying / Fresnel-like modulation to emission, using the generalized Schlick Fresnel curve. The main idea is to use this to approximate how emission is attenuated when placed under a coating, which is supported in shading models like Standard Surface.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants