Categories
Tech Art

Player Position-based Material

Recently, a coworker posed a question to me:
“How do you pass the player position to a material in UDK?”

“Well, couldn’t you just use the CameraWorldPosition node? The player and the camera are so close together the effect should be enough, right?” replied I.

“That could work, but I want to do a far-back third-person camera,” he countered.

“Oh…” I said.

After attempting a solution that was, admittedly, rather hacky involving trying to programmatically derive the location of the player based off a known distance between the camera and the player, I opted for something that could be considered hacky, but is as close to a programatic solution as an artist can get.