Fix #119797: Noise Texture Precision Issues #119884

Merged
Brecht Van Lommel merged 5 commits from Hoshinova/blender:fix-119797 into main 2024-03-29 16:12:34 +01:00
Member

The Perlin noise algorithms suffer from precision issues when a coordinate is greater than about 250000.

To fix this the Perlin noise texture is repeated every 100000 on each axis.
This causes discontinuities every 100000, however at such scales this usually shouldn't be noticeable.

The Perlin noise algorithms suffer from precision issues when a coordinate is greater than about 250000. To fix this the Perlin noise texture is repeated every 100000 on each axis. This causes discontinuities every 100000, however at such scales this usually shouldn't be noticeable.
Hoshinova added 1 commit 2024-03-25 17:23:22 +01:00
Iliya Katushenock added this to the Render & Cycles project 2024-03-25 17:24:12 +01:00
Hoshinova added 1 commit 2024-03-25 17:24:55 +01: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
8cc7115281
-- Fix typo.
Hoshinova requested review from Brecht Van Lommel 2024-03-25 17:25:24 +01:00
Hoshinova requested review from Omar Emara 2024-03-25 17:25:25 +01:00

@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/PR119884) when ready.
Member

Was the isinf there to fix this same issue?

Was the `isinf` there to fix this same issue?
Author
Member

Was the isinf there to fix this same issue?

Maybe, or maybe not. It was added by Brecht in 8cf374d401 (diff-c348bd67a7f307556517475894a207949ee5b853)

But either way I don't think it's a good idea to have it there.
If the output is inf in some cases then that's a bug to be fixed. isinf "hides" it by outputting a default value, which doesn't really solve the problem.

> Was the `isinf` there to fix this same issue? Maybe, or maybe not. It was added by Brecht in https://projects.blender.org/blender/blender/commit/8cf374d4012e193a50a58f1e2abcdae306ae33cd#diff-c348bd67a7f307556517475894a207949ee5b853 But either way I don't think it's a good idea to have it there. If the output is `inf` in some cases then that's a bug to be fixed. `isinf` "hides" it by outputting a default value, which doesn't really solve the problem.
Omar Emara requested changes 2024-03-27 09:25:38 +01:00
Dismissed
Omar Emara left a comment
Member

The noise is still continuous even after this change I think, though not differentiable. So maybe clarify the comment as well.

The noise is still continuous even after this change I think, though not differentiable. So maybe clarify the comment as well.
@ -35,0 +32,4 @@
/* Repeat Perlin noise texture every 100000.0 on each axis to prevent floating point
* representation issues. This causes discontinuities every 100000.0, however at such scales this
* usually shouldn't be noticeable. */
vector3 p = vector3(fmod(co.x, 100000.0), fmod(co.y, 100000.0), fmod(co.z, 100000.0));
Member

Seems like we have fmod vector variants that should be used instead?

Seems like we have `fmod` vector variants that should be used instead?
Hoshinova marked this conversation as resolved

I'm guessing this gives a measure performance regression. It would be good to understand how big it is. Maybe we'll have to accept it.

I'm guessing this gives a measure performance regression. It would be good to understand how big it is. Maybe we'll have to accept it.
Author
Member

The noise is still continuous even after this change I think, though not differentiable. So maybe clarify the comment as well.

Since it's cutting a chunk of size 100000.0 out and pasting them on after each other, whereever 2 chunks meet there isn't anything that ensures continuity.

> The noise is still continuous even after this change I think, though not differentiable. So maybe clarify the comment as well. Since it's cutting a chunk of size 100000.0 out and pasting them on after each other, whereever 2 chunks meet there isn't anything that ensures continuity.
Hoshinova added 3 commits 2024-03-27 17:06:54 +01:00
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
412084ee83
Merge branch 'main' into fix-119797
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/PR119884) when ready.
Author
Member

I'm guessing this gives a measure performance regression. It would be good to understand how big it is. Maybe we'll have to accept it.

@brecht I couldn't measure any performance differences:

Before fix:
before.png
19.94 seconds

After fix:
after.png
19.58 seconds

> I'm guessing this gives a measure performance regression. It would be good to understand how big it is. Maybe we'll have to accept it. @brecht I couldn't measure any performance differences: Before fix: ![before.png](/attachments/9dd53a1c-0da1-4c49-acec-daad2f9edf13) 19.94 seconds After fix: ![after.png](/attachments/54d8d13e-0166-43ea-897d-8d4f626b825e) 19.58 seconds

Thanks for testing the performance.

I'll do a build with GPU tests. Note that currently a few tests there are known to fail.

@blender-bot build +gpu linux

Thanks for testing the performance. I'll do a build with GPU tests. Note that currently a few tests there are known to fail. @blender-bot build +gpu linux
Brecht Van Lommel approved these changes 2024-03-28 21:01:12 +01:00
Omar Emara approved these changes 2024-03-29 09:31:20 +01:00
Brecht Van Lommel merged commit c78c6b0bdf into main 2024-03-29 16:12:34 +01:00
Brecht Van Lommel deleted branch fix-119797 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 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#119884
No description provided.