GPUShader: error: too many samplers in shader. #77240

Closed
opened 2020-05-31 22:18:05 +02:00 by Christophe Schollhammer · 18 comments

gpu_error.zip
System Information
Operating system:windows 10
Graphics card:nvidia rtx 2060s

Blender Version
Broken: 2.82, 2.83 ff1040c6fe
Worked: (newest version of Blender that worked as expected)

Short description of error
When in the viewport I want to switch to Material Preview, the object get pink and I get in the console this error
GPUShader: error: too many samplers in shader.

This happen when I add/link too much mixshader or mixrgb node

Exact steps for others to reproduce the error
Based on the default startup or an attached .blend file (as simple as possible).

As this is specific to this file, I attach the file
If you remove one mixshader or one mixrgb it's ok, the preview is fine

[gpu_error.zip](https://archive.blender.org/developer/F8568247/gpu_error.zip) **System Information** Operating system:windows 10 Graphics card:nvidia rtx 2060s **Blender Version** Broken: 2.82, 2.83 ff1040c6fefc Worked: (newest version of Blender that worked as expected) **Short description of error** When in the viewport I want to switch to Material Preview, the object get pink and I get in the console this error GPUShader: error: too many samplers in shader. This happen when I add/link too much mixshader or mixrgb node **Exact steps for others to reproduce the error** Based on the default startup or an attached .blend file (as simple as possible). As this is specific to this file, I attach the file If you remove one mixshader or one mixrgb it's ok, the preview is fine

Added subscriber: @cscholl

Added subscriber: @cscholl

blender_gpu_error.jpg

![blender_gpu_error.jpg](https://archive.blender.org/developer/F8568389/blender_gpu_error.jpg)

Added subscriber: @DarkKnight

Added subscriber: @DarkKnight

I think this is intended behavior since its eevee previewing it and a realtime engine has its limits. Maybe someone will corret me but i guess this will get closed as invalid.

I think this is intended behavior since its eevee previewing it and a realtime engine has its limits. Maybe someone will corret me but i guess this will get closed as invalid.

So the Material preview mode is using evee engine ?

Well I have tried with evee renderer to test and it's the same pink render
Hence it would be a limitation of evee ?

So the Material preview mode is using evee engine ? Well I have tried with evee renderer to test and it's the same pink render Hence it would be a limitation of evee ?

Added subscriber: @sozap

Added subscriber: @sozap

So the Material preview mode is using evee engine ?

Yes !

Indeed Eevee has some limitations you can't have unlimited textures and or shader nodes inside a material even if yourGPU has enough memory ...
Cycles is also limited but the limitation bar is way higher.

By judging at your screenshot , you can rework you shader to have only one or a few principled nodes : mixing colors instead of mixing shaders . That would make the shader to run faster and it may solve your limitation issue.
https://blenderartists.org/t/mixing-multiples-shaders-in-eevee/1173843/3

I also think this report is more a known limitation rather than a bug...

> So the Material preview mode is using evee engine ? Yes ! Indeed Eevee has some limitations you can't have unlimited textures and or shader nodes inside a material even if yourGPU has enough memory ... Cycles is also limited but the limitation bar is way higher. By judging at your screenshot , you can rework you shader to have only one or a few principled nodes : mixing colors instead of mixing shaders . That would make the shader to run faster and it may solve your limitation issue. https://blenderartists.org/t/mixing-multiples-shaders-in-eevee/1173843/3 I also think this report is more a known limitation rather than a bug...
Member

Added subscriber: @Jeroen-Bakker

Added subscriber: @Jeroen-Bakker
Member

Changed status from 'Needs Triage' to: 'Archived'

Changed status from 'Needs Triage' to: 'Archived'
Jeroen Bakker self-assigned this 2020-06-02 15:00:19 +02:00
Member

This is a hardware limit. The used shader tree uses too many textures that isn't supported by the OpenGL Hardware it is rendering on. Try reducing the number of used textures. Or split your mesh to use multiple materials that only use a subset of the all the needed textures. Or Combine several mask images into a single mask image (store each mask in a single channel).

This is a hardware limit. The used shader tree uses too many textures that isn't supported by the OpenGL Hardware it is rendering on. Try reducing the number of used textures. Or split your mesh to use multiple materials that only use a subset of the all the needed textures. Or Combine several mask images into a single mask image (store each mask in a single channel).

Ok I have to rethink the way I'm using shaders as it is far from being optimised ;)
Thanks a lot for the advices Paul & Jeroen

Ok I have to rethink the way I'm using shaders as it is far from being optimised ;) Thanks a lot for the advices Paul & Jeroen

I have tried to use mixRGB nodes instead of mixshader nodes so I have replaced 3 mixshader nodes by 3 mixrgb nodes but I still have this problem
Is it normal ?
I must precise that I'm using udim textures
Thanks

I have tried to use mixRGB nodes instead of mixshader nodes so I have replaced 3 mixshader nodes by 3 mixrgb nodes but I still have this problem Is it normal ? I must precise that I'm using udim textures Thanks

Hello, you should ask these kind of question into related forums such as BlenderArtists.org, the bug tracker should be only used to report bugs...

Hello, you should ask these kind of question into related forums such as BlenderArtists.org, the bug tracker should be only used to report bugs...

Added subscriber: @Andrew_D-1

Added subscriber: @Andrew_D-1

This limitation occurs in Eevee when trying to use 24 different images or more in the same material.
Exactly that happens, "Purple" material and message "GPUShader: error: too many samplers in shader."
It is a known limitation in Eevee

This limitation occurs in Eevee when trying to use 24 different images or more in the same material. Exactly that happens, "Purple" material and message "GPUShader: error: too many samplers in shader." It is a known limitation in Eevee

Added subscriber: @JamesBaber

Added subscriber: @JamesBaber

Currently working on a metahuman face importer for blender, and this seems to be where I have hit a wall. I need a material that can blend between 42 different image inputs, plus 3 image inputs are need for the base material totaling to 45 needed image inputs to support all expressions . So to avoid breaking my shader at the moment, I cap the image inputs to 23 to stay under the 24th image that breaks the shader entirely, so some animated maps are missing in the facial expressions.

Why is 24 the limit? It seems a little strange to me that this is a hard number, since I would imagine it would be dynamic based on your systems GPU memory. Any thoughts?

Currently working on a metahuman face importer for blender, and this seems to be where I have hit a wall. I need a material that can blend between 42 different image inputs, plus 3 image inputs are need for the base material totaling to 45 needed image inputs to support all expressions . So to avoid breaking my shader at the moment, I cap the image inputs to 23 to stay under the 24th image that breaks the shader entirely, so some animated maps are missing in the facial expressions. Why is 24 the limit? It seems a little strange to me that this is a hard number, since I would imagine it would be dynamic based on your systems GPU memory. Any thoughts?
Member

@JamesBaber software runs on hardware. hardware drives limitations.

For sampling textures GPU manufacturers add specialized silicon for performance reasons (TMU). This silicon has to be setup before a draw call and cannot be changed during a draw call. In your case you can think atlas textures, channel remapping or delta mapping to reduce the number of samplers.

I can imagine unreal engine uses texture arrays to overcome the limitation that should be fast for this specific case. Using similar approaches in Eevee needs to be carefully designed as it could lead to lesser overall performance due to cache invalidation.

@JamesBaber software runs on hardware. hardware drives limitations. For sampling textures GPU manufacturers add specialized silicon for performance reasons (TMU). This silicon has to be setup before a draw call and cannot be changed during a draw call. In your case you can think atlas textures, channel remapping or delta mapping to reduce the number of samplers. I can imagine unreal engine uses texture arrays to overcome the limitation that should be fast for this specific case. Using similar approaches in Eevee needs to be carefully designed as it could lead to lesser overall performance due to cache invalidation.
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#77240
No description provided.