Export to MatX various Texture nodes #5

Merged
Bogdan Nagirniak merged 17 commits from matx-add-tex-nodes into matx-export-material 2023-08-31 19:49:26 +02:00

Purpose

Add support for various Texture nodes.

Technical steps

Added support for:

  • Checker Texture. For HdRPR material isn't rendered in Blender, but MaterialX viewer renders it fine, so problem is on render delegates side.
  • Environment Texture. Projection property is not supported for now.
  • Noise Texture. For HdRPR material is without colors (black and white).
  • Changed signature of NodeParser::create_node
  • Added macros DECLARE_PARSER_OVERRIDE

Note for reviewers

Principled BSDF has warning in console for HdRPR, but validating doc on Blender side gives correct input without issues:

Warning: in HdMtlxCreateMtlxDocumentFromHdNetwork_Fixed at line 425 of C:\GPUOpen\BlenderUSDHydraAddon\deps\RadeonProRenderUSD\pxr\imaging\rprUsd\hdMtlxFixed.cpp -- Validation warnings for generated MaterialX file.
Node interface error: Input 'octaves' doesn't match declaration: <fractal3d name="N_fractal3d" type="float">
Node interface error: Input 'octaves' doesn't match declaration: <fractal3d name="N_fractal3d" type="float">

Checker Texture has warning in console for HdRPR (and MatX viewer also), but I didn't any differences with standard implementation of checkerboard in MaterialX.

Node interface error: Input 'in1' doesn't match declaration: <modulo name="node7" type="float">
Node interface error: Input 'in1' doesn't match declaration: <modulo name="node9" type="float">
### Purpose Add support for various Texture nodes. ### Technical steps Added support for: * Checker Texture. For HdRPR material isn't rendered in Blender, but MaterialX viewer renders it fine, so problem is on render delegates side. * Environment Texture. `Projection` property is not supported for now. * Noise Texture. For HdRPR material is without colors (black and white). * Changed signature of `NodeParser::create_node` * Added macros `DECLARE_PARSER_OVERRIDE` ### Note for reviewers Principled BSDF has warning in console for HdRPR, but validating `doc` on Blender side gives correct input without issues: ``` Warning: in HdMtlxCreateMtlxDocumentFromHdNetwork_Fixed at line 425 of C:\GPUOpen\BlenderUSDHydraAddon\deps\RadeonProRenderUSD\pxr\imaging\rprUsd\hdMtlxFixed.cpp -- Validation warnings for generated MaterialX file. Node interface error: Input 'octaves' doesn't match declaration: <fractal3d name="N_fractal3d" type="float"> Node interface error: Input 'octaves' doesn't match declaration: <fractal3d name="N_fractal3d" type="float"> ``` Checker Texture has warning in console for HdRPR (and MatX viewer also), but I didn't any differences with standard implementation of `checkerboard` in MaterialX. ``` Node interface error: Input 'in1' doesn't match declaration: <modulo name="node7" type="float"> Node interface error: Input 'in1' doesn't match declaration: <modulo name="node9" type="float"> ```
Georgiy Markelov added 10 commits 2023-08-30 18:48:21 +02:00
Georgiy Markelov requested review from Brian Savery (AMD) 2023-08-30 18:53:53 +02:00
Georgiy Markelov requested review from Bogdan Nagirniak 2023-08-30 18:53:53 +02:00
Georgiy Markelov requested review from Vasyl Pidhirskyi 2023-08-30 18:53:53 +02:00
Bogdan Nagirniak requested changes 2023-08-31 10:23:24 +02:00
@ -353,0 +359,4 @@
int v = socket.default_value_typed<bNodeSocketValueFloat>()->value;
res.value = MaterialX::Value::createValue<int>(v);
return res;
}
Collaborator

Override get_input_default in SH_NODE_TEX_NOISE and move this code there.

Override `get_input_default` in SH_NODE_TEX_NOISE and move this code there.
DagerD marked this conversation as resolved
@ -353,0 +366,4 @@
float v = socket.default_value_typed<bNodeSocketValueFloat>()->value;
res.value = MaterialX::Value::createValue<MaterialX::Vector2>({v, v});
return res;
}
Collaborator

Same here

Same here
DagerD marked this conversation as resolved
@ -0,0 +10,4 @@
NodeItem TexCheckerNodeParser::compute()
{
NodeItem texcoord = create_node("texcoord", "vector2", true);
Collaborator

change create_node() signature accessory->noname = true

change create_node() signature accessory->noname = true
DagerD marked this conversation as resolved
@ -0,0 +66,4 @@
NodeItem color2 = get_input_value("Color2");
res.set_input("fg", color1.to_color3());
res.set_input("bg", color2.to_color3());
res.set_input("mix", ifequal);
Collaborator

Rewrite this using new math functions

Rewrite this using new math functions
DagerD marked this conversation as resolved
@ -0,0 +14,4 @@
NodeItem scale = get_input_value("Scale");
NodeItem position = texcoord * scale;
NodeItem detail = get_input_value("Detail");
NodeItem lacunarity = get_input_value("Lacunarity");
Collaborator

Use following order:

  1. get_input_...()
  2. operations: math, new nodes
  3. creating result node.
  NodeItem detail = get_input_value("Detail");
  NodeItem lacunarity = get_input_value("Lacunarity");
  NodeItem scale = get_input_value("Scale");

  NodeItem texcoord = create_node("position", "vector3", true);
  NodeItem position = texcoord * scale;
Use following order: 1. get_input_...() 2. operations: math, new nodes 3. creating result node. ``` NodeItem detail = get_input_value("Detail"); NodeItem lacunarity = get_input_value("Lacunarity"); NodeItem scale = get_input_value("Scale"); NodeItem texcoord = create_node("position", "vector3", true); NodeItem position = texcoord * scale; ```
DagerD marked this conversation as resolved
Georgiy Markelov added 5 commits 2023-08-31 17:32:01 +02:00
Georgiy Markelov requested review from Bogdan Nagirniak 2023-08-31 17:34:22 +02:00
Bogdan Nagirniak added 2 commits 2023-08-31 19:42:32 +02:00
Bogdan Nagirniak approved these changes 2023-08-31 19:44:37 +02:00
Bogdan Nagirniak left a comment
Collaborator

Made code improvements, tested - works good

Made code improvements, tested - works good
Bogdan Nagirniak merged commit 4dfb0c5857 into matx-export-material 2023-08-31 19:49:26 +02:00
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 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#5
No description provided.