Code improvements + Mix node #30

Merged
Bogdan Nagirniak merged 18 commits from BogdanNagirniak/blender:matx-code-improvements into matx-export-material 2023-09-22 18:23:13 +02:00
Collaborator

Purpose

After last merged PRs some code has to be improved. Implement Mix node.

Technical steps

  1. Improvements in NodeItem:
    • blend() -> mix() + shaders + mix node usage
    • extract() -> operator[]
    • implemented length(), to_vector(), normalize(), rotate(), fixed dotproduct()
    • improvements in math functions.
  2. Implemented node Mix
  3. Improved code in BSDFPrincipled, TexWave, TexGradient, Mapping, VectorRotate.
  4. Code adjustments.
  5. Fixed/added comments.
  6. Changed order of getting shader type in MaterialOutput: SurfaceShader starts first. Adjusted Add, Mix shaders.
### Purpose After last merged PRs some code has to be improved. Implement Mix node. ### Technical steps 1. Improvements in NodeItem: - `blend()` -> `mix()` + shaders + mix node usage - `extract()` -> `operator[]` - implemented `length()`, `to_vector()`, `normalize()`, `rotate()`, fixed `dotproduct()` - improvements in math functions. 2. Implemented node Mix 3. Improved code in BSDFPrincipled, TexWave, TexGradient, Mapping, VectorRotate. 4. Code adjustments. 5. Fixed/added comments. 6. Changed order of getting shader type in MaterialOutput: SurfaceShader starts first. Adjusted Add, Mix shaders.
Bogdan Nagirniak added 9 commits 2023-09-21 22:45:30 +02:00
Bogdan Nagirniak changed title from matx-code-improvements to Code improvements + Mix node 2023-09-21 22:46:04 +02:00
Bogdan Nagirniak requested review from Brian Savery (AMD) 2023-09-21 22:46:11 +02:00
Bogdan Nagirniak requested review from Vasyl Pidhirskyi 2023-09-21 22:46:11 +02:00
Georgiy Markelov was assigned by Bogdan Nagirniak 2023-09-21 22:46:29 +02:00
Bogdan Nagirniak self-assigned this 2023-09-21 22:46:29 +02:00
Bogdan Nagirniak added 2 commits 2023-09-22 12:09:49 +02:00
Bogdan Nagirniak added 1 commit 2023-09-22 12:27:52 +02:00
Bogdan Nagirniak added 1 commit 2023-09-22 13:07:50 +02:00
Bogdan Nagirniak added 2 commits 2023-09-22 14:04:02 +02:00
Bogdan Nagirniak added 1 commit 2023-09-22 14:13:12 +02:00
Vasyl Pidhirskyi reviewed 2023-09-22 15:22:50 +02:00
@ -231,0 +219,4 @@
bool invert = node_->custom2;
NodeItem vector = get_input_value("Vector", NodeItem::Type::Vector3);
NodeItem center = get_input_value("Center", NodeItem::Type::Vector3);
Collaborator

To perform the same result as Blender it requires invert Z.
NodeItem center = get_input_value("Center", NodeItem::Type::Vector3) * val(MaterialX::Vector3(1.0f, 1.0f, -1.0f))

To perform the same result as Blender it requires invert Z. `NodeItem center = get_input_value("Center", NodeItem::Type::Vector3) * val(MaterialX::Vector3(1.0f, 1.0f, -1.0f))`
BogdanNagirniak marked this conversation as resolved
Vasyl Pidhirskyi requested changes 2023-09-22 16:13:49 +02:00
@ -242,2 +289,2 @@
other, "dotproduct", [](float a, float b) { return a * b; }, Type::Float);
if (d.value) {
if (value && other.value) {
NodeItem d = *this * other;
Collaborator

Please take a look at code below
To fix dotproduct for values use d.value->asA<MaterialX::... instead value->asA<MaterialX::....

Please take a look at code below To fix `dotproduct` for values use `d.value->asA<MaterialX::...` instead `value->asA<MaterialX::...`.
BogdanNagirniak marked this conversation as resolved
Georgiy Markelov approved these changes 2023-09-22 17:47:55 +02:00
Georgiy Markelov left a comment
Owner

Works fine.

Works fine.
Bogdan Nagirniak added 1 commit 2023-09-22 17:50:01 +02:00
Bogdan Nagirniak added 1 commit 2023-09-22 18:16:12 +02:00
Vasyl Pidhirskyi approved these changes 2023-09-22 18:17:55 +02:00
Vasyl Pidhirskyi left a comment
Collaborator

Works as expected.

Works as expected.
Bogdan Nagirniak merged commit 483728b704 into matx-export-material 2023-09-22 18:23:13 +02:00
Sign in to join this conversation.
No Label
No Milestone
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: DagerD/blender#30
No description provided.