Fix: Black noise texture results with MaterialX export

Clamp octaves to be at least 1 to avoid having no noise at all, and clamp
the maximum to avoid precision issues and NaNs on some GPUs.

Blocklist white noise 256 samples tests entirely for Storm, as we don't
support multiple samples and can't test converting to grey. Increase the
grid size in the 1 sample white noise test to make it more clear.

Pull Request: https://projects.blender.org/blender/blender/pulls/148525
This commit is contained in:
Brecht Van Lommel 2025-10-27 13:11:04 +01:00 • committed by Brecht Van Lommel
parent 153bae5015
commit ca18fdc7e5
30 changed files with 62 additions and 71 deletions

View file

@ -439,16 +439,16 @@ NODE_SHADER_MATERIALX_BEGIN
NodeItem scale = get_input_value("Scale", NodeItem::Type::Float);
NodeItem detail = get_input_default("Detail", NodeItem::Type::Float);
NodeItem lacunarity = get_input_value("Lacunarity", NodeItem::Type::Float);
/* Empirically, higher octaves lead to NaNs on e.g. Metal and NVIDIA. */
const int octaves = int(math::clamp(detail.value->asA<float>(), 1.0f, 13.0f));
NodeItem position = create_node("position", NodeItem::Type::Vector3);
position = position * scale;
return create_node("fractal3d",
STREQ(socket_out_->identifier, "Fac") ? NodeItem::Type::Float :
NodeItem::Type::Color3,
{{"position", position},
{"octaves", val(int(detail.value->asA<float>()))},
{"lacunarity", lacunarity}});
return create_node(
"fractal3d",
STREQ(socket_out_->identifier, "Fac") ? NodeItem::Type::Float : NodeItem::Type::Color3,
{{"position", position}, {"octaves", val(octaves)}, {"lacunarity", lacunarity}});
}
#endif
NODE_SHADER_MATERIALX_END

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dfebf6e15a866ad68f568dd2b311d26ba72264932ade485209b62eb3ce383a07
size 3181
oid sha256:9e7b09e441962ff0191c0a185a1ad66e5d8f1ef9a8ce37f28f529c768e225c03
size 3163

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c1002034f40f22b6242b947a5d9b3af189046cfa4ce61b72c85d5947d9df89f6
size 3181
oid sha256:d6e1a7a4706022100c1a64a9e9a596494e23cc3af8d0c83828ed1130ac1798c8
size 3163

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:452d1f51b978b401860dca3f24563d72f2a5b8ced0d8e35eac008b6bed047ef6
size 41077
oid sha256:e425d8e1a3da71fca550f301e8d91104d44061ed593172259a5165fc8e91e686
size 40292

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5101a1b734365ea379a534a8e66bb3baeec5f1b14823729ffac73b7735a3c115
size 39863
oid sha256:72afcae33c52e95215d295fa96f4f5b171588d2925a6c5c7c633a62f18409042
size 39570

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8fde6d6604c3814129aba0f226f4a06f5c20a81d7f113bfd2d411ba93c40c777
size 41077
oid sha256:c1c129637556e42132a6139c113b7f71cde8d7038aa6becc2f390b0b7018a27c
size 40292

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1c6823a31e9bf72613c3f727a99456e6e226402d06e0a435f8f20f28cbcdb12e
size 39863
oid sha256:d9d349ed8c7bc1c7248d7ac545ce30d797e5f590f857e30a2f29c037dd46667f
size 39570

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a82e8127c02ef04c9b11ff456437f292403e43c8f21591c9ff49e8a69cd11643
size 28858
oid sha256:8365cfe40b24c2f9e24ab168cc9c5d8c8ffd707a46e342938d98db1b1d2938eb
size 21396

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6f8edb618b490ea1149fa07f532a0ed5cf844ca79214b9c5d7ae2cacd1cfef22
size 31189
oid sha256:37574e02faf06cfeff05b4347196f59795aba835c46c7e83e3a7aa02c52bbe2e
size 28990

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:faacbff0a81dd889c8d9a195c404943330dcf802dc85cd3a61857c92e30851de
size 104440
oid sha256:c731c4649d67a87988186b02240bd70a5befa3697385f8c42e0a1bc7f2b535bc
size 126838

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0a82ea178b8b1b479ae22292e3ab84d75ff9c128a43dc3a31fffdabe6b79a35b
size 18124
oid sha256:45f5a351a8380f7d9480f810c023643b4821336fb0f86bd34e28084457a739eb
size 16941

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3eac8bb6be76af28fced88a69a2a353cf9beb1fe64a695dcd43a7f36b30e9fe0
size 18540
oid sha256:a2d4a51d7d2c89bc1a22d44190d02f5205bca7e4ddf3f0116bfb197575ea3fe0
size 17483

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:078ba18e96ba7048760e8efc3d5dd3388caf54792d61a4628b3b8767824280e3
size 17108
oid sha256:8b6ffa201f22b60e46e2bc6f26d9a85d85973b4f2f6f6b256b9891184aded1c8
size 16470

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d4fdbff648a84ff7786dfcf6065cda9c8a69864e6183a3685ce550d407c20d4b
size 22554
oid sha256:1b6553317529160035b9fef2d4168c08e7fb0672c6215b4578161b3203be89a7
size 22341

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1a2ea89ed0f87f22a017cf68d37093e3921583998742ae46df05e42aeea77e9c
size 17108
oid sha256:9ee85bb6a3bafb9beef00f343aaf0fdf50cd97ef6321666cf4bfb4a73e178857
size 16470

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a42d754f609bb164502fe3652d97e41e042d004e196a0ebc7c75bbd078bca85d
size 30364
oid sha256:6ea36334d242ad663d7a8ef10b0245bec27d0a5dbb63dfd49c841b14100a26e1
size 27503

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e1f71377aa38be921aef261a5de67a8c078e123adfaa706ea1fd3b57668b9713
size 29425
oid sha256:1aeed35173ea64f2d0a0fc0eb0c04122f22f62001fe14cd17441d3239d104c00
size 28521

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b7d0547309f029839eb4dc659b4721346f8efa647ec0129bd742f5963d782cea
size 27934
oid sha256:55c21e3eabc11bcfdeec4b8d90e4a05d6dc8ca04a68708b3e3ffc3e79dfc3907
size 20150

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d3a0707cfb2c1810c2b163cdf4f4e1f2be828a46798676ecf37086629a599de4
size 34725

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1269f6e9f6b81750a8e82d95e6c5f5c3384e1bb92a1099ecd5da864ecaed7216
size 18124
oid sha256:cb8d79de9e84ef760a71707b88f87ceda441d4216b1989821a72e3cbaf996ab2
size 16941

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1eda6fc7e0c834a00af58565963d8a5feadcb7d863656dc982b17b87aec0497b
size 18540
oid sha256:a5b3dbba05d58b1567b70a6e2b93fadd7453ef3d644fca674f16260659e8ae10
size 17483

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8004c923c04b3652e01138354cb629bd2720dc66e640bfd53cc9917ae767fbc2
size 17108
oid sha256:a344e2b0067c7ede4cf8d1f07b0bb97b2470d31e3d25e47a5615c96c6f8f9176
size 16470

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9197fa961bc64b9e10e4371d8746c08ef877e33e3096994f55efeda07ab21d4c
size 22554
oid sha256:7e7cbe297c141b4c28db4c176ef2fc72c3c3e66e976ffc33a227ce8aeef07ef0
size 22341

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1731d03f66f67288bd1950cc4c95a53729a5f037fa47de3f91d53815a680013f
size 17108
oid sha256:afd92ee3b02f81cb9b06dcf6fd96c2b0ad521c1fbc9d0bf7647f9ef9cbb39d85
size 16470

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ab831543d742a96199f11c284900e62c3ebefc2181290006c227e29f886a7994
size 30364
oid sha256:f156919e95e9289f1f6f42f96beb9cef314122d9bd946d31b48db3d4e4dc082b
size 27503

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d3643572a7588c3db6f575ff51745c799eda29c1af8c749d6aff3f9e1d8a73be
size 29425
oid sha256:bb9811cbf8c5e33ca16ca087b087b218a707a05ae7ec7a12be6622ca954f1fc5
size 28521

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cb419bdf949fbcaf615a8cce6cfa0f57aaae94c2b4a816b3ee9e94ed6deb098d
size 27934
oid sha256:0df28fa0efad61a894d80b2d96feb528191dec15436a718f5488573b1ca5f71a
size 20150

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:87b9595b6dcf8a685a5d44a21d524ebbbeb3a30cc8db1f47678ae532e3e1b71e
size 34725

