# HLSL Custom Node Breaks After Upgrade to Unreal Engine 5.4: Type Mismatch and Function Call Errors

**URL:** <https://forums.unrealengine.com/t/hlsl-custom-node-breaks-after-upgrade-to-unreal-engine-5-4-type-mismatch-and-function-call-errors/1823561>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, hlsl\
**Created:** [April 26, 2024, 8:35pm UTC](https://forums.unrealengine.com/t/hlsl-custom-node-breaks-after-upgrade-to-unreal-engine-5-4-type-mismatch-and-function-call-errors/1823561 "2024-04-26T20:35:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MachinaInfinitum](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MachinaInfinitum](https://forums.unrealengine.com/u/MachinaInfinitum)\
**Post date:** [April 26, 2024, 8:35pm UTC](https://forums.unrealengine.com/t/hlsl-custom-node-breaks-after-upgrade-to-unreal-engine-5-4-type-mismatch-and-function-call-errors/1823561/1 "2024-04-26T20:35:21Z")

</div>

I’ve just updated to unreal engine 5.4 and sadly all HLSL nodes are not working anymore

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/7/6/676c08b439c28c994f800d07f3b52cb6a1b6791f.png)  
Here’s the code which was working fine in previous versions:

```auto
float planeDist = View.ViewToClip[3][2] * (1.0+FixDist);
float3 localPos = LWCMultiply(DERIV_BASE_VALUE(GetWorldPosition(Parameters)), GetPrimitiveData(Parameters).WorldToLocal);
float fov = View.ClipToView[0][0].x;
float3 CamPosition = LWCMultiply(LWCSubtract(mul(float4(0,0,0,1), ResolvedView.ViewToTranslatedWorld).xyz, ResolvedView.PreViewTranslation), GetPrimitiveData(Parameters).WorldToLocal);
float ratio = View.ViewSizeAndInvSize.y / View.ViewSizeAndInvSize.x;
float diagonal = length(fov * float2(ratio, 1.0));
float z = sqrt(1.0 - diagonal * diagonal);
float3 viewPos = float3(1, -ratio, 0) * planeDist * localPos * fov * 0.02 * (1.1) + float3(0, 0, planeDist);
float3 worldFPos = mul(float4(viewPos, 1), ResolvedView.ViewToTranslatedWorld).xyz;
return LWCToFloat(LWCSubtract(LWCSubtract(worldFPos, ResolvedView.PreViewTranslation), DERIV_BASE_VALUE(GetWorldPosition(Parameters))));

```

I’ve looked at the documentation but could not find anything about this case ☹

It looks like the main issue is about LWC and double float could fix it but I can’t find a way.

---

<div class="post-metadata">

**Author:** ![\_Z11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@\_Z11](https://forums.unrealengine.com/u/_Z11)\
**Post date:** [May 24, 2024, 9:43am UTC](https://forums.unrealengine.com/t/hlsl-custom-node-breaks-after-upgrade-to-unreal-engine-5-4-type-mismatch-and-function-call-errors/1823561/2 "2024-05-24T09:43:53Z")

</div>

I have the same question,My custom Node have worry noise ,but the code can work in 4.26 version.Have you solved it?

---

<div class="post-metadata">

**Author:** ![TheHammerSV](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TheHammerSV](https://forums.unrealengine.com/u/TheHammerSV)\
**Post date:** [June 2, 2024, 4:45pm UTC](https://forums.unrealengine.com/t/hlsl-custom-node-breaks-after-upgrade-to-unreal-engine-5-4-type-mismatch-and-function-call-errors/1823561/3 "2024-06-02T16:45:17Z")

</div>

I have the same issue as well. After upgrading a copy of my project to 5.4, I get errors with LWCMultiply in my HLSL node.

---

<div class="post-metadata">

**Author:** ![TheHammerSV](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TheHammerSV](https://forums.unrealengine.com/u/TheHammerSV)\
**Post date:** [June 2, 2024, 6:09pm UTC](https://forums.unrealengine.com/t/hlsl-custom-node-breaks-after-upgrade-to-unreal-engine-5-4-type-mismatch-and-function-call-errors/1823561/4 "2024-06-02T18:09:52Z")

</div>

I was able to find a solution for my problems. This page in the Unreal Documentation was very helpful: [Large World Coordinates Rendering In Unreal Engine 5. | Unreal Engine 5.4 Documentation | Epic Developer Community](https://dev.epicgames.com/documentation/en-us/unreal-engine/large-world-coordinates-rendering-in-unreal-engine-5)

I had to convert my node to use the DoubleFloat.ush math library, which didn’t exist in previous versions of unreal. It was also helpful to open up that file and look through it. Mainly all I had to do was change LWCMultiply and LWCMultiplyVector to DFMultiplyVector, and change FLWCInverseMatrix to FDFInverseMatrix. There were a few variables and functions that didn’t plug in to these cleanly, but they have some conversion functions to help deal with that which are explained in the documentation. The two conversion functions I used were DFFromTileToOffset and LWCHackToFloat. These functions will cause a performance hit, but I am using this in a pre-rendered short film, so they work for me.

Here is my old code:

```auto
FLWCInverseMatrix WorldToLocal = GetWorldToInstance(Parameters);
float3 Scale = LWCMultiplyVector(float3(1.0, 0.0, 0.0), GetInstanceToWorld(Parameters));
float3 CameraPositionLS = LWCToFloat(LWCMultiply(ResolvedView.WorldCameraOrigin, WorldToLocal));
float3 CameraVectorLS = LWCMultiplyVector(CameraVectorWS, GetPrimitiveData(Parameters).WorldToLocal);

```

And here is my new code after converting it to work with 5.4:

```auto
FDFInverseMatrix WorldToLocal = DFFromTileOffset(GetWorldToInstance(Parameters));
float3 Scale = DFMultiplyVector(float3(1.0, 0.0, 0.0), DFFromTileOffset(GetInstanceToWorld(Parameters)));
float3 CameraPositionLS = DFMultiplyVector(LWCHackToFloat(ResolvedView.WorldCameraOrigin), WorldToLocal);
float3 CameraVectorLS = DFMultiplyVector(CameraVectorWS, GetPrimitiveData(Parameters).WorldToLocal);

```
