Shader Template files like MaterialTemplate.ush do not submit previous chunks when encountering a `%` character, unless that `%` character is `%s` or `%
{...}`.
Because the error is happening during a string processing step, `%` characters inside of comments will also cause the issue.
Callstack contains the Shader Compiler errors.
1. Download the attached test project.
2. Enable Shader Development Mode in ConsoleVariables.ini
3. In MaterialTemplate.ush, add this comment near Line 315. The last two lines below are from the file as a reference point. It is important to place the added code above them:
```
/** This is a comment that uses the % character. */
/** Material declarations */
%
```
4. Open the test project (or any other project)
5. Observe the Shader Compiler error. Observe that the error occurs at the `%` before the added code. This is on line 94: `%
`
6. Make the C++ changes suggested by the Licensee, recompile and repeat step 4
7. Observe the Shader Compiler errors have been corrected.
10 Shader compiler errors compiling DefaultDeferredDecalMaterial for platform PCD3D_SM6: Shader debug info dumped to: "D:/Dev/UE540/Default3P/Saved/ShaderDebugInfo/PCD3D_SM6/DefaultDeferredDecalMaterial_6b60f7a3d6395f96/Default/FSplineMeshVertexFactory/FMeshDecalsVS/0_0df5d6bfa70a09a8" D:/Dev/UE540/Engine/Shaders/Private/MaterialTemplate.ush(94,1): Shader FMeshDecalsVS, Permutation 0, VF FSplineMeshVertexFactory: /Engine/Generated/Material.ush:94:1: error: expected unqualified-id % ^ D:/Dev/UE540/Engine/Shaders/Private/MaterialTexture.ush(151,9): Shader FMeshDecalsVS, Permutation 0, VF FSplineMeshVertexFactory: /Engine/Private/MaterialTexture.ush:151:9: error: use of undeclared identifier 'ProcessMaterialColorTextureLookup'; did you mean 'ProcessMaterialVirtualColorTextureLookup'? return ProcessMaterialColorTextureLookup(TextureValue); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:/Dev/UE540/Engine/Shaders/Private/MeshDecals.usf(): Shader FMeshDecalsVS, Permutation 0, VF FSplineMeshVertexFactory: ProcessMaterialVirtualColorTextureLookup D:/Dev/UE540/Engine/Shaders/Private/MaterialTexture.ush(149,8): Shader FMeshDecalsVS, Permutation 0, VF FSplineMeshVertexFactory: /Engine/Private/MaterialTexture.ush:149:8: note: 'ProcessMaterialVirtualColorTextureLookup' declared here float4 ProcessMaterialVirtualColorTextureLookup(float4 TextureValue) ^ D:/Dev/UE540/Engine/Shaders/Private/MaterialTexture.ush(159,9): Shader FMeshDecalsVS, Permutation 0, VF FSplineMeshVertexFactory: /Engine/Private/MaterialTexture.ush:159:9: error: use of undeclared identifier 'ProcessMaterialColorTextureLookup' return ProcessMaterialColorTextureLookup(TextureValue); ^ D:/Dev/UE540/Engine/Shaders/Private/MaterialTexture.ush(211,17): Shader FMeshDecalsVS, Permutation 0, VF FSplineMeshVertexFactory: /Engine/Private/MaterialTexture.ush:211:17: error: use of undeclared identifier 'ProcessMaterialColorTextureLookup'; did you mean 'ProcessMaterialAlphaTextureLookup'? case 0: return ProcessMaterialColorTextureLookup(Value); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:/Dev/UE540/Engine/Shaders/Private/MeshDecals.usf(): Shader FMeshDecalsVS, Permutation 0, VF FSplineMeshVertexFactory: ProcessMaterialAlphaTextureLookup D:/Dev/UE540/Engine/Shaders/Private/MaterialTexture.ush(198,8): Shader FMeshDecalsVS, Permutation 0, VF FSplineMeshVertexFactory: /Engine/Private/MaterialTexture.ush:198:8: note: 'ProcessMaterialAlphaTextureLookup' declared here float4 ProcessMaterialAlphaTextureLookup(float4 TextureValue) ^ D:/Dev/UE540/Engine/Shaders/Private/MaterialTemplate.ush(3923,18): Shader FMeshDecalsVS, Permutation 0, VF FSplineMeshVertexFactory: /Engine/Generated/Material.ush:3923:18: error: use of undeclared identifier 'ProcessMaterialColorTextureLookup'; did you mean 'ProcessMaterialAlphaTextureLookup'? float4 Local2 = ProcessMaterialColorTextureLookup(Texture2DSampleBias(Material_Texture2D_0,Material_Texture2D_0Sampler, Local0 ,View.MaterialTextureMipBias)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:/Dev/UE540/Engine/Shaders/Private/MeshDecals.usf(): Shader FMeshDecalsVS, Permutation 0, VF FSplineMeshVertexFactory: ProcessMaterialAlphaTextureLookup \\ \\ Retry compilation?
i have this problem UE4CC-Windows-58DC12AF4B97F057BD108FBFF569B2E9_0000
I am not able to find world outliner how to enable it?
Undefined sysmbol: typeinfo for AActor when cross-compile linux dedicated server on windows
How can i modify the param name in EQS node
How to achieve HLSL Multiple Render Target in Material blueprints?
How does UMG set overlapping layouts?
What method is used to fill polygonal regions when drawing spline mesh at run time?
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-218797 in the post.
0 |
Component | UE - Rendering Architecture - Materials |
---|---|
Affects Versions | 5.4, 5.4.2, 5.4.1 |
Target Fix | 5.5 |
Fix Commit | 36566198 |
---|
Created | Jun 25, 2024 |
---|---|
Resolved | Sep 25, 2024 |
Updated | Oct 2, 2024 |