Regression: Black block appears when using some parameters of the Multifractal Noise Texture #119797

Closed
opened 2024-03-22 17:08:30 +01:00 by vp.gestaltung · 8 comments

Blender Version
Broken: version: 4.1.0 Release Candidate, branch: blender-v4.1-release, commit date: 2024-03-18 20:43, hash: 51cdf665abd2
Worked: 4.0

Short description of error
When playing around with the Multifractal Noisetexture and using the Scale,
Detail and Lacunarity sliders some weird black block appears


Exact steps for others to reproduce the error

  • Open shader editor,
  • change parameters of the Multifractal Noise Texture
**Blender Version** Broken: version: 4.1.0 Release Candidate, branch: blender-v4.1-release, commit date: 2024-03-18 20:43, hash: `51cdf665abd2` Worked: 4.0 **Short description of error** When playing around with the Multifractal Noisetexture and using the Scale, Detail and Lacunarity sliders some weird black block appears ![](attachments/0221ce69-1c4a-467a-91ff-d533e22f2474) ![](attachments/a4548535-3a6a-4ee0-ba44-4b61d5b4d5fb) **Exact steps for others to reproduce the error** - Open shader editor, - change parameters of the Multifractal Noise Texture
vp.gestaltung added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2024-03-22 17:08:31 +01:00
Iliya Katushenock added the
Interest
Render & Cycles
label 2024-03-22 17:17:01 +01:00
Iliya Katushenock changed title from Black block appears when using some parameters of the Multifractal Noise Texture to Regression: Black block appears when using some parameters of the Multifractal Noise Texture 2024-03-22 17:26:50 +01:00

I can not render this with OSL option enabled. Without OSL i can't confirm issue in 4.1 and 4.2.

I can not render this with OSL option enabled. Without OSL i can't confirm issue in 4.1 and 4.2.

I can confirm.
The issue was introduced in 4.1 between ca9c6372c94c (Sep 28) and 09caf5969010 (Nov 28)

**System Information**
Operating system: Windows-10-10.0.22621-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3060 Laptop GPU/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 546.01
I can confirm. The issue was introduced in 4.1 between `ca9c6372c94c` (Sep 28) and `09caf5969010` (Nov 28) ``` **System Information** Operating system: Windows-10-10.0.22621-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3060 Laptop GPU/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 546.01 ```
Iliya Katushenock added this to the 4.1 milestone 2024-03-22 21:51:44 +01:00
Member

This was very likely caused by: 0b11c591ec

This was very likely caused by: https://projects.blender.org/blender/blender/commit/0b11c591ec62d4ff405108c453f4a34bf3eaee91
Member

I did some digging into the issue.

The issue comes from the simplex/perlin noise implementations used, and how they differ between OSL and SVM.

In Cycles OSL rendering, I believe the simplex/perlin noise function offered by OSL is used. While if SVM is in use, then Cycles perlin noise function is used. They seem to produce the same result, until the sampled co-oridinate gets very large, then they start to differ. What's causing the co-ordinate to get very large? Two things:

Inside the OSL script for the noise node you start off with: p *= Scale;. So if the scale is large, you should have issues.

Then once it gets to processing the multi-fractual noise you enter node_noise.h and do this:

  float noise_multi_fractal(T co, float detail, float roughness, float lacunarity)
  {
    T p = co; /* This is our co-ordinate */
    float value = 1.0; 
    float pwr = 1.0; 

    for (int i = 0; i <= (int)detail; i++) { 
      value *= (pwr * safe_snoise(p) + 1.0); /* safe_snoise is a simplex noise function */
      pwr *= roughness; 
      p *= lacunarity; 
    } 

    float rmd = detail - floor(detail); 
    if (rmd != 0.0) { 
      value *= (rmd * pwr * safe_snoise(p) + 1.0); /* safe_snoise is a simplex noise function */
    }

    return value;
  }

As you can see, there is a for loop based on the detail input. And this constantly multiplies the co-ordinate by lacunarity, so if lacunarity is greater than 1, then the co-ordinate will grow, and if detail is high, the loop runs many times.

In our scene, let's take a co-ordinate of 1 as an example. By the time we're running the last simplex/perlin noise funciton in noise_multi_fractal, our co-ordinate is: 1 * 10 * (11.7 ^ 8) = 3,511,453,275.80.

So it's highly likely the issue we're seeing in OSL is something precision related in the noise function that Cycles own noise implementation handles better.

