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

MaterialXLoader: added invert implementation #29433

Merged
merged 2 commits into from
Sep 19, 2024

Conversation

beersandrew
Copy link
Contributor

  • allow invert to be a number, vec 2|3|4, or color, subtracting the value from an optionally inputted amount field (which is defaulted to all parts 1 of the input type)

Related issue: #29432

Description

Implemented the invert node for the MaterialXLoader

This contribution is funded by Needle

- allow invert to be a number, vec 2|3|4, or color, subtracting the value from an optionally inputted amount field (which is defaulted to all parts 1 of the input type)
@mrdoob mrdoob added this to the r169 milestone Sep 19, 2024
@mrdoob mrdoob requested a review from sunag September 19, 2024 05:57
@sunag
Copy link
Collaborator

sunag commented Sep 19, 2024

The implementation of #29440 should be simple, in case you want to implement this PR?

const extract_x = ( in1 ) => in1.x;

The index parameter seems redundant here based on the function name...

@beersandrew
Copy link
Contributor Author

The implementation of #29440 should be simple, in case you want to implement this PR?

const extract_x = ( in1 ) => in1.x;

The index parameter seems redundant here based on the function name...

I think it's needed, here the name is only an identifier with extract being the node name(https://github.com/beersandrew/MaterialX/blob/separateNodeExample/resources/Materials/Examples/StandardSurface/extract.mtlx#L8)

not sure if this works? but this is the route i'll try (should work for colorN & vectorN)

const extract = ( in1, index ) => in1[index];

- simplified invert function
- removed unneeded imports
- moved invert to math nodes
@sunag
Copy link
Collaborator

sunag commented Sep 19, 2024

I think it's better to use element in this case, with [ index ] the input values ​​should be just integer js numbers not nodes.

const extract = ( in1, index ) => in1.element( index );

@sunag sunag merged commit 16dacde into mrdoob:dev Sep 19, 2024
11 checks passed
@sunag sunag changed the title feat: added invert implementation MaterialXLoader: added invert implementation Sep 19, 2024
LD2Studio pushed a commit to LD2Studio/LD2Studio-Editor that referenced this pull request Sep 20, 2024
* feat: added invert implementation

- allow invert to be a number, vec 2|3|4, or color, subtracting the value from an optionally inputted amount field (which is defaulted to all parts 1 of the input type)

* feat: update invert

- simplified invert function
- removed unneeded imports
- moved invert to math nodes
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.

3 participants