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

Enhance Worley noise with solid cells option #2119

Merged

Conversation

crydalch
Copy link
Contributor

worley3d_float

Adds a new control to worley2d and worley3d, which allows artists to choose between a distance for each cell (the default) and solid values for each cell. This allows for more patterns to be expressed in materials (i.e. flakes).

worley_solid_worley_voronoi_demo.mp4

Here is an example document, which can be opened with MaterialXGraphEditor --material test_worley_styles_openpbr.mtlx:

Click to see 'test_worley_styles_openpbr.mtlx'
<materialx version="1.39" colorspace="lin_rec709">
  <surfacematerial name="TestNewWorley_3D" type="material" xpos="17.804348" ypos="0.077586">
    <input name="surfaceshader" type="surfaceshader" nodename="open_pbr_surface_surfaceshader" />
  </surfacematerial>
  <worleynoise2d name="worleynoise2d_float" type="float" xpos="3.673913" ypos="-5.094828">
    <input name="texcoord" type="vector2" nodename="multiply_vector2FA" />
    <input name="jitter" type="float" nodename="change_jitter" />
    <input name="style" type="integer" nodename="change_styles" />
  </worleynoise2d>
  <mix name="mix_color3" type="color3" xpos="5.304348" ypos="-4.931035">
    <input name="mix" type="float" nodename="worleynoise2d_float" />
    <input name="fg" type="color3" value="1, 1, 1" />
    <input name="bg" type="color3" value="0, 0, 0" />
  </mix>
  <multiply name="multiply_vector2FA" type="vector2" xpos="-0.144928" ypos="0.422414">
    <input name="in1" type="vector2" nodename="texcoord_vector2" />
    <input name="in2" type="float" value="25" />
  </multiply>
  <texcoord name="texcoord_vector2" type="vector2" xpos="-1.782609" ypos="0.620690" />
  <switch name="switch_color3" type="color3" xpos="10.615942" ypos="-0.724138">
    <input name="in1" type="color3" nodename="mix_color3" />
    <input name="in2" type="color3" nodename="convert_vector2_color3" />
    <input name="in3" type="color3" nodename="convert_vector3_color3" />
    <input name="which" type="float" value="5" />
    <input name="in4" type="color3" nodename="mix_color4" />
    <input name="in5" type="color3" nodename="convert_vector2_color4" />
    <input name="in6" type="color3" nodename="convert_vector3_color4" />
  </switch>
  <worleynoise2d name="worleynoise2d_vector2" type="vector2" xpos="2.789855" ypos="-0.931035">
    <input name="jitter" type="float" nodename="change_jitter" />
    <input name="style" type="integer" nodename="change_styles" />
    <input name="texcoord" type="vector2" nodename="multiply_vector2FA" />
  </worleynoise2d>
  <convert name="convert_vector2_color3" type="color3" xpos="4.840580" ypos="-0.482759">
    <input name="in" type="vector2" nodename="worleynoise2d_vector2" />
  </convert>
  <worleynoise2d name="worleynoise2d_vector3" type="vector3" xpos="2.789855" ypos="1.758621">
    <input name="texcoord" type="vector2" nodename="multiply_vector2FA" />
    <input name="style" type="integer" nodename="change_styles" />
    <input name="jitter" type="float" nodename="change_jitter" />
  </worleynoise2d>
  <convert name="convert_vector3_color3" type="color3" xpos="4.840580" ypos="1.758621">
    <input name="in" type="vector3" nodename="worleynoise2d_vector3" />
  </convert>
  <constant name="change_styles" type="integer" xpos="-0.398551" ypos="-3.206897">
    <input name="value" type="integer" value="1" />
  </constant>
  <constant name="change_jitter" type="float" xpos="-0.376812" ypos="-4.344828">
    <input name="value" type="float" value="0.625" />
  </constant>
  <position name="position_vector3" type="vector3" xpos="-2.463768" ypos="4.896552" />
  <multiply name="multiply_vector3FA" type="vector3" xpos="-0.072464" ypos="5.215517">
    <input name="in1" type="vector3" nodename="position_vector3" />
    <input name="in2" type="float" value="4" />
  </multiply>
  <worleynoise3d name="worleynoise3d_float" type="float" xpos="2.891304" ypos="4.387931">
    <input name="jitter" type="float" nodename="change_jitter" />
    <input name="position" type="vector3" nodename="multiply_vector3FA" />
    <input name="style" type="integer" nodename="change_styles" />
  </worleynoise3d>
  <worleynoise3d name="worleynoise3d_vector2" type="vector2" xpos="2.789855" ypos="6.008621">
    <input name="position" type="vector3" nodename="multiply_vector3FA" />
    <input name="jitter" type="float" nodename="change_jitter" />
    <input name="style" type="integer" nodename="change_styles" />
  </worleynoise3d>
  <convert name="convert_vector2_color4" type="color3" xpos="4.840580" ypos="6.284483">
    <input name="in" type="vector2" nodename="worleynoise3d_vector2" />
  </convert>
  <mix name="mix_color4" type="color3" xpos="5.086957" ypos="4.146552">
    <input name="mix" type="float" nodename="worleynoise3d_float" />
    <input name="fg" type="color3" value="1, 1, 1" />
    <input name="bg" type="color3" value="0, 0, 0" />
  </mix>
  <worleynoise3d name="worleynoise3d_vector3" type="vector3" xpos="2.746377" ypos="7.698276">
    <input name="position" type="vector3" nodename="multiply_vector3FA" />
    <input name="jitter" type="float" nodename="change_jitter" />
    <input name="style" type="integer" nodename="change_styles" />
  </worleynoise3d>
  <convert name="convert_vector3_color4" type="color3" xpos="4.724638" ypos="7.931035">
    <input name="in" type="vector3" nodename="worleynoise3d_vector3" />
  </convert>
  <open_pbr_surface name="open_pbr_surface_surfaceshader" type="surfaceshader" xpos="14.231884" ypos="0.387931">
    <input name="base_color" type="color3" nodename="switch_color3" />
  </open_pbr_surface>
