Skip to content

Add maxcomponent and mincomponent nodes#2909

Merged
jstone-lucasfilm merged 7 commits into
AcademySoftwareFoundation:mainfrom
chinmaychahar:feature/maxcomponent-mincomponent-implementation
May 25, 2026
Merged

Add maxcomponent and mincomponent nodes#2909
jstone-lucasfilm merged 7 commits into
AcademySoftwareFoundation:mainfrom
chinmaychahar:feature/maxcomponent-mincomponent-implementation

Conversation

@chinmaychahar
Copy link
Copy Markdown
Contributor

Summary

Implement maxcomponent and mincomponent nodes using graph definitions, as proposed in #2802.

The specification proposal was merged in #2876

Description

This PR adds node definitions, nodegraph implementations, and test suite entries for maxcomponent and mincomponent. These nodes compute the maximum and minimum component of vectorN and colorN values, outputting a float.

@chinmaychahar
Copy link
Copy Markdown
Contributor Author

chinmaychahar commented May 11, 2026

Hey @jstone-lucasfilm as discussed here, this code change implements both the max and min node components.

This PR's scope is only to implement the nodes and for now no use-cases have been updated.

Lemme know your thoughts! Thanks

Comment thread libraries/stdlib/stdlib_ng.mtlx Outdated
Output the maximum component of the incoming vector or color stream.
-->
<nodegraph name="NG_maxcomponent_color3" nodedef="ND_maxcomponent_color3">
<extract name="N_extract_0" type="float">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You should be able to use separate nodes instead of multiple extracts. This also avoids storing and testing intermediate values in case they become precision sensitive.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@chinmaychahar I think @kwokcb's suggestion above is a good one, and using separateN nodes would be better aligned with existing graph definitions than extract. Does this seem like a reasonable improvement to you as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, let me fix this

</transpose>
<output name="out" type="vector4" nodename="transformvector1" />
</nodegraph>
<nodegraph name="maxcomponent_color3">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For visual testing, I'd suggest to make the max value be the same for all tests. You might also want to add a test where 2 or more components differ only by a very small delta to test precision.

@jstone-lucasfilm
Copy link
Copy Markdown
Member

This looks like a great start, @chinmaychahar, and my one addition to @kwokcb's suggestions above would be to move your specification definition of these nodes from the Proposals document to the Standard Nodes document.

This will allow us to merge the specification and data library changes as a single PR, keeping them in sync.

@chinmaychahar
Copy link
Copy Markdown
Contributor Author

Sure, lemme take a look and address the comments today

@chinmaychahar chinmaychahar force-pushed the feature/maxcomponent-mincomponent-implementation branch from 7315c55 to 70e5820 Compare May 20, 2026 10:03
Signed-off-by: chinmaychahar <chinmay.cc.06@gmail.com>
Signed-off-by: chinmaychahar <chinmay.cc.06@gmail.com>
Signed-off-by: chinmaychahar <chinmay.cc.06@gmail.com>
@chinmaychahar chinmaychahar force-pushed the feature/maxcomponent-mincomponent-implementation branch from 66ea19e to 42f09ad Compare May 20, 2026 10:20
Signed-off-by: Jonathan Stone <jstone@lucasfilm.com>
Signed-off-by: Jonathan Stone <jstone@lucasfilm.com>
Signed-off-by: Jonathan Stone <jstone@lucasfilm.com>
Copy link
Copy Markdown
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 @chinmaychahar!

@jstone-lucasfilm jstone-lucasfilm changed the title Add graph definitions for maxcomponent and mincomponent nodes Add maxcomponent and mincomponent nodes May 25, 2026
@jstone-lucasfilm jstone-lucasfilm merged commit 9b2eb05 into AcademySoftwareFoundation:main May 25, 2026
70 of 71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants