Skip to content

Commit 07de3ef

Browse files
authored
Add UDIM example and fix handling in Graph Editor (#2113)
Hoping to address #2007 - and also have some data to test while working on improving UDIM support in MaterialX. Once I modified the textures it became clear that loading this in to MaterialXGraphEditor didn't actually load the correct images in to the correct materials. They would all end up using the fallback material, so this PR includes a small fix to address that.
1 parent 6e89763 commit 07de3ef

9 files changed

Lines changed: 65 additions & 9 deletions

File tree

resources/Geometry/cube.obj

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# This file uses centimeters as units for non-parametric coordinates.
2+
g
3+
v -0.500000 -0.500000 0.500000
4+
v 0.500000 -0.500000 0.500000
5+
v -0.500000 0.500000 0.500000
6+
v 0.500000 0.500000 0.500000
7+
v -0.500000 0.500000 -0.500000
8+
v 0.500000 0.500000 -0.500000
9+
v -0.500000 -0.500000 -0.500000
10+
v 0.500000 -0.500000 -0.500000
11+
vt 0.99 0.01
12+
vt 0.99 1.01
13+
vt 1.01 0.01
14+
vt 2.01 0.99
15+
vt 2.01 1.01
16+
vt 1.99 0.99
17+
vt 1.01 1.01
18+
vt 2.99 2.01
19+
vt 1.01 1.99
20+
vt 1.99 1.99
21+
vt 2.99 0.01
22+
vt 2.99 0.99
23+
vt 0.01 0.01
24+
vt 0.01 0.99
25+
vt 2.01 0.01
26+
vt 0.99 1.99
27+
vt 1.99 0.01
28+
vt 0.01 1.01
29+
vt 0.01 1.99
30+
vt 0.99 0.99
31+
vt 2.01 2.01
32+
vt 1.99 1.01
33+
vt 1.01 0.99
34+
vt 2.99 1.
35+
g
36+
f 1/18 2/2 4/16 3/19
37+
f 3/3 4/17 6/6 5/23
38+
f 5/5 6/24 8/8 7/21
39+
f 7/7 8/22 2/10 1/9
40+
f 2/15 8/11 6/12 4/4
41+
f 7/13 1/1 3/20 5/14
101 KB
Loading
101 KB
Loading
100 KB
Loading
101 KB
Loading
101 KB
Loading
100 KB
Loading
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0"?>
2+
<materialx version="1.38">
3+
<image name="image_color" type="color3">
4+
<input name="file" type="filename" value="resources/Images/grid_udim/grid.<UDIM>.png" colorspace="srgb_texture" />
5+
</image>
6+
<geominfo name="cube_geom" geom="/">
7+
<geomprop name="udimset" type="stringarray" value="1001, 1002, 1003, 1011, 1012, 1013" />
8+
</geominfo>
9+
<standard_surface name="cube_shader" type="surfaceshader">
10+
<input name="base_color" type="color3" nodename="image_color" />
11+
</standard_surface>
12+
<surfacematerial name="cube_material" type="material">
13+
<input name="surfaceshader" type="surfaceshader" nodename="cube_shader" />
14+
</surfacematerial>
15+
</materialx>

source/MaterialXGraphEditor/RenderView.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -403,15 +403,6 @@ void RenderView::updateMaterials(mx::TypedElementPtr typedElem)
403403
// Check for any udim set.
404404
mx::ValuePtr udimSetValue = _document->getGeomPropValue(mx::UDIM_SET_PROPERTY);
405405

406-
// Skip material nodes without upstream shaders.
407-
mx::NodePtr node = typedElem ? typedElem->asA<mx::Node>() : nullptr;
408-
if (node &&
409-
node->getCategory() == mx::SURFACE_MATERIAL_NODE_STRING &&
410-
mx::getShaderNodes(node).empty())
411-
{
412-
typedElem = nullptr;
413-
}
414-
415406
// Create new materials.
416407
if (!typedElem)
417408
{
@@ -422,6 +413,15 @@ void RenderView::updateMaterials(mx::TypedElementPtr typedElem)
422413
}
423414
}
424415

416+
// Skip material nodes without upstream shaders.
417+
mx::NodePtr node = typedElem ? typedElem->asA<mx::Node>() : nullptr;
418+
if (node &&
419+
node->getCategory() == mx::SURFACE_MATERIAL_NODE_STRING &&
420+
mx::getShaderNodes(node).empty())
421+
{
422+
typedElem = nullptr;
423+
}
424+
425425
mx::TypedElementPtr udimElement = nullptr;
426426
mx::NodePtr materialNode = nullptr;
427427
if (typedElem)

0 commit comments

Comments
 (0)