back in UE4.26 there was the option to calculate the ClipSpace position of a vertex through View.WorldToClip
as can be seen in the docs: FViewUniformShaderParameters | Unreal Engine Documentation
However in later versions, like 5.1, this parameter is no longer present, does anybody know if there is a 1to1 replacement? I’ve played around with some of the parameters with the word “clip” in it but the results seem incorrect.
PS. is there any documentation out there which describes what all these parameters represent? or do we only have the name to go by?
It’s probably to do with the changes for Large World Coordinates - Large World Coordinates Rendering in Unreal Engine 5. | Unreal Engine 5.0 Documentation
With which World to clip space wouldn’t be a float matrix. However you transform your world position to a translated world one then you can use the View.TranslatedWorldToClip. Something like:
float4 ScreenPos = mul(float4(WorldPos.xyz + LWCHackToFloat(PrimaryView.PreViewTranslation), 1), PrimaryView.TranslatedWorldToClip);
Or if your vertex position is an LWC type you can do something like:
float3 TranslatedWorldPos = LWCToFloat(LWCAdd(WorldPos, PrimaryView.PreViewTranslation)));
float4 ScreenPos = mul(float4(TranslatedWorldPos, 1), PrimaryView.TranslatedWorldToClip);
I’m not sure there’s much up to date documentation on all of it, but happy to be proved wrong.
1 Like