I’ve just updated to unreal engine 5.4 and sadly all HLSL nodes are not working anymore
Here’s the code which was working fine in previous versions:
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.