Nodes: Implement Gabor noise #121820
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
FBX
Interest
Freestyle
Interest
Geometry Nodes
Interest
glTF
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 & 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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#121820
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "OmarEmaraDev/blender:gabor-noise"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 fix the impulses count to 8 for simplicitly.
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.
WIP: Nodes: Implement Gabor noiseto Nodes: Implement Gabor noise@blender-bot package
Package build started. Download here when ready.
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.
@ -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.
@ -0,0 +32,4 @@
.description(
"The number of impulses used to compute the noise. This is a quality control parameter "
"and has minimal effect on the structure of the output. Higher values yield higher "
"quality noise at the cost of more compute time");
compute time -> computation time
@ -0,0 +37,4 @@
.default_value(2.0f)
.min(0.0f)
.description(
"The rate at which the Gabor noise change across space. This is different from the "
change -> changes
@ -0,0 +46,4 @@
.subtype(PROP_FACTOR)
.description(
"The directionality of Gabor noise. 1 means the noise is completely directional, while "
"0 means the noise is completely omnidirectional");
completely omnidirectional -> omnidirectional
(doesn't make logical sense to me since you can't be partially omnidirectional)
@brecht What do you think about removing the impulses input and setting it internally to something reasonable like 8? Because it doesn't provide much control to the user, when it is very low, the normalization doesn't really work, and setting it to a constant might improve performance.
Are there situations where 8 is not enough? I see OSL defaults to 16.
I guess that would be the main reason to have it, situations where more impulses are needed but always setting them so high being bad for performance. But I'm not sure if that happens in practice.
If we do need to keep it, we can increase the minimum value at least.
@brecht I don't think there are situations where 8 is not enough, we could even go for 4. this is essentially described in details in Tavernier's paper, but the gist of it is as follows.
Gabor noise converges to a Gaussian distribution as the number of impulses increase, the authors use the so called Cramer von Mises criterion (CvM) to assess the quality of convergence for a particular impulses count. They empirically show that a CvM lower than 0.5 is good enough, and all methods converge rather slowly after reaching a CvM of 0.5.
The original Gabor noise method requires around 30 impulses to reach a CvM of 0.5, while the author's suggested method of stratified poisson sampling with bernoulli distribution for weights achieves that in just 2 impulse, so this patch generally requires 15x less impulses to get the same quality as the original Gabor noise.
This could explain why OSL needs a large default of 16 to get something reasonable and why we shouldn't use OSL's implementation as a reference. However, we should note that OSL eliminate the weights of kernels and replace them with a random phase angle for the phase augmented gabor kernel, which was not evaluated in Tavernier's paper. But it probably doesn't change much, which is easy to see empirically in the following examples.
Left is our implementation, right is OSL. Impulses count set to 2 for both. Our implementation already converged to something good while OSL doesn't provide anything useful.
For the following example, I raised OSL's impulses count to 32 (Their maximum possible count), while still keeping our implementation at 2, and I feel like ours is still better.
Then indeed we can set impulses to a fixed value.
Mark as requesting changes until impulses socket is removed.
Looks great, thanks.
I just verified it works as expected on macOS. Think you've covered all the code side aspects already.