Camera projection - CameraVectorWS

Hello everyone;

I’m trying to create a camera projected texture. It looks like it’s possible to use the CameraVectorWS node in the material editor to project a texture from the current camera, but it’s not quite what I’m looking for.

Instead, I’d like to project a series of textures from a series of static cameras. Is there an equivalent to the CameraVectorWS would let me create a projection from an arbitrary camera?

Many thanks

Scribbler

you might want to look into using the TransformToZVector node to transform the world position. just plug the desired “camera” vector into the Z Vector socket and mask the result by R & G to get world projected UVs aligned with your vector.

2 Likes

Thanks for the reply! - I’ll give that a go.

Scribbler

I’ve made some good progress on this today - with a lot of help from This nuke tutorial on position pass projection

289ab99f7b8ddfc77e1896551448086fdb47408d.jpeg

Here’s the material:

0c987135be1de7a213387b4168886b4555a8e52c.jpeg

And here’s the blueprint that spawns the projection camera, and attaches a decal to it

59932832deac5ce100f43130106243e077c124b6.jpeg

Still having some issues, though.

Issue 1: Using the ‘TransformToZVector’ node works perfectly (Thanks divi!) - but only if the camera has no Z rotation. I’ve been trying to use the ‘RotateAboutAxis’ node to rotate the world position data to account for camera Z rotation, but for some reason it breaks everything.

Issue 2: The projection appears both in front AND behind the camera. The texture edges also ‘smear’ to infinity (the screenshot only looks good because the underlying texture is emissive, and the edges of the projection are black). Not sure how to remove everything outside the camera field of view.

Seems like it’s almost there - does anyone have any suggestions of how to get these kinks worked out?

Many thanks

Scribbler

the decal size is measured from the center of the decal box iirc, so you’ll have to offset the decal location along the camera vector by half the size for not having it affect the camera and everything behind it.

Hmm, I’m not sure 100%, but your screen looks like light with enabled light function. Maybe you can just use that?

I’m trying to project a full material, to allow VFX-style matte painting projections in unreal.

My test uses an emissive material (that looks like a light function) for testing. Appreciate the suggestion - but in this case no, I can’t.

I’ve finally got it all working.

Pixel-perfect camera projections in Unreal Engine!

Ran into some issues with skylights and deferred decals, which seems to be an ongoing issue with the engine - but the camera projection element worked fine. Here’s my ugly ‘proof of concept’:

It’s a blueprint + a material - what’s the most elegant way to package this up so I can share it?

A screen grab of the material layout and blueprint like you posted above feels enough. I’d love to see it as I’m trying to set something similar up.

Wow this is great, yea screenshots of the material and blueprint would be enough :slight_smile:

Hey Scribbler, your approach looks awesome. It would be really cool if you could post some screenshots. Thanks!

Edit: Never mind… I found it Projection Mapping technique to projects video files on objects? - Rendering - Epic Developer Community Forums

Hi @_Scribbler Would you mind resharing the BP? After the forum migration some screenshot above are gone

1 Like

I need to dig the tool out for a project I’m working on - haven’t touched it for a while. May take a bit of time to post it here, but I’ll see what I can do!

3 Likes

Hi _Scribbler, I’d love to see how you made this as I am a Matte Painter trying out Unreal Engine, would it be possible to post screenshots of the graphs?

Thanks in advance!
G

This is at the top of google, still relevant if you could repost Thanks!

For what it is worth there is a tutorial for this on the learning hub: Projecting a Texture in Worldspace | Tutorial

The tutorial assumes you’re going to be using a scene capture, but it should work just as well if your goal is to just project from a camera.

Thank you! huge help.

1 Like