Change ES3_1 bone number limit to 256

With UE4.20, we have sucessfully increased the bone number limit for es3_1 from 75 to 256 to match the hardware limit. Basically we replaced the uniform buffer with the vertex SRV buffer(which is the default path for feature level sm4 and above) to transmit bone matrices to GPU, and it works fine.

But with UE4.23 preview 4, this change fails to work. It seems the srv buffer method no longer works for es3_1. I noticed some code changes in GPUSkinVertexFactory but none of them seem relevant.

Any input on this?

Hi, zxy165777

There are two functions have to be modified, the GetFeatureLevelMaxNumberOfBones and SupportsBonesBufferSRV.

Change the limitation to support FeatureLevel::ES3_1 and the max bone number to 256.

Don’t forget to recompile the shaders, or SkeletalMesh will use the old shaders which were cached in DDC.

Hi.

I am trying to increase the number of bones on 4.25, I could find GetFeatureLevelMaxNumberOfBones in RHIDefinitions, can you please point me what to change SupportsBonesBufferSRV?

Thank you!

Hi NaitguoIf,
Just change the SupportsBonesBufferSRV to return true for all feature levels and shader platforms.

I believe you should invalidate the shader to let it rebuild. You could add any comment in the MobileBasePassVertexShader.usf to make it modified and let the DDC invalidate, so the shader will be rebuild.

Awesome, it is working! Many, many thanks!!!

Thank you Liu. Now preview render works (no more crash) sadly, the model is broken once is deployed on the device (tried S8+ and Razer v2.

Guys, i’m lost. Can someone point me in the right direction so i could also make these changes?

Hi, these are the steps I followed:

How to increase bone limit for ES 3.1?

Source:
Engine\Source\Runtime\RHI\Public\RHIDefinitions.h line 1634

return 75; —> return 144;

Engine\Source\Runtime\Engine\Private\GPUSkinVertexFactory.cpp

line 92:

IsFeatureLevelSupported(Platform, ERHIFeatureLevel::SM5) || IsVulkanPlatform(Platform) || IsMetalPlatform(Platform); —> return true;

line 99:

InFeatureLevel > ERHIFeatureLevel::ES3_1 || IsVulkanPlatform(GMaxRHIShaderPlatform) || IsMetalPlatform(GMaxRHIShaderPlatform); —> return true;

Engine\Shaders\Private\MobileBasePassVertexShader.usf

line 02 add:

// this comment to force recompile shaders.

Recompile the engine.

Cheers.