Eevee: Modulo node behaves unexpectedly/inconsistently #68687

Closed
opened 2019-08-15 11:22:42 +02:00 by Niek Sprakel · 13 comments

System Information
Windows 10 Professional (x64) Version 1903 (build 18362.267)
Graphics: Intel(R) HD Graphics 630

Blender Version
v2.80.75

Here is an attached blend file that illustrates the issue (visible in render preview as you switch between eevee and cycles).

If you compare the outcome of mod(2x, x) between eevee and cycles. Cycles seems to correctly evaluate that to 0 while eevee seems to evaluate that incorrectly to 1 for many values of x (for both integers and fractions).EeveeModError1.blend
The bug also occurs for mod(y
x,x) for many values of y (I've tested it for a couple of integer values of y).

System Information Windows 10 Professional (x64) Version 1903 (build 18362.267) Graphics: Intel(R) HD Graphics 630 Blender Version v2.80.75 Here is an attached blend file that illustrates the issue (visible in render preview as you switch between eevee and cycles). If you compare the outcome of mod(2*x, x) between eevee and cycles. Cycles seems to correctly evaluate that to 0 while eevee seems to evaluate that incorrectly to 1 for many values of x (for both integers and fractions).[EeveeModError1.blend](https://archive.blender.org/developer/F7665603/EeveeModError1.blend) The bug also occurs for mod(y*x,x) for many values of y (I've tested it for a couple of integer values of y).
Author

Added subscriber: @dohduhdah

Added subscriber: @dohduhdah
Clément Foucault was assigned by Niek Sprakel 2019-08-15 11:23:14 +02:00

Added subscriber: @brecht

Added subscriber: @brecht

Please verify if this is still an issue in the latest build, I believe there was a fix related to this:
https://builder.blender.org/download/

Please verify if this is still an issue in the latest build, I believe there was a fix related to this: https://builder.blender.org/download/
Author

In #68687#753622, @brecht wrote:
Please verify if this is still an issue in the latest build, I believe there was a fix related to this:
https://builder.blender.org/download/

Yes, I've tried it today with the latest build. There have been a few fixes, but there still appear to be problems with the modulo function in eevee.

I notice them in a more complicated setup when comparing the results between eevee and cycles:

https://blenderartists.org/t/confusion-about-color-difference-between-eevee-and-cycles/1173638

I use the modulo function in the shader nodes to generate color combinations:

https://i.imgur.com/BBqAsgv.png

Switching between cycles and eevee in rendered preview causes certain elements to take on completely different colors (while most of the colors remain equal).mod-grid2.blend

> In #68687#753622, @brecht wrote: > Please verify if this is still an issue in the latest build, I believe there was a fix related to this: > https://builder.blender.org/download/ Yes, I've tried it today with the latest build. There have been a few fixes, but there still appear to be problems with the modulo function in eevee. I notice them in a more complicated setup when comparing the results between eevee and cycles: https://blenderartists.org/t/confusion-about-color-difference-between-eevee-and-cycles/1173638 I use the modulo function in the shader nodes to generate color combinations: https://i.imgur.com/BBqAsgv.png Switching between cycles and eevee in rendered preview causes certain elements to take on completely different colors (while most of the colors remain equal).[mod-grid2.blend](https://archive.blender.org/developer/F7665821/mod-grid2.blend)

Added subscriber: @GpuDevil

Added subscriber: @GpuDevil

This is likely a floating point precision issue regarding GLSL's implementation of mod() and GPU code generation, see this thread: https://www.raspberrypi.org/forums/viewtopic.php?t=189455

This is likely a floating point precision issue regarding GLSL's implementation of `mod()` and GPU code generation, see this thread: https://www.raspberrypi.org/forums/viewtopic.php?t=189455

Seems like the issue with mod(x,x) != 0 isa regression. However, the imprecision pointed by @GpuDevil is likely to remain as it is an implementation behavior we cannot ensure. And I tried expanding the terms and it did nothing.

Seems like the issue with mod(x,x) != 0 isa regression. However, the imprecision pointed by @GpuDevil is likely to remain as it is an implementation behavior we cannot ensure. And I tried expanding the terms and it did nothing.

This issue was referenced by d9be59e872

This issue was referenced by d9be59e872f8a112f31b73f07fe41efb51a08ad9

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Contributor

Added subscriber: @IyadAhmed

Added subscriber: @IyadAhmed
Contributor

I still see the problem in 2.82, it occurs whenever there are negative numbers as input for both Vector Math and Math nodes modulo, EEVEE seems to be more accurate, it is the Cycles implementation that doesn't produce desirable results.

I still see the problem in 2.82, it occurs whenever there are negative numbers as input for both Vector Math and Math nodes modulo, EEVEE seems to be more accurate, it is the Cycles implementation that doesn't produce desirable results.

@IyadAhmed, it's best to create a new report then with example .blend file and system information, to be sure we are looking at the same problem.

@IyadAhmed, it's best to create a new report then with example .blend file and system information, to be sure we are looking at the same problem.
Contributor

In #68687#882150, @brecht wrote:
@IyadAhmed, it's best to create a new report then with example .blend file and system information, to be sure we are looking at the same problem.

Indeed it is not exactly the same problem, however the problem above still exists in 2.82 and blender-2.83-1a1f2912e65e-windows64, screenshots using the above file "EeveeModError1.blend"
EEVEE
eevee.png

Cycles
cycles.png

> In #68687#882150, @brecht wrote: > @IyadAhmed, it's best to create a new report then with example .blend file and system information, to be sure we are looking at the same problem. Indeed it is not exactly the same problem, however the problem above still exists in 2.82 and blender-2.83-1a1f2912e65e-windows64, screenshots using the above file "EeveeModError1.blend" EEVEE ![eevee.png](https://archive.blender.org/developer/F8379020/eevee.png) Cycles ![cycles.png](https://archive.blender.org/developer/F8379021/cycles.png)
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#68687
No description provided.