[4.7.5] Material CameraPositionWS node and Orthographic Camera broken?

Heya,

I’ve started playing around with materials in my 2D project, and I think I’ve encountered a bug with the CameraPositionWS node. The only camera in my game is an orthographic one, and when you use the CameraPosition node in a material, it appears the value of this node is always (0,1,0) regardless of the actual camera position. If you chnage the camera to Perspective, things work as I expect.

Am I missing something, or is this a bug?

To repro, just pull up a blank 2D blueprint project in 4.7, duplicate the prototyping sprite material, then plug a CameraPositionWS node straight into the emissive colour output. Pop that material as the material on the ledge sprites, then play the game. As the player and camera moves, the ledges are all green and don’t change colour. Changing the camera to Perspective does make the ledges change colour.

If anyone has any insight on this, I’d appreciate it, and if it is a bug and you need more help nailing it, let me know :slight_smile:

Cheers!

Hi MkII -

This is working as intended. It is due to the way camera positioning is determined in an Orthogonal camera. Unlike a Perspective Camera in which you have a definitive eye point (or Camera Position) which can be easily equated to a world position coordinate, the Orthogonal camera keeps all Z axis transformations parallel which means the camera’s position is in fact a plane and not a point. Here is a quick image for example:

Thank You

Eric Ketchum

Ah, thanks Eric. I’ll see if I can find another way to do what I want.

Cheerio!

Just for anyone who was wondering how I got around this:

I made a Material Parameter Collection with a Vector value. In the actor with my (only) camera component, I update this value every tick with the camera’s location. I can then use the MPC value in materials - simple!