</materialx>```

</details>

@crydalch
Copy link
Contributor Author

crydalch commented Nov 21, 2024

I have no idea why one (and only one) of the MacOS builds fails...

Maybe it was just a machine issue, looks to be good now! :)

@crydalch
Copy link
Contributor Author

@jstone-lucasfilm there hasn't been any input on this so far (other than some approving thumbs-up on Slack). Do you feel this change could make it for 1.39.2?

@jstone-lucasfilm
Copy link
Member

@crydalch I really like the content of this change, though I wonder if it might be best to merge it near the beginning of MaterialX v1.39.3 development, giving teams sufficient time to follow up with OSL and MDL implementations and visual validation across languages.

@crydalch
Copy link
Contributor Author

@jstone-lucasfilm is not having the OSL/MDL implementations your main concern?

Our hesitation around 1.39.3 is it would not be released until late Spring/early Summer; our goal is for this contribution and PR #2092 make it into the release used for USD 25.02 (or at least in a compatible MaterialX release that arrives around that same time). If 1.39.2 waits to be released until everyone's back from holiday, perhaps that January window would allow for enough time to include these?

@jstone-lucasfilm
Copy link
Member

@crydalch I think you're right that January is the most likely time frame for v1.39.2, and it seems plausible that we could wrap up this proposal by then. Let's highlight this at our next TSC meeting, and see if anyone has objections to moving forward with this feature.

@jstone-lucasfilm
Copy link
Member

This looks reasonable to me, and I'm CCing @code-monkey and @dbsmythe for their thoughts on the implementation and interface changes proposed here.

@jstone-lucasfilm jstone-lucasfilm changed the title Enhance worley noise with solid cells option. Enhance Worley noise with solid cells option Dec 14, 2024
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 like a really valuable contribution, thanks @crydalch!

@jstone-lucasfilm jstone-lucasfilm merged commit e5a9e35 into AcademySoftwareFoundation:main Dec 14, 2024
34 checks passed
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