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?
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.
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?
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?
Engine\Source\Runtime\RHI\Public\RHIDefinitions.h line 1634
return 75; —> return 144;
IsFeatureLevelSupported(Platform, ERHIFeatureLevel::SM5) || IsVulkanPlatform(Platform) || IsMetalPlatform(Platform); —> return true;
InFeatureLevel > ERHIFeatureLevel::ES3_1 || IsVulkanPlatform(GMaxRHIShaderPlatform) || IsMetalPlatform(GMaxRHIShaderPlatform); —> return true;
line 02 add:
// this comment to force recompile shaders.
Recompile the engine.