When animating a mixnodes mix property and hitting 0 or 1, the shader recompiles #105057

Closed
opened 2023-02-22 00:13:56 +01:00 by Alex Mehler · 15 comments

System Information
Operating system: win10
Graphics card: 3060 rtx

Blender Version
Broken: this has been that way for some time since around 3.4 alpha i think

Short description of error

When animating a mixnode's mix property with 2 textures connected and hitting 0 or 1 to switch these etxtures, the shader kinda recompiles.

When you are playing the scenes in rendered or preview mode, this will give some frame dropping/jankyness and the object will flash with a white material.

**System Information** Operating system: win10 Graphics card: 3060 rtx **Blender Version** Broken: this has been that way for some time since around 3.4 alpha i think **Short description of error** When animating a mixnode's mix property with 2 textures connected and hitting 0 or 1 to switch these etxtures, the shader kinda recompiles. When you are playing the scenes in rendered or preview mode, this will give some frame dropping/jankyness and the object will flash with a white material.
Alex Mehler added the
Priority
Normal
Status
Needs Triage
Type
Report
labels 2023-02-22 00:13:57 +01:00
Member

Hi, thanks for the report. Can you share .blend file where this happens? I'm not able to repro this reliably.
Does this happen every time you switch mix node factor?

Hi, thanks for the report. Can you share .blend file where this happens? I'm not able to repro this reliably. Does this happen every time you switch mix node factor?
Pratik Borhade added
Status
Needs Information from User
and removed
Status
Needs Triage
labels 2023-02-22 04:10:06 +01:00

It sounds logical if this is a consequence of greedy optimization through inline node values.

It sounds logical if this is a consequence of greedy optimization through inline node values.
Member

No activity for more than a week. As per the tracker policy we assume the issue is gone and can be closed.

Thanks again for the report. If the problem persists please open a new report with the required information.

No activity for more than a week. As per the tracker policy we assume the issue is gone and can be closed. Thanks again for the report. If the problem persists please open a new report with the required information.
Blender Bot added
Status
Archived
and removed
Status
Needs Information from User
labels 2023-03-16 13:05:19 +01:00
Author

This is a 100% reproducable. Dont close.

Here, I attached a Demo file of the issue. It gets worse if there are a ton of other objects in the scene and Eevee is closer to maxing out. But its visible in this demo too.

Go into rendered mode and hit play, when the mixnode keyrames reach 0 or 1 there can be a flicker and the image plane gets white/grey like an object with default material for a few frames.
Play the scene on loop as its not consistent. Sometimest the compilation happens before the next frame and you cant see it, sometimes its slower and the material flashes white/grey.

It also breaks viewport animation rendering because these glitches are saved into the rendered image.

It also causes a performance degredation in playback! There are framerate dips when an animated scene is highly populated. I optimize the scenes so they run in 24fps in the viewport but this shader recompiling causes a dip in an otherwise perfectly playing scene.

For an just eevee guy like me who wants to render his cartoons, this is pretty bad. It only began some recent time ago , like i said , around 3.4 alpha.

I think this should be set to important instead of being closed. It breaks the whole viewport experience for me (in scenes where i use extensive texture animation)

EDIT: maybe this only happens on materials with alpha ... Ill check it out tommorrow.

This is a 100% reproducable. Dont close. Here, I attached a Demo file of the issue. It gets worse if there are a ton of other objects in the scene and Eevee is closer to maxing out. But its visible in this demo too. Go into rendered mode and hit play, when the mixnode keyrames reach 0 or 1 there can be a flicker and the image plane gets white/grey like an object with default material for a few frames. Play the scene on loop as its not consistent. Sometimest the compilation happens before the next frame and you cant see it, sometimes its slower and the material flashes white/grey. It also breaks viewport animation rendering because these glitches are saved into the rendered image. It also causes a performance degredation in playback! There are framerate dips when an animated scene is highly populated. I optimize the scenes so they run in 24fps in the viewport but this shader recompiling causes a dip in an otherwise perfectly playing scene. For an just eevee guy like me who wants to render his cartoons, this is pretty bad. It only began some recent time ago , like i said , around 3.4 alpha. I think this should be set to important instead of being closed. It breaks the whole viewport experience for me (in scenes where i use extensive texture animation) EDIT: maybe this only happens on materials with alpha ... Ill check it out tommorrow.
Blender Bot added
Status
Needs Triage
and removed
Status
Archived
labels 2023-03-17 04:11:29 +01:00

This indeed seems to be due to optimization, where if factor is 1, the input is essentially not present.

Since the issue reported here is a request for modified/improved behavior and not a bug in current behavior. Closing as this bug tracker is only for bugs and errors.

For user requests and feedback, please use other channels: https://wiki.blender.org/wiki/Communication/Contact#User_Feedback_and_Requests

For more information on why this isn't considered a bug, visit: https://wiki.blender.org/wiki/Reference/Not_a_bug

