MaterialX icon indicating copy to clipboard operation
MaterialX copied to clipboard

Add abbe number to dielectric BSDF

Open AdrienHerubel opened this issue 1 year ago • 4 comments

This PR addresses the limitation described in #2202 and makes it possible to implement support for dispersion in the OpenPBR and Standard Surface node graphs.

AdrienHerubel avatar Jan 27 '25 16:01 AdrienHerubel

This proposal simply adds to the nodedef of dielectric_bsdf:

<input name="abbe_number" type="float" value="0.0" uimin="0.0" uisoftmin="9.0" uisoftmax="91.0" />

Things to note:

  • The name abbe_number seems sensible. (Abbe is a name, but all params are lower case).
  • The (soft) min and max are taken from OpenPBR. The default of 0 is taken to mean "no dispersion", i.e. technically it corresponds to infinite Abbe number.. Since we presumably want the default to be no dispersion, and 0 is the most obvious sentinel value. (This is the same scheme as in Standard Surface). In OpenPBR we make the default 20, and have another scale parameter which divides that to generate the Abbe number, where the scale defaults to zero. For MaterialX, I think it makes more sense to just have the physical Abbe number (and not the convenience scale factor), with the 0 sentinel meaning infinite Abbe i.e. zero dispersion. See image below (from the Arnold docs) for the effect of typical values.
  • The MaterialX spec needs updating to state the new parameter. The standard definition of what it means requires some formulas (found e.g. on wikipedia), which we specified in detail in the OpenPBR spec. Those can be stated, or referenced, or alternatively just leave it to the implementor to interpret it.
  • The implementation in testrender requires some more thought, as there are various ways to account for refractive dispersion in a renderer (which differ depending on whether pathtracing or rasterizing). I take it this initial PR can just be for the change to the spec, and a testrender implementation can come later.
image

portsmouth avatar Jan 28 '25 16:01 portsmouth

In the MaterialX meeting, we noted:

  • it would make sense to add the Abbe number to the "generalized Schlick" BSDF as well, since this is used as a model of dielectric transmission also. In this case the refractive index would map to the F0 of the Schlick model. (The input itself would be the same presumably).
  • it would be good to loop in the OSL and MDL teams (on Slack), to double check that this parametrization works for them.
  • it would be good to outline here (and give some references) how implementations of refractive dispersion in various renderers might be done (pathtracing versus rasterization), to inform how this can be integrated into the various targets for testrender.

portsmouth avatar Jan 28 '25 18:01 portsmouth

@AdrienHerubel @portsmouth I wanted to ping this discussion, as there was interest in moving forward with this feature at today's MaterialX TSC meeting.

As a starting point, should we simply extend Adrien's PR to include generalized_schlick_bsdf as well as dielectric_bsdf, so that we have a complete pull request to review with the community?

Additionally, I'm looping in @fpsunflower and @masuosuzuki for thoughts from the OSL and MDL perspectives.

jstone-lucasfilm avatar Mar 11 '25 20:03 jstone-lucasfilm

Change looks fine to me. Are any changes needed to forward the parameter to the OSL closure or does this happen automatically?

Its easy to add the extra parameter on the OSL side as a keyword arg for backwards compatibility. As @portsmouth said the implementation in testrender will require some thought, but we can at least have the parameter there.

fpsunflower avatar Mar 12 '25 07:03 fpsunflower