Visualize Mesh Features and Metadata

Hello,
I am trying to follow this guide: Visualize Mesh Features and Metadata – Cesium
on how to display metadata based on some features of the 3D tile.

As a starting project I took a Cesium ForUnrealSamples with the newest Cesium for Unreal plugin 2.9.0.
Every thing is going well until connecting the generated material with custom logic to a base color of SetMaterialAttributes.

Then I got a two separate errors
First error:
LogShaderCompilers: Warning: Failed to compile Material /CesiumForUnreal/Materials/M_CesiumBaseMaterial.M_CesiumBaseMaterial (MI:/Game/MI_CesiumThreeOverlaysAndClippingNewYork.MI_CesiumThreeOverlaysAndClippingNewYork) for platform PCD3D_SM5, Default Material will be used in game.
/Engine/Generated/Material.ush:3969:23: error: no matching function for call to ‘LWCSubtract’
FLWCScalar Local14 = LWCSubtract(Local11, 30.00000000);
^~~~~~~~~~~
/Engine/Private/LWCOperations.ush:57:12: note: candidate function not viable: no known conversion from ‘literal float’ to ‘FLWCScalar’ for 2nd argument
FLWCScalar LWCSubtract(float Lhs, FLWCScalar Rhs) { return MakeLWCScalar(- (( Rhs ).Tile), Lhs - Rhs.Offset); }
^
/Engine/Private/LWCOperations.ush:58:12: note: candidate function not viable: no known conversion from ‘float’ to ‘FLWCScalar’ for 1st argument
FLWCScalar LWCSubtract(FLWCScalar Lhs, float Rhs) { return MakeLWCScalar( (( Lhs ).Tile), Lhs.Offset - Rhs); }
^
/Engine/Private/LWCOperations.ush:57:13: note: candidate function not viable: no known conversion from ‘literal float’ to ‘FLWCVector2’ for 2nd argument
FLWCVector2 LWCSubtract(float2 Lhs, FLWCVector2 Rhs) { return MakeLWCVector2(- (( Rhs ).Tile), Lhs - Rhs.Offset); }
^
/Engine/Private/LWCOperations.ush:58:13: note: candidate function not viable: no known conversion from ‘float’ to ‘FLWCVector2’ for 1st argument
FLWCVector2 LWCSubtract(FLWCVector2 Lhs, float2 Rhs) { return MakeLWCVector2( (( Lhs ).Tile), Lhs.Offset - Rhs); }
^
/Engine/Private/LWCOperations.ush:57:13: note: candidate function not viable: no known conversion from ‘literal float’ to ‘FLWCVector3’ for 2nd argument
FLWCVector3 LWCSubtract(float3 Lhs, FLWCVector3 Rhs) { return MakeLWCVector3(- (( Rhs ).Tile), Lhs - Rhs.Offset); }
^
/Engine/Private/LWCOperations.ush:58:13: note: candidate function not viable: no known conversion from ‘float’ to ‘FLWCVector3’ for 1st argument
FLWCVector3 LWCSubtract(FLWCVector3 Lhs, float3 Rhs) { return MakeLWCVector3( (( Lhs ).Tile), Lhs.Offset - Rhs); }
^
/Engine/Private/LWCOperations.ush:57:13: note: candidate function not viable: no known conversion from ‘literal float’ to ‘FLWCVector4’ for 2nd argument
FLWCVector4 LWCSubtract(float4 Lhs, FLWCVector4 Rhs) { return MakeLWCVector4(- (( Rhs ).Tile), Lhs - Rhs.Offset); }
^
/Engine/Private/LWCOperations.ush:58:13: note: candidate function not viable: no known conversion from ‘float’ to ‘FLWCVector4’ for 1st argument
FLWCVector4 LWCSubtract(FLWCVector4 Lhs, float4 Rhs) { return MakeLWCVector4( (( Lhs ).Tile), Lhs.Offset - Rhs); }
^
/Engine/Private/LWCOperations.ush:56:12: note: candidate function not viable: no known conversion from ‘float’ to ‘FLWCScalar’ for 1st argument
FLWCScalar LWCSubtract(FLWCScalar Lhs, FLWCScalar Rhs) { return MakeLWCScalar( (( Lhs ).Tile) - (( Rhs ).Tile), Lhs.Offset - Rhs.Offset); }
^
/Engine/Private/LWCOperations.ush:56:13: note: candidate function not viable: no known conversion from ‘float’ to ‘FLWCVector2’ for 1st argument
FLWCVector2 LWCSubtract(FLWCVector2 Lhs, FLWCVector2 Rhs) { return MakeLWCVector2( (( Lhs ).Tile) - (( Rhs ).Tile), Lhs.Offset - Rhs.Offset); }
^
/Engine/Private/LWCOperations.ush:56:13: note: candidate function not viable: no known conversion from ‘float’ to ‘FLWCVector3’ for 1st argument
FLWCVector3 LWCSubtract(FLWCVector3 Lhs, FLWCVector3 Rhs) { return MakeLWCVector3( (( Lhs ).Tile) - (( Rhs ).Tile), Lhs.Offset - Rhs.Offset); }
^
/Engine/Private/LWCOperations.ush:56:13: note: candidate function not viable: no known conversion from ‘float’ to ‘FLWCVector4’ for 1st argument
FLWCVector4 LWCSubtract(FLWCVector4 Lhs, FLWCVector4 Rhs) { return MakeLWCVector4( (( Lhs ).Tile) - (( Rhs ).Tile), Lhs.Offset - Rhs.Offset); }
^
/Engine/Generated/Material.ush:3972:23: error: no matching function for call to ‘LWCSubtract’
FLWCScalar Local17 = LWCSubtract(Local12, 1700.00000000);