This indeed seems to be due to optimization, where if factor is 1, the input is essentially not present. Since the issue reported here is a request for modified/improved behavior and not a bug in current behavior. Closing as this bug tracker is only for bugs and errors. For user requests and feedback, please use other channels: https://wiki.blender.org/wiki/Communication/Contact#User_Feedback_and_Requests For more information on why this isn't considered a bug, visit: https://wiki.blender.org/wiki/Reference/Not_a_bug
Blender Bot added
Status
Archived
and removed
Status
Needs Triage
labels 2023-03-27 17:47:07 +02:00
Author
  1. it causes unpredictable visual glitches in render output and preview

  2. it causes framerate dips and lagging in animation playback

  3. this isnt just my usecase, blending normalmaps or texture maps for destruction models, whenever a mixnode hits 0 or 1, a shader will recompile.

dont you think this qualifies as a bug? graphical glitches in a graphics programs output ?

from a programmers viewpoint it might not technically be a bug , but from a graphics designers viewpoint its worse than a program crash.

especially since this is rather new behaviour and was not present and working just fine before 3.4 or 3.3.

1) it causes unpredictable visual glitches in render output and preview 2) it causes framerate dips and lagging in animation playback 3) this isnt just my usecase, blending normalmaps or texture maps for destruction models, whenever a mixnode hits 0 or 1, a shader will recompile. dont you think this qualifies as a bug? graphical glitches in a graphics programs output ? from a programmers viewpoint it might not technically be a bug , but from a graphics designers viewpoint its worse than a program crash. especially since this is rather new behaviour and was not present and working just fine before 3.4 or 3.3.

@Ulf3000 With 3.3 I can't open this file, can you provide example that works with that version? If this is regression, I can bisect this so I can look if this was intentional change or not.

@Ulf3000 With 3.3 I can't open this file, can you provide example that works with that version? If this is regression, I can bisect this so I can look if this was intentional change or not.
Blender Bot added
Status
Needs Triage
and removed
Status
Archived
labels 2023-03-28 16:18:16 +02:00
Richard Antalik added
Status
Needs Information from User
and removed
Status
Needs Triage
labels 2023-03-28 16:18:24 +02:00
Iliya Katushenock added the
Interest
EEVEE & Viewport
label 2023-03-29 03:47:48 +02:00
Iliya Katushenock changed title from EEVEE : When animating a mixnodes mix property and hitting 0 or 1, the shader recompiles to When animating a mixnodes mix property and hitting 0 or 1, the shader recompiles 2023-03-29 03:47:53 +02:00
Iliya Katushenock added the
Interest
Nodes & Physics
label 2023-03-29 03:48:04 +02:00
Author

Heres a file made for 3.3. Everything is smooth and looks great.

I had to replace the MixRGB nodes. Files saved with blender 3.4+ opened in blender 3.3- will not detect the new mix node. The mix node is not backwards compatible! (i guess thats unwanted behaviour )

So yeah thats when the new mix node was programmed, around alpha 3.4.

I´d be happy with the old behaviour, but i would suggest that mixnodes with keyframes or drivers are just treated and compiled with 2 channels all the time.

Being recompiled while in playback doesnt make sense for any material anyways though.

Being asynchrounous means many shader recompilations come in too late by default and create visual glitches not matter what triggered the recompilation.

Heres a file made for 3.3. Everything is smooth and looks great. I had to replace the MixRGB nodes. Files saved with blender 3.4+ opened in blender 3.3- will not detect the new mix node. **The mix node is not backwards compatible!** (i guess thats unwanted behaviour ) So yeah thats when the new mix node was programmed, around alpha 3.4. I´d be happy with the old behaviour, but i would suggest that mixnodes with keyframes or drivers are just treated and compiled with 2 channels all the time. Being recompiled while in playback doesnt make sense for any material anyways though. Being asynchrounous means many shader recompilations come in too late by default and create visual glitches not matter what triggered the recompilation.

Thanks for the file. This behabior was introduced in 6d7a067a83 and it is clearly intentional. However I can't tell whether the effects of this change are as desired. I would expect a previously used shader to be cached and ready to be reused quickly.
@pragma37, @fclem can you check?

Thanks for the file. This behabior was introduced in 6d7a067a83bbae7ebb965e364eb9a6b8d0f333f3 and it is clearly intentional. However I can't tell whether the effects of this change are as desired. I would expect a previously used shader to be cached and ready to be reused quickly. @pragma37, @fclem can you check?
Richard Antalik added
Status
Needs Info from Developers
and removed
Status
Needs Information from User
labels 2023-03-29 18:58:36 +02:00
Member

Yes, this was indeed intentional although I wasn't aware of the playback issue.
There's a simple fix for it, but it can cause small hiccups when the shader cache gets garbage collected, so I'd like to improve the shader GC behavior as well.

Yes, this was indeed intentional although I wasn't aware of the playback issue. There's a simple fix for it, but it can cause small hiccups when the shader cache gets garbage collected, so I'd like to improve the shader GC behavior as well.
Miguel Pozo self-assigned this 2023-03-29 20:24:23 +02:00
Member

@Ulf3000

It also breaks viewport animation rendering because these glitches are saved into the rendered image.