4
tests/files/render/texture/white_noise_1spp.blend Executable file → Normal file
View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5ac37d2a69b21561fc0a4c3a17a05cc3ed5aa62a472f0282a5d2f7d333a39a61
size 116725
oid sha256:d3c5f00c5e99aac96fc9fa0f362c4d3632160bf4f9a72a72067d86bee22af984
size 130189

View file

@ -17,6 +17,8 @@ BLOCKLIST_HYDRA = [
"image.blend",
# VDB rendering is incorrect on Metal
"overlapping_octrees.blend",
# No number of sample support, so will not converge to gray as expected
"white_noise_256spp.blend",
]
BLOCKLIST_USD = [
@ -27,6 +29,8 @@ BLOCKLIST_USD = [
"light_tree_node_subtended_angle.blend",
# VDB rendering is incorrect on Metal
"overlapping_octrees.blend",
# No number of sample support, so will not converge to gray as expected
"white_noise_256spp.blend",
]
# Metal support in Storm is no as good as OpenGL, though this needs to be
@ -54,15 +58,11 @@ BLOCKLIST_METAL = [
"openvdb.*.blend",
"principled_bsdf_interior",
# Other
"white_noise.*.blend",
"musgrave_multifractal.*.blend",
"autosmooth_custom_normals.blend",
]
# AMD seems to have similar limitations as Metal for transparency.
BLOCKLIST_AMD = BLOCKLIST_METAL + [
"musgrave_.*_multifractal.*.blend",
"noise_lacunarity.blend",
]
# Minor difference in texture coordinate for white noise hash.
@ -71,9 +71,6 @@ BLOCKLIST_INTEL = [
"hair_transmission.blend",
"principled_bsdf_emission.blend",
"principled_bsdf_sheen.blend",
"musgrave_.*_multifractal.*.blend",
"noise_lacunarity.blend",
"white_noise.*.blend",
]