Second error:
LogOutputDevice: Error: === Handled ensure: ===
*LogOutputDevice: Error: Ensure condition failed: false [File:D:\build++UE5\Sync\Engine\Source\Runtime\Engine\Private\Materials\HLSLMaterialTranslator.cpp] [Line: 8558] *
LogOutputDevice: Error: FHLSLMaterialTranslator::IsExpressionConstantValue - Unknown constant expression type
*LogOutputDevice: Error: Stack: *
LogOutputDevice: Error: [Callstack] 0x00007ff91a226282 UnrealEditor-Engine.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff91a1e056d UnrealEditor-Engine.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff91a1d1435 UnrealEditor-Engine.dll!UnknownFunction []

Custom logic in generated material from CesiumFeaturesMetadata component:

Is the problem in my implementation or in the CesiumBaseMaterial?
Thank you very much for any suggestions and solutions. :slightly_smiling_face:

It looks like you’re seeing a lot of errors related to Unreal’s Large World Coordinates changes in Unreal 5. What version of Unreal are you using?

I tried it on versions 5.4.1 and 5.4.4.

Hi @NicolasNguyen,
I’m not sure where those errors might be coming from. First thing to check: does the Metadata level in the Cesium for Unreal Samples project for you?

Hello @Kevin_Ring,
Yes, both 06_CesiumMetadata and 10_CesiumOSMWindows_Metadata are working fine.
The error only occurs, when I am trying to make my own material for the CesiumEncodedMetadata component following the tutorial mentioned above.

Thank you

Good to hear the Samples work, at least. I haven’t run through the tutorial myself in a little while, but I’m not aware of any problems with it. Since the Samples do work for you, perhaps it would be beneficial to compare the materials included with them against the ones you developed during the tutorial, and see if you can spot the difference?

I tried to find some differences and potential problems. I found that the cause of the problem is somewhere before the MakeFloat3 , when I add a constant instead of Results of RemapValueRangeNormalized the errors are gone. Also when I was comparing the 10_CesiumOSMWindows_Metadata from cesium project CesiumForUnrealSamples I noticed that in that example is used different component: CesiumEncodedMetadata but in the tutorial is used CesiumFeaturesMetadata . The descriptions of these components are the same, but the funkcionality is different. There is no mention about this, why? I use same version for CesiumForUnrealSamples and the tutorial. So used components should be the same. Thank you.

Hi @NicolasNguyen,

Thanks for the note. I’m not sure why the RemapValueRangeNormalized node resulted in issues. :thinking:

The CesiumEncodedMetadata component is actually outdated, and was meant to be replaced by CesiumFeaturesMetadata. Alas, we forgot to update that level you mentioned, so it is still using the deprecated API. I’ve made an issue here for the samples project so we can get an eventual fix:

Thanks for bringing this to our attention!

1 Like