Could you double check this? I can't reproduce it myself and looking at the code I don't see how it could actually happen.

For actual viewport playback, there's no good way to go back to the old behavior without introducing other regressions. The improved GC behavior helps, but doesn't fully solve it.
I'd suggest you to use object attributes for the animated mix factors, so the inactive nodes can't be optimized out and cause a recompilation.
Like this:
imagen

@Ulf3000 > It also breaks viewport animation rendering because these glitches are saved into the rendered image. Could you double check this? I can't reproduce it myself and looking at the code I don't see how it could actually happen. For actual viewport playback, there's no good way to go back to the old behavior without introducing other regressions. The improved GC behavior helps, but doesn't fully solve it. I'd suggest you to use object attributes for the animated mix factors, so the inactive nodes can't be optimized out and cause a recompilation. Like this: ![imagen](/attachments/4350ddbd-68c8-4358-a4a3-b0d89591647b)
685 KiB
Member

In the end, we have decided that blocking the scene playback for shader compilation could cause more harm than good.

Imagine loading a scene, switch to render / lookdev shading mode, hitting play, then your screen freezes until all shaders are compiled.

The improved GC behavior helps, but the best "fix" is to use object attributes for the animated mix factors.

In the end, we have decided that blocking the scene playback for shader compilation could cause more harm than good. > Imagine loading a scene, switch to render / lookdev shading mode, hitting play, then your screen freezes until all shaders are compiled. The improved GC behavior helps, but the best "fix" is to use object attributes for the animated mix factors.
Blender Bot added
Status
Archived
and removed
Status
Needs Info from Developers
labels 2023-04-10 11:50:48 +02:00
Author

@Ulf3000

It also breaks viewport animation rendering because these glitches are saved into the rendered image.

Could you double check this? I can't reproduce it myself and looking at the code I don't see how it could actually happen.

For actual viewport playback, there's no good way to go back to the old behavior without introducing other regressions. The improved GC behavior helps, but doesn't fully solve it.
I'd suggest you to use object attributes for the animated mix factors, so the inactive nodes can't be optimized out and cause a recompilation.
Like this:
imagen

no i connot confirm, i now tried with multiple scenes and they all rendered correctly , maybe it was just one or versions inbetween which did that.

> @Ulf3000 > > > It also breaks viewport animation rendering because these glitches are saved into the rendered image. > > Could you double check this? I can't reproduce it myself and looking at the code I don't see how it could actually happen. > > For actual viewport playback, there's no good way to go back to the old behavior without introducing other regressions. The improved GC behavior helps, but doesn't fully solve it. > I'd suggest you to use object attributes for the animated mix factors, so the inactive nodes can't be optimized out and cause a recompilation. > Like this: > ![imagen](/attachments/4350ddbd-68c8-4358-a4a3-b0d89591647b) no i connot confirm, i now tried with multiple scenes and they all rendered correctly , maybe it was just one or versions inbetween which did that.
Author

Imagine loading a scene, switch to render / lookdev shading mode, hitting play, then your screen freezes until all shaders are compiled.


thats notthe problem , but in animation work you have to watch everything in loop... imagine people who use switching textires for their characters face and cant even evaluate the animation because the head turns white/grey/unshaded on every new facial expression.

for other people who might find this through google though:
i found a better fix though(something which doesnt force you to use multiple settings panels), or maybe not better but easier to handle for the artist.

grafik

just use a value node and a clamp at a really low value aka 0.001, the alpha channel from the 0.001 doesnt seem to create artifacts, it looks exactly like 0.

with clamp
grafik

without clamp

grafik

`Imagine loading a scene, switch to render / lookdev shading mode, hitting play, then your screen freezes until all shaders are compiled.` --- thats notthe problem , but in animation work you have to watch everything in loop... imagine people who use switching textires for their characters face and cant even evaluate the animation because the head turns white/grey/unshaded on every new facial expression. for other people who might find this through google though: i found a better fix though(something which doesnt force you to use multiple settings panels), or maybe not better but easier to handle for the artist. ![grafik](/attachments/2b117651-45e9-431e-ba44-af32fc6dc8c9) just use a value node and a clamp at a really low value aka 0.001, the alpha channel from the 0.001 doesnt seem to create artifacts, it looks exactly like 0. with clamp ![grafik](/attachments/bfde6797-479c-4cda-a9f8-b4e5004a0c79) without clamp ![grafik](/attachments/455cae75-225f-4d2c-b173-81c17b0541c0)
Member

i found a better fix though(something which doesnt force you to use multiple settings panels), or maybe not better but easier to handle for the artist.

If you prefer to only use nodes, simply connecting a Value node to the Factor input should do the trick too.

imagen

> i found a better fix though(something which doesnt force you to use multiple settings panels), or maybe not better but easier to handle for the artist. If you prefer to only use nodes, simply connecting a Value node to the Factor input should do the trick too. ![imagen](/attachments/42d1028b-039c-4a6c-8356-60a2ee74330c)
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
5 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#105057
No description provided.