SM5 on Linux is limited to 16 texture samplers

Using Unreal Engine 4.10.1 on Linux, Shader Model 5 (OpenGL 4.3) is limited to 16 texture samplers per material, no matter what the samplers are set to use as their texture source (clamp or wrap).

I’m running the editor from the terminal, using the -opengl4 switch. The default memory allocator (binned) is used.

The engine is a direct-from-github compilation of the Release branch.

System information:
Linux Mint 17.3 Rosa (64-bit)
Nvida GeForce GTX 660Ti, 2048MB
Engine Version: 4.10.1-0+++depot+UE4-Releases+4.10

Hey -

How are you setting up your texture/texture sample in the editor? Can you provide a screenshot of exactly what you see when applying the texture?

Sure thing! This is the error produced in the terminal:

[2016.01.05-17.34.25:306][244]LogShaderCompilers:Warning: Failed to compile Material /Game/Materials/Maps/Tileset/Feralas.Feralas for platform GLSL_430, Default Material will be used in game.

As for the material, it’s set up like this:

The samplers are just textures, and they’re all set to Wrap. Same thing happens for Clamp, and I’m not 100% sure what the difference between them are x)

The Layer Blend just plugs right into BaseColor, and the visible network is replicated below for normal maps as well. I’m afraid I can’t show you an in-game screenshot at the moment, as I’m experiencing the black viewport bug again (for some reason, Scalability won’t override ProjectSettings, but that’s a whole 'nother bug report), but I’m sure you can picture gray checkerboards everywhere x) The default material is used everywhere the material is applied when it won’t compile.

The very same material works fine on Windows, where it was originally created.

After setting up a material based on your description/screenshot I realized that the problem is the OpenGL rendering path. As mentioned in the release notes linked below, DirectX can support more textures than OpenGL. Since Linux uses the OpenGL path to enable SM5 it falls into the same restrictions.

Here is the link to the release notes I mentioned.(What's New | Unreal Engine 5.1 Documentation)

Cheers

Yes, this is sort of what this report is about x)

As I have understood it, OpenGL 4.1 and below does not support more than 16 samplers, period. However, OpenGL 4.3 does support more than that, and the engine can and does run on 4.3 when running on Linux. I recall someone saying (can’t remember who) that Mac is stuck on 4.1 for now, but that doesn’t have to be the case for other platforms.

Are you absolutely certain that it is not possible to circumvent the limitation on Linux?

I have not been able to find any information about OpenGL4.3 supporting a different number of samples than previous versions. Could you post the link to where you found this information originally?

I’m searching for the original link at the moment, but it has been mentioned by Epic staff before.

According to marksatt-pitbull, it’s filed internally as UE-18641.

I did come across some discussions about circumventing the limitation here, for instance. However, I’m not a graphics programmer, so I can’t say for sure if it’s relevant. I’ll keep searching and talk to some buddies who are more involved in the rendering side of things.

The sample thing is supposed to work, but it does not, I don’t know if they will ever fix it though.

Still broken with the latest UE for the ocean project:

Ubuntu, OpenGL 4.5, shadermodel 5

Will continue on Windows and hope it gets fixed before my game is finished. Thanks

Is this going to receive any attention? I’m seeing this error while attempting to work on UT4 on Linux.

Currently our resources are dedicated elsewhere and UE-18641 is not a priority item for us to work on. We don’t have a timeframe for when this may be addressed. I have added additional comments to UE-18641 to indicate that this is still affecting many community members. Please keep in mind that with source code access, a programmer on your project can implement your own solution, and you are welcome to share that result with Epic for possible integration.

Definitely, and this is something we’re looking into. I’m not sure the current restriction even corresponds to the current state of OpenGL on Linux since most of the information I can find states modern cards expose at least 32 texture units.

Is there any information in the internal bug report that might be useful if I decide to look into this?

Thanks!

The bug report simply states that the issue with texture samples exists with information on reproducing it for internal testing.

This issue is now plaguing Unreal Tournament 4 under Linux. It’s affecting the post-processing and the Underland map, as well as most community made maps. This is seriously negatively affecting the Linux community’s user experience with UT4. Please make this a priority.

I believe I have a fix for this. Currently undergoing testing.

+1, just wanted to add that this is affecting my game’s Linux experience too.

Thanks to @madscientist159 for attempting a fix; engine-level code is a bit intimidating to dive into so I’m hoping you or Epic can rescue the rest of us with a fix! Thanks to everyone for all your efforts.

Fix ended up being fairly trivial. Per Epic’s wishes the OpenGL 3 path limit was left at 16 shaders for Mac compatibility, but the OpenGL 4.3 path limit was increased to 32 shaders. Testing the modification on OpenGL 4.3 (Gallium / mesa 12) showed much improved graphics and no obvious glitches when compared with the previous codebase.

Epic just opened up their internal issue tracker for direct voting on issues. This one is considered backlogged, but we might get them to move on it if we vote it up.

Yeah, with the OceanProject from TheZoc repo and 4.14 (he updated his to 4.14 because the official is stuck at 4.12) we still get the texture samples limit error message with opengl4 and sm5. http://imgur.com/a/HrOba Here is a screen shot of an instance of the Ocean Material. I can see the ocean, its glitchy at best, while disabling tessellation, but tessellation is needed for this project. It still complains about going over 16 samples. 22/16