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.

Looking into the situation, I thought perhaps I could use Kismet to pass the position of the player to a Material Instance using the Set VectorParam node… only to find out that node was taken offline back in 2010. Of course, with the clever use of “Append Vector” nodes, three scalar parameters can quickly turn into a float3, right?

 

Do excuse the garish colors. They were chosen to best showcase what’s happening. This could certainly be used to implement more subtle effects.

 

So that’s what I did. Here’s the base material (click to enlarge)

And the kismet setup. I put a delay after the operation is complete, otherwise Kismet throws a “too many operations” error. The delay is .033 seconds, or roughly 1 frame at 30 frames per second. The delay is barely perceptible, and it minimizes the number of calculations that have to happen. (click to enlarge)

Combining all that, you get this (video forthcoming):

From a CameraActor:

 

By Ozzy

Graduated in May 2011 from Ringling College of Art and Design with BFA in Game Art and Design. Tech Artist with strong work ethic, organization and time management skills, initiative, adaptability, and communications skills.

Credits:
- Darksiders II (in production)
- Saints Row: The Third (Art Intern)

Specialties
3DS Max 2012
Maxscript
Python
Perforce
Unreal Development Kit
Maya 2011
xNormal
Photoshop CS5
3DS Max 2010
Unreal Kismet
Crazybump
Dreamweaver CS3
Premiere Pro CS5
MEL
Hansoft
Mudbox 2011
zBrush 4
Corel Painter XI
AfterEffects

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.