Getting LODColoration debug view mode to work in standalone builds

Hi there,

Our character team is trying to utilize the LODColoration debug view mode for visualizing and debugging LODs of character meshes. We are hoping to get it to work in standalone builds as well. We are on 5.4.2 currently so no access to nanite skeletal meshes yet.

What I tried so far:

  • Setting r.ForceDebugViewModes to 1 in ConsoleVariables.ini, and also made sure all buffer visualization materials are cooked. This makes things like buffer visualizations become available in standalone builds, but doens’t seem to work for LODColoration. Tried setting `ShowFlag.LODColoration` to 1 and then running `viewmode LODColoration` doesn’t display the same debug color on characters as what it does in editor.
  • Did some PIX captures and stepping through engine’s code base, looks like LODColoration showflag is getting overwritten in SceneView.cpp in the constructor of FSceneViewFamily, where there is a function call to AllowDebugViewShaderMode(). It turns off all the debug shader mode except for shader complexity in 5.4.2 when not in editor build. I tried a quick hack locally to allow LODColoration for PC platforms in AllowDebugViewShaderMode(). With the hack, I do see DebugViewMode pass now shows up in PIX capture, but all characters shows up as black when LODColoration view mode is enabled. It seems though the debug view mode render pass is added in RDG, but it doesn’t dispatch any draw calls. With some further digging, I found that the call to FDebugViewModeMeshProcessor::AddMeshBatch() is failing to find shaders for debug view mode pass, possibly meaning that material shaders for this mesh pass are not compiled during cook intentionally?

Wondering where should I look into next to learn more about what’s causing these shader to be not available in standalone builds? My gut feeling is that there must be some quick engine changes to make these shader become available but also it will probably take me a long time going through the engine code to find it, so hoping that folks on EPS would know where to look. Thanks in advance!

Best,

Min

Hello,

Thank you for reaching out.

I’ve been assigned this issue, and we will be looking into the LOD Coloration view mode at runtime for you.

Hello,

CL 41296531 on Main refactored debug shader compilation, allowing them to be used at runtime with a running ODSC server.

The ODSC server (part of the cook commandlet) will compile the debug viewmode shaders at runtime on request.

For information about using ODSC, please see the attached PDF.

UShell, used in launching the ODSC server, can be found in the /Engine/Extras directory. More information about UShell can be found here:

Please let us know if this helps.

Hi Stephen,

Thanks for sharing the info about ODSC server. It seems really handy for things like hot reloading shader or material changes in a packaged build without having to do a full re-cook. Unfortunately, we are still on 5.4.2, and don’t have the changes in CL 41296531 you shared. Is there any other dependent changes besides CL 41296531 that I need to backport in order to make this work?

Aside from getting LODColoration to work in packaged builds, I’m very curious about the ODSC server you mentioned as it will help our iteration time a lot for testing shader or material changes in packaged builds, wondering when was the ODSC server added? I tried running the ODSC server using ushell and the command “.cook odsc all” shared in the document with no luck. I suspect the version of engine and ushell we have don’t have the changes for ODSC server yet? I briefly looked at the options supported by the cook commandlet in our current engine’s code base, and don’t see any options related to ODSC. The closest thing I found was cook on the fly server but not sure if it’s capable of recompiling shaders on demand for a packaged build.

In the case if we don’t have access to ODSC server in 5.4.2 yet, what’s your recommended workflow for testing shader or material changes in a packaged build besides recooking and staging. Sorry about asking multiple questions in one post and thank you in advance!

Min

Hello,

Neither we nor our colleagues identified any dependent CLs for 41296531.

ODSC server does exist in 5.4. The ODSC server is part of the CookOnTheFly operation of the cook commandlet. The following CLs after 5.4 improve it and fix some bugs: 33174009, 33342935, 33392475, 33965965, 34416132, 34834266, 34926699

The UShell command runs this command under the hood:

UnrealEditor-Cmd.exe <full/path/to/project.uproject> -run=cook -odsc -targetplatform=<YourTargetPlatform> -cookcultures=en -unversioned -stdout -cookonthefly -dpcvars=r.ShaderDevelopmentMode=1UShell added support for ODSC server in CL: 35016244

The CookOnTheFly server (of which ODSC server is a part) is Unreal Engine’s solution to iterating content, such as shaders, on-device. If you cannot use it, then cooking and staging for each test is required.

Please let us know if this helps.