Nodes: Implement Gabor noise #121820

Open
Omar Emara wants to merge 18 commits from OmarEmaraDev/blender:gabor-noise into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

This patch implements a new Gabor noise node based on [1] but with the
improvements from [2] and the phasor formulation from [3].

We compare with the most popular existing implementation, that of OSL,
from the user's point of view:

  • This implementation produces C1 continuous noise as opposed to the
    non continuous OSL implementation, so it can be used for bump
    mapping and is generally smother. This is achieved by windowing the
    Gabor kernel using a Hann window.

  • The Bandwidth input of OSL was hard-coded to 1 and was replaced with
    a frequency input, which OSL hard codes to 2, since frequency is
    more natural to control. This is even more true now that that Gabor
    kernel is windowed as opposed to truncated, which means increasing
    the bandwidth will just turn the Gaussian component of the Gabor
    into a Hann window. While decreasing the bandwidth will eliminate
    the harmonic from the Gabor kernel, which is the point of Gabor
    noise.

  • OSL had three discrete modes of operation for orienting the kernel.
    Anisotropic, Isotropic, and a hybrid mode. While this implementation
    provides a continuous Anisotropy parameter which users are already
    familiar with from the Glossy BSDF node.

  • This implementation provides not just the Gabor noise value, but
    also its phase and intensity components. The Gabor noise value is
    basically sin(phase) * intensity, but the phase is arguably more
    useful since it does not suffer from the low contrast issues that
    Gabor suffers from. While the intensity is useful to hide the
    singularities in the phase.

  • This implementation converges faster that OSL's relative to the
    impulse count, so we default to a lower value of 8 and cap the input
    at 16. We might even look into removing that input for simplicity.

  • This implementation does not implement anisotropic filtering.

Future improvements to the node includes implementing surface noise and
filtering. As well as extending the spectral control of the noise,
either by providing specialized kernels as was done in #110802, or by
providing some more procedural control over the frequencies of the
Gabor.

References:

[1]: Lagae, Ares, et al. "Procedural noise using sparse Gabor
convolution." ACM Transactions on Graphics (TOG) 28.3 (2009): 1-10.

[2]: Tavernier, Vincent, et al. "Making gabor noise fast and
normalized." Eurographics 2019-40th Annual Conference of the European
Association for Computer Graphics. 2019.

[3]: Tricard, Thibault, et al. "Procedural phasor noise." ACM
Transactions on Graphics (TOG) 38.4 (2019): 1-13.

This patch implements a new Gabor noise node based on [1] but with the improvements from [2] and the phasor formulation from [3]. We compare with the most popular existing implementation, that of OSL, from the user's point of view: - This implementation produces C1 continuous noise as opposed to the non continuous OSL implementation, so it can be used for bump mapping and is generally smother. This is achieved by windowing the Gabor kernel using a Hann window. - The Bandwidth input of OSL was hard-coded to 1 and was replaced with a frequency input, which OSL hard codes to 2, since frequency is more natural to control. This is even more true now that that Gabor kernel is windowed as opposed to truncated, which means increasing the bandwidth will just turn the Gaussian component of the Gabor into a Hann window. While decreasing the bandwidth will eliminate the harmonic from the Gabor kernel, which is the point of Gabor noise. - OSL had three discrete modes of operation for orienting the kernel. Anisotropic, Isotropic, and a hybrid mode. While this implementation provides a continuous Anisotropy parameter which users are already familiar with from the Glossy BSDF node. - This implementation provides not just the Gabor noise value, but also its phase and intensity components. The Gabor noise value is basically sin(phase) * intensity, but the phase is arguably more useful since it does not suffer from the low contrast issues that Gabor suffers from. While the intensity is useful to hide the singularities in the phase. - This implementation converges faster that OSL's relative to the impulse count, so we default to a lower value of 8 and cap the input at 16. We might even look into removing that input for simplicity. - This implementation does not implement anisotropic filtering. Future improvements to the node includes implementing surface noise and filtering. As well as extending the spectral control of the noise, either by providing specialized kernels as was done in #110802, or by providing some more procedural control over the frequencies of the Gabor. References: [1]: Lagae, Ares, et al. "Procedural noise using sparse Gabor convolution." ACM Transactions on Graphics (TOG) 28.3 (2009): 1-10. [2]: Tavernier, Vincent, et al. "Making gabor noise fast and normalized." Eurographics 2019-40th Annual Conference of the European Association for Computer Graphics. 2019. [3]: Tricard, Thibault, et al. "Procedural phasor noise." ACM Transactions on Graphics (TOG) 38.4 (2019): 1-13.
Omar Emara added 7 commits 2024-05-15 12:43:11 +02:00
Omar Emara added 2 commits 2024-05-16 15:10:51 +02:00
Omar Emara added 1 commit 2024-05-16 15:12:21 +02:00
Omar Emara added 1 commit 2024-05-17 10:46:19 +02:00
Omar Emara added 1 commit 2024-05-17 16:08:53 +02:00
Omar Emara added 4 commits 2024-05-22 13:06:18 +02:00
Omar Emara added 1 commit 2024-05-23 17:00:46 +02:00
Omar Emara added 1 commit 2024-05-23 17:54:05 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
6b3d358e86
Cleanup
Omar Emara requested review from Brecht Van Lommel 2024-05-23 17:54:23 +02:00
Omar Emara requested review from Sergey Sharybin 2024-05-23 17:54:23 +02:00
Omar Emara changed title from WIP: Nodes: Implement Gabor noise to Nodes: Implement Gabor noise 2024-05-23 17:54:28 +02:00
Omar Emara added the
Module
Render & Cycles
Interest
Cycles
Interest
EEVEE
labels 2024-05-23 17:55:39 +02:00
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR121820) when ready.
Brecht Van Lommel requested changes 2024-06-06 20:21:09 +02:00
Brecht Van Lommel left a comment
Owner

This is working well overall. There are not that many inputs, so not really much to say regarding UI.

I ran Cycles benchmarks with CUDA and saw no performance impact there.

This is working well overall. There are not that many inputs, so not really much to say regarding UI. I ran Cycles benchmarks with CUDA and saw no performance impact there.
@ -0,0 +21,4 @@
b.add_input<decl::Vector>("Vector").implicit_field(implicit_field_inputs::position);
b.add_input<decl::Float>("Scale").default_value(5.0f);
b.add_input<decl::Float>("Impulses").default_value(8.0f).min(0.0f).max(16.0f);
b.add_input<decl::Float>("Frequency").default_value(2.0f).min(0.0f);

Impulses and Frequency seem to turn the texture from grey to black when they go from a small value to zero.

Could we internally (not in the UI) clamp them to some minimum values to avoid that discontinuity? It seems better when texturing these inputs.

Impulses and Frequency seem to turn the texture from grey to black when they go from a small value to zero. Could we internally (not in the UI) clamp them to some minimum values to avoid that discontinuity? It seems better when texturing these inputs.
@ -0,0 +35,4 @@
.subtype(PROP_DIRECTION);
b.add_output<decl::Float>("Value");
b.add_output<decl::Float>("Phase");
b.add_output<decl::Float>("Intensity");

It would be good to add descriptions for all these inputs and outputs.

It would be good to add descriptions for all these inputs and outputs.
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u gabor-noise:OmarEmaraDev-gabor-noise
git checkout OmarEmaraDev-gabor-noise
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser Project (Legacy)
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
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: blender/blender#121820
No description provided.