There's a bunch of things that could be done to try and reduce these issues, or make SVM/OSL match. For example clamping values, modifying OSL source code (preferably as a pull request up stream) to match Cycles SVM, adjust Cycles SVM to match OSL with all it's issues, Use Cycles own simplex/perlin noise function instead of OSLs, and other options. I'll leave the decision on what to do, and the code changes, to the Cycles developers.

I did some digging into the issue. The issue comes from the simplex/perlin noise implementations used, and how they differ between OSL and SVM. In Cycles OSL rendering, I believe the simplex/perlin noise function offered by OSL is used. While if SVM is in use, then Cycles perlin noise function is used. They seem to produce the same result, until the sampled co-oridinate gets very large, then they start to differ. What's causing the co-ordinate to get very large? Two things: Inside the OSL script for the noise node you start off with: `p *= Scale;`. So if the scale is large, you should have issues. Then once it gets to processing the multi-fractual noise you enter `node_noise.h` and do this: ``` float noise_multi_fractal(T co, float detail, float roughness, float lacunarity) { T p = co; /* This is our co-ordinate */ float value = 1.0; float pwr = 1.0; for (int i = 0; i <= (int)detail; i++) { value *= (pwr * safe_snoise(p) + 1.0); /* safe_snoise is a simplex noise function */ pwr *= roughness; p *= lacunarity; } float rmd = detail - floor(detail); if (rmd != 0.0) { value *= (rmd * pwr * safe_snoise(p) + 1.0); /* safe_snoise is a simplex noise function */ } return value; } ``` As you can see, there is a for loop based on the detail input. And this constantly multiplies the co-ordinate by lacunarity, so if lacunarity is greater than 1, then the co-ordinate will grow, and if detail is high, the loop runs many times. In our scene, let's take a co-ordinate of 1 as an example. By the time we're running the last simplex/perlin noise funciton in `noise_multi_fractal`, our co-ordinate is: `1 * 10 * (11.7 ^ 8) = 3,511,453,275.80`. So it's highly likely the issue we're seeing in OSL is something precision related in the noise function that Cycles own noise implementation handles better. There's a bunch of things that could be done to try and reduce these issues, or make SVM/OSL match. For example clamping values, modifying OSL source code (preferably as a pull request up stream) to match Cycles SVM, adjust Cycles SVM to match OSL with all it's issues, Use Cycles own simplex/perlin noise function instead of OSLs, and other options. I'll leave the decision on what to do, and the code changes, to the Cycles developers.
Brecht Van Lommel modified the milestone from 4.1 to 4.2 LTS 2024-03-25 10:32:33 +01:00
Brecht Van Lommel added
Type
Bug
and removed
Type
Report
labels 2024-03-25 10:32:41 +01:00

I don't think this is critical for 4.1.0, so postponing to 4.2 and potentially 4.1.1.

@Hoshinova, can you look into this?

I don't think this is critical for 4.1.0, so postponing to 4.2 and potentially 4.1.1. @Hoshinova, can you look into this?

Note that in general, high detail values are slow to compute and indeed can run into these kinds of precision issues. Usually 9.0 is much higher than necessary.

Note that in general, high detail values are slow to compute and indeed can run into these kinds of precision issues. Usually 9.0 is much higher than necessary.
Member

I can confirm.
The issue was introduced in 4.1 between ca9c6372c94c (Sep 28) and 09caf5969010 (Nov 28)

**System Information**
Operating system: Windows-10-10.0.22621-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3060 Laptop GPU/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 546.01

Not sure how you came to that conclusion. The issue is also present in the Mugrave Texture in 4.0.2 and prior when using the same inputs on my PC.

> I can confirm. > The issue was introduced in 4.1 between `ca9c6372c94c` (Sep 28) and `09caf5969010` (Nov 28) > > ``` > **System Information** > Operating system: Windows-10-10.0.22621-SP0 64 Bits > Graphics card: NVIDIA GeForce RTX 3060 Laptop GPU/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 546.01 > ``` Not sure how you came to that conclusion. The issue is also present in the Mugrave Texture in 4.0.2 and prior when using the same inputs on my PC.
Member

So it's highly likely the issue we're seeing in OSL is something precision related in the noise function that Cycles own noise implementation handles better.

Not really, both start to have precision related issue when one of the coordinates gets greater than about 250000. Cycles own noise implementation just hides it better by outputting 0.0 instead of a garbage value.

> So it's highly likely the issue we're seeing in OSL is something precision related in the noise function that Cycles own noise implementation handles better. Not really, both start to have precision related issue when one of the coordinates gets greater than about 250000. Cycles own noise implementation just hides it better by outputting 0.0 instead of a garbage value.
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2024-03-29 16:12:37 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
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
6 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#119797
No description provided.