Empty material uses 13 of 16 samplers? (OpenGL, Linux, UE 4.18.3)

Heyo - I’m trying to set up a material however I very quickly run out of texture samplers. Upon looking into this, it appears that UE4 uses 13 samplers for a newly created empty material! I thought it only needed around 3 or 4.

I found that I could try setting my sampler parameters to “Shared: Wrap” to prevent then from taking up what limited number of sampler slots I had, but this seemed to do nothing. I was informed that this was probably due to me using the OpenGL renderer over on the Unreal Slackers Discord group.

Anyways, is this a known issue with Unreal, or does anyone know any workarounds? Any advice would be much appreciated :slight_smile:

Some details:

  • OS: Arch Linux
  • Renderer: OpenGL, using Shader Model 5
  • UE4 version: 4.18.3 (Compiled from source at tag 4.18.3-release)

I’m having the exact same issue.
When creating a material with more than 3 texture samplers I get the error for exceeding the limit of 16.

My system configuration is similar:

  • OS: Linux Mint 18.3
  • Renderer: OpenGL3, SM4.0
  • UE4 version: 4.18.3 compiled from source

By the way, shouldn’t the limit for SM5 be 32 samplers?

Ah good to know I’m not the only one with the issue.

And I thought the sampler count was limited to 16 because of a Direct3D limitation - I didn’t think SM5 would increase it? [HR][/HR]EDIT

Nevermind I found a thing that says the OpenGL 4.3 path should have 32 samplers max (…texture-s.html) - but the log does say it’s using OGL 4.3 and SM5. Perhaps I’ll try merging the PR in that answers page later.

[2018.04.17-18.44.03:438]  0]LogRHI: OpenGL MajorVersion = 4, MinorVersion = 3, ShaderPlatform = GLSL_430, FeatureLevel = SM5

Hi, have you get working that pr?

Yeah, the PR works fine for me. Merge in the PR locally, then rerun ./, ./, and make to recompile the engine (It’s a large recompile, around 1000+ steps)

You may need to run “export TERM=xterm” first if you get a magic number error to workaround a mono bug

Thanks for the info! I find out that my shader actually uses something like 40 samplers, so I switched to Vulkan, that seems to work even better than OpenGL. (Some geometry is lost and etc)