# WorldPositionOffset not working on custom expression additional outputs 

**URL:** <https://forums.unrealengine.com/t/worldpositionoffset-not-working-on-custom-expression-additional-outputs/2737763>\
**Category:** Rendering\
**Tags:** Epic-Pro-Support, unreal-engine, question\
**Created:** [June 18, 2026, 10:25am UTC](https://forums.unrealengine.com/t/worldpositionoffset-not-working-on-custom-expression-additional-outputs/2737763 "2026-06-18T10:25:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [June 18, 2026, 10:25am UTC](https://forums.unrealengine.com/t/worldpositionoffset-not-working-on-custom-expression-additional-outputs/2737763/1 "2026-06-18T10:25:20Z")

</div>

Custom expression additional outputs are considered (0,0,0) when connected to WPO.

[Attachment Removed]

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [June 18, 2026, 10:25am UTC](https://forums.unrealengine.com/t/worldpositionoffset-not-working-on-custom-expression-additional-outputs/2737763/2 "2026-06-18T10:25:24Z")

</div>

**Steps to Reproduce**  
Create a custom node, add an additional output, set the additional output to a not zero number and return this value as custom expression result too. Connect the custom expression’s output to WPO: it works. Connect the custom expression’s additional output: it doesn’t work.

[Attachment Removed]

---

<div class="post-metadata">

**Author:** ![Petrockets](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/petrockets/32/1142518_2.png) [@Petrockets](https://forums.unrealengine.com/u/Petrockets)\
**Post date:** [June 24, 2026, 12:46am UTC](https://forums.unrealengine.com/t/worldpositionoffset-not-working-on-custom-expression-additional-outputs/2737763/3 "2026-06-24T00:46:55Z")

</div>

Hello,

Thanks for reporting this bug. I’ve verified the problem still exists in latest and created the following issue for tracking which should be visible soon [https://issues.unrealengine.com/issue/UE\-385745](https://issues.unrealengine.com/issue/UE%5C-385745)

It looks likely that this issue was caused by CL#17030334 which was added to fix a FXC.exe ICE. One potential fix is:

```auto
+++ b/HLSLMaterialTranslator.cpp
[Content removed]23 @@
 			// If we found the definition of the return value, there is no need to add more definitions as they won't contribute to the outcome
 			if (ReturnValueSymbolName != nullptr && CodeChunk.SymbolName == ReturnValueSymbolName)
 			{
- break;
+ // Don't break early if a later chunk modifies this value via inout
+ // (e.g. a CustomExpression function call that takes this variable as
+ // an 'inout' parameter). Without this check, that call gets truncated
+ // and the variable is never modified, producing a zero result.
+ bool bHasUnemittedDependency = false;
+ for (int32 DepIdx : CodeChunk.ReferencedCodeChunks)
+ {
+ if (DepIdx > ChunkIndex && DepIdx < EndChunk)
+ {
+ bHasUnemittedDependency = true;
+ break;
+ }
+ }
+ if (!bHasUnemittedDependency)
+ {
+ break;
+ }
 			}
 		}

```

with

```auto
--- a/HLSLMaterialTranslator.cpp
+++ b/HLSLMaterialTranslator.cpp
[Content removed]17 @@
 	}
 	int32 Result = CustomEntry->OutputCodeIndex[OutputIndex];
+
+	// When an additional output is the result, mark the main function call as
+	// a dependency so GetDefinitions() will continue past this chunk and emit
+	// the call that modifies this variable via inout. 
+	if (OutputIndex > 0 && CustomEntry->OutputCodeIndex[0] != INDEX_NONE)
+	{
+ ReferencedCodeChunks.AddUnique(CustomEntry->OutputCodeIndex[0]);
+	}
+
 	if (Custom->IsResultMaterialAttributes(OutputIndex))
 	{

```

However, this fix hasn’t been thoroughly tested.

[Attachment Removed]
