GLSL 'clamp' issue? #83494
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
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
8 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#83494
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
Operating system: Linux 5.9.10-arch1-1
Graphics card: NVIDIA GTX 980Ti 455.45.01
Blender Version
Broken: 2.91, 2.92 master
Worked: ???
Short description of error
According to GLSL spec, clamp(x, a, b) == min(max(x,a), b). So then, clamp(0, 1, 0) should yield 0. But that doesn't seem to be the case, at least on my system. With this node setup:
...the output should be black. However...
Eevee material preview:
Eevee render:
Cycles render:
Exact steps to reproduce error
Observe difference between material/render with Eevee vs. Cycles. Every time Eevee is used (material preview and render), the ouput will be white, though it should be black. Cycles render produces correct result.
Sample blend file:
clamp_issue.blend
Added subscriber: @Stan_Pancakes
Added subscribers: @fclem, @brecht, @mano-wii
Changed status from 'Needs Triage' to: 'Archived'
Thanks for the report, but I would not say that this is a bug.
It is expected that users set the maximum value to something always greater than the minimum.
If they don't, the result is unpredictable and will depend on the engine.
Apparently in Eevee it was decided that the minimum value prevails while in Cycles it is the maximum value.
Although consistency is more appreciated, this is something to decide outside the bug tracker. (https://wiki.blender.org/wiki/Communication/Contact#User_Feedback_and_Requests).
So I'm closing the report for now.
(Cc @fclem, @brecht)
I cannot reproduce. It feels like it's an issue with the Nvidia driver. Are you using proprietary driver? please attach your
system_info.txt
.We could patch the GLSL code but it seems like this is a quite basic thing to expect from driver to properly implement a clamp!
@mano-wii, please don't do that. The two clamp options aren't called "Range" and "Implementation-defined". They're called "Range" and "Min Max".
@fclem Of course. See also https://www.shadertoy.com/view/Ms33R4 . I see this:
system-info.txt
Added subscriber: @dfelinto
I cannot reproduce it either on:
Operating system: Linux-5.4.0-56-generic-x86_64-with-debian-bullseye-sid 64 Bits
Graphics card: GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 450.80.02
As in, I don't get the Cycles black render either.
@dfelinto I've attached an example file in the description, so that we're on the same page.
Added subscriber: @Foaly
I get the same result as @radcapricorn.
Quote from the GLSL 4.6 spec:
So if EEVEE wants to implement this consistently across platforms, I'd argue the clamp function cannot be used.
Or we can make it undefined as well in the documentation. I assume the Min Max type exists only for performance reasons anyway?
Changed status from 'Archived' to: 'Confirmed'
We don't want to expose undefined behavior to users, so this is a bug then.
(right, with the sample file I can reproduce - I couldn't with only the clamp node directly linked to the Material output)
This issue was referenced by
fe5d2448c6
Changed status from 'Confirmed' to: 'Resolved'