Up to UE 5.0, when the "Object Position" node is used in the Material Editor as part of a material with Light Function domain, attempting to compile the material results in the following error: "[SM5] /Engine/Generated/Material.ush: error X3004: undeclared identifier 'GetObjectWorldPosition'".
Starting with UE 5.1, however, that (probably unsupported) use-case does compile, but the node outputs garbage values (probably coming from an invalid memory access). This behavior was introduced by CL 21757684 in ue5-main in an attempt to address issue [Link Removed]. As part of this CL, the definition of function "GetObjectWorldPosition()" in file "MaterialTemplate.ush" became no longer protected by "#if HAS_PRIMITIVE_UNIFORM_BUFFER". Similarly, in file "MaterialExpressions.cpp", function "UMaterialExpressionObjectPositionWS::Compile()" lost a check against its usage on the "MD_DeferredDecal" material domain, which is probably related to the goal of the CL (maybe a new check against "LightFunction" could be added?).
As a side-note, a UDN licensee would also be interested in being able to access the world-space position of a light source when evaluating a Light Function material, if possible.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-222648 in the post.