Note: This is an archived version of the Blender Developer Wiki (archived 2024). The current developer documentation is available on developer.blender.org/docs.

User:LeonardoSegovia/GSoC 2018/Reports/Week 9

Week 9

Hi everyone! This is my report for the present week.

Objectives

This week, I dealt with the objectives for Weeks 10 and 11:

  • User documentation revision.
  • Developer documentation revision.

What's been done

On Monday, Brecht did a revision of the existing code. These were the comments (summarized from the soc-2018-dev mail):

  • We confused "Primary Reflection Roughness" with "Undercoat multiplier" (section 4.3 of Chiang's paper).
    • He suggested to rename the first parameter to just "Coat", make it (1 - primary_reflection_roughness) and default to 0.0.
  • We should linearize Melanin concentration into a coefficient in the range 0-1 and adjust the absorption factors accordingly.

And the encountered bugs and quirks:

  • Brecht:
    • The OSL shader is using the longitudinal roughness instead of the azimuthal roughness for the reflectance to absorption mapping.
    • Separate RGB->absorption coefficient conversion into its own function.
    • The Random socket should use SOCK_HIDE_VALUE to make it clear the value is ignored if nothing is connected.
    • In the OSL shader, we should use lower_case_names for local variables, only the parameters should use CamelCase.
    • Before merging, any debug code like printfs, curve_center, and other commented out code should be removed.
    • No need to store a random value in the PrincipledHairBSDF and have it as a parameter in the OSL closure if we are not going to use it.
    • As an optimization, variables needed for only one of the 3 color parameterizations should be computed in the appropriate if/case instead of before. So factor_random_color, pheomelanin, etc. should only be computed for the Melanin parameterization.
    • Update the Direct coloring parametrization to match the default color of the rest.
    • Suggest to rename "Color Randomization" to "Random Color", sounds a little less technical and to the point. Same for "Roughness Randomization".
    • In nodes.h, rename float melanin_concentration to float melanin and float melanin_redness_ratio to float melanin_redness, these should match the socket names.
  • Leo:
    • It turns out that we computed the primary reflection roughness after it was converted to the logistic distribution's parameters, which utterly defeated its purpose.
    • The OSL shader used not only the wrong, but also the unrandomized type of roughness for the reflectance to absorption mapping.

After these fixes were done (commits below), I turned to designing the rest of the manual's charts. The initial versions turned out to be bulky and lacking, so Brecht advised me to use the scenes provided by ChrisWillC from BlenderArtists for better quality; however, he had to adjust them since they OOM'd my desktop. This is the agreed design for the charts:

  • Covered parameters: Melanin, Melanin Redness, Roughness, Radial Roughness, Coat, Random Roughness,Random Color
    • 5 renders per parameter, 256x256
    • 0..1 for everything except (radial) roughness, where it's 0.1..0.9
    • also would prefer dark flat background so the small isolated hairs are visible
    • 16px font size
    • no text since images are not translatable

Of these, I've done all but for the Random ones. I'll also add examples of Tint and Direct coloring, just for the sake of completion.

As previously, once I've finished rendering the new stuff and after them being approved by Brecht, I'll upload the sources to the Phabricator task for merging.

These were the resulting commits in the Blender repository:

  • The usual merging commits from master (rB61912874, rBaedb148e).
    • I'm holding off on the rest of the week's commits until I've finished rendering the charts.
  • Adjusted the upper bounds of Roughness (rB2af5f394).
  • Fixed OSL's reflectance mapping (rB3279ef6c).
  • Hide Random socket's value if unused (rB665c6f83).
  • Remove random value from SVM and OSL's closures (rBdb694830).
  • Adjusted OSL's variable naming to the specified convention (rBc25a9c19).
  • Renamed the melanin variables as specified (rBc7b3abd4).
  • Added the requested brownish default to Direct coloring (rB58d7bc2c).
    • This one was done empirically, I rendered a curl of default (Melanin) brownish hair and selected the best (IMHO) RGB color.
  • Renamed X Randomization to Random X (rB83967579).
  • Reordered variable initialization and usage (rBadcc63fe).
  • Renamed Undercoat Roughness to Coat (rBed27553d).
  • Melanin linearization (rBeb4abf2c, rB370d7f92, rB04428920).
  • Correct Coat calculation to the Roughness value, not the variance (rBd6f39657).
  • Extra cosmetic cleanup (rB5652abe0).

In the GitHub repo:

Next up

  • Finish the Randomization, Tint and Color charts

Questions

None this time!