Nodes: Speedup Voronoi by changing the hash function

The 2D->2D, 3D->3D, 4D->4D hash functions used in Voronoi node were
using quite an expensive hash function. Switch these to dedicated
2D/3D/4D hash functions (pcg2d, pcg3d, pcg4d) -- these are still very
good quality, but the hash function itself is 3x-4x faster.
Which makes Voronoi node calculation overall be around 2x faster. In
some cases when using OSL, the speedup is even larger.

This visibly changes output of the Voronoi noise however. The actual
noise "behaves" the same, just if someone was depending on the noise
pattern being exactly like it was before, this will change the pattern.

Images, more performance results and details wrt OSL are in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/139520
This commit is contained in:
Aras Pranckevicius
2025-06-12 20:07:52 +02:00
committed by Aras Pranckevicius
parent 7818082d02
commit 68111db969
52 changed files with 1183 additions and 573 deletions

View File

@@ -131,7 +131,7 @@ class Report:
message += """<p><tt>BLENDER_TEST_UPDATE=1 ctest -R %s</tt></p>""" % test_suite_name
message += """<p>The reference output of new and failing tests will be updated. """ \
"""Be sure to commit the new reference """ \
"""files to the tests/files git submodule afterwards.</p>"""
"""files under the tests/files folder afterwards.</p>"""
message += """</div>"""
message += f"Tested files: {self.tested_count}, <b>failed: {len(self.failed_list)}</b>"
else:

View File

@@ -343,7 +343,7 @@ class Report:
message += """<p><tt>BLENDER_TEST_UPDATE=1 ctest -R %s</tt></p>""" % self.engine_name
message += """<p>This then happens for new and failing tests; reference images of """ \
"""passing test cases will not be updated. Be sure to commit the new reference """ \
"""images to the tests/files git submodule afterwards.</p>"""
"""images under the tests/files folder afterwards.</p>"""
message += """</div>"""
else:
message = ""