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 a 2d checkerboard pattern node #1328

Merged

Conversation

crydalch
Copy link
Contributor

Add a 2d checkerboard pattern node.

checkers2d

Add a 2d checkerboard pattern node.
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.

Thanks for this proposal, @crydalch, and it seems like a very natural node to include in MaterialX. I had just one suggestion below on the name of the node.

libraries/stdlib/stdlib_defs.mtlx Outdated Show resolved Hide resolved
Node: <checkerboard>
A 2D checkerboard pattern.
-->
<nodedef name="ND_checkerboard_float" node="checkerboard" nodegroup="procedural2d">
Copy link
Member

Choose a reason for hiding this comment

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

@crydalch The design of this node seems very reasonable to me, though it seems worthwhile to consider the idea of returning a color3 value instead of a float, with the two colors of the checkerboard specified as color1 and color2 inputs (defaulting to white and black).

I don't have a strong opinion on which design is better for MaterialX, but for reference here are a few examples of checkerboard nodes that use the color1/color2 approach:

https://docs.unity3d.com/Packages/com.unity.shadergraph@6.9/manual/Checkerboard-Node.html
https://learn.foundry.com/mari/Content/reference_guide/nodes/Checkerboard.html
https://help.autodesk.com/view/ARNOL/ENU/?guid=arnold_user_guide_ac_texture_shaders_ac_texture_checkerboard_html

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to cover a reasonable "maximum" possible flexibility (which seems to be Arnold) and anything that supports less can restrict what inputs are modifiable / exposed. e.g. frequency in u and v allows for "stripe" textures to be created. A "customized" version of this would sync u and v values. Does this sound reasonable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like this idea @jstone-lucasfilm

An early version of the node did have color inputs/outputs, but I don't recall why I went away from that... but regardless, I'll make that change. Thank you for the suggestion and references.

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 good to me, thanks @crydalch! Before we merge this to main, what are your thoughts on the proposed interface for this node, @dbsmythe?

@dbsmythe
Copy link
Contributor

The color1/color2 output approach and parameterization looks good to me. Just thinking aloud, I am wondering if there is any use for the originally-proposed "float" output variant, which would output exactly a 0 or a 1, which the color1/color2 variant would call? I'm generally a fan of breaking larger more full-featured nodes into atomic pieces when some of the sub-pieces could be useful outside the full-featured node, and it feels to me like the "generate a checkerboard pattern" portion could fall into that category. But if the only reasonable use of a 0/1 float output checkerboard would be to drive the color1/color2 color type node, then this is fine as-is.

@jstone-lucasfilm
Copy link
Member

@dbsmythe Looking at similar nodes in DCC tools, my thinking is that the current color-based approach is the most general-purpose, and artists can extract a single channel from the output color when they need scalar results.

Here are some of the DCC examples that we were looking at earlier in the thread:

https://docs.unity3d.com/Packages/com.unity.shadergraph@6.9/manual/Checkerboard-Node.html
https://learn.foundry.com/mari/Content/reference_guide/nodes/Checkerboard.html
https://help.autodesk.com/view/ARNOL/ENU/?guid=arnold_user_guide_ac_texture_shaders_ac_texture_checkerboard_html

@jstone-lucasfilm jstone-lucasfilm merged commit 75fb20a into AcademySoftwareFoundation:main May 18, 2023
13 checks passed
Michaelredaa pushed a commit to Michaelredaa/MaterialX that referenced this pull request Oct 21, 2023
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.

None yet

4 participants