Voronoi texture cells biased towards mapping coordinates #50658
Labels
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
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#50658
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
System Information
Archlinux
Blender Version
Broken: 2.78a
Short description of error
When subtracting
(.5, .5, .5)
from the output of a high frequency Voronoi cell texture, a pattern which looks suspiciously like the input coordinates emerges:This might be related to the rather unexpected tendency for Voronoi-cell-modified-normals to cause square reflections of round light sources when used in a glossy shader.
The two phenomena occur together, but beyond that I have no idea why either happens or why one would cause the other.
Exact steps for others to reproduce the error
Changed status to: 'Open'
Added subscriber: @gandalf3
Added subscriber: @GiantCowFIlms
Added subscribers: @brecht, @Sergey
While this isn't really a bug but like a limitation of current hashing function this is an interesting phenomena to investigate.
Think correlation is coming from the order of coordinate components we use to hash r, g and b components:
Would need to plot our
hash()
function to see if there's something intrinsicly wrong in there, but such a quick experiment solves the correlation issue:P446: Snippet for #50658
Note that patch is only working on GPU, CPU would need SSE-optimized version.
That's the math aspect of the issue. Now let's talk about practical aspect. Don't really think Voronoi was intended to have same randomness entropy as a white noise and if you need white noise just use a dedicated function for that. Surely solving correlation issues will be nice, but that's not possible without changing behavior of the voronoi noise. Which means, it'll break all existing files which are using this texture.
Maybe we can do it in 2.8 branch, but only if it's indeed something important to solve.
@brecht, wouldn't mind hearing your opinion on this issue.
Perhaps changing the order to this helps? So there is no repetition in the rows or columns.
Whatever solves the issue, seems ok to fix in 2.8.
Added subscriber: @LazyDodo
Not sure diverging from what OSL is doing is that good of an idea, even for 2.8, We either have to re-implement cellnoise+Voronoi in osl scripts which will be significantly slower, or patch osl while we're building it to keep consistent results between SVM and OSL. Is it really a problem worth solving?
@brecht, woops. After days of bugfix hunting didn't think of such a simple shuffle :) Seems promising since that's simple to implement on SSE.
@LazyDodo, not sure why that would diverge for OSL. We just need to update
kernel/shaders/node_texture.h
. OSL does not implement Voronoi on their side.My bad, i could have sworn we used the internal noise functions from osl. I stand corrected.
My particular use-case is using detailed voronoi cells to modify normals to simulate aluminum flakes in car paint
@LazyDodo, we use noise while voronoi is a "wrapper" on top noise. That being said, we use perlin noise from OS for example.
@gandalf3, why not to use regular noise if the scale to be so small?
@brecht, tested that shuffle patch from you. Unfortunately, it does not solve the issue. So guess our
noise()
function isn't really good in terms doesn't give nice distribution when shuffling arguments around. This is still to be confirmed tho. Will give it a deeper later.@Sergey, it is easier to get distinct faces using the vorinoi texture. Using noise often results in less distinct pieces. Further, for certain camera angles the scale is not as small as one might believe. Some paints have pretty large flecks.
Changed status from 'Open' to: 'Archived'
Was trying various things here. The cell-noise itself is not biased by the looks of it, and in fact it matches implementation from OIIO/OSL. it is something combined with the way how we do cells and then hashing the coordinate which gives distribution issues.
Since there is no way to fix that without introducing regressions and because it's not a bug in implementation considering it a TODO for 2.8 projects there: https://wiki.blender.org/index.php/Dev:Source/Render/Cycles/ToDo
@GiantCowFIlms, doubt you'll see bias with larger flecks tbh.
Added subscriber: @sivert3
This is actually cased by a bug in the implementation of quick_floor in OSL, which has been faithfully reproduced in Cycles's own version in util/util_math.h. The gist is that
quick_floor_to_int(-1.0) == -2
instead of the correct value of -1, and this manifests itself in the voronoi shader which floors input coordinates correctly before passing them to cellnoise, which in turn uses the broken quick floor function.See imageworks/OpenShadingLanguage#912 for a detailed description
Confirmed to be the case with P781: Snippet for #50658