Log in or register to post comments

Mapping video texture to moving object (the tracker!)

January 5, 2016 - 2:29pm #1

Hi,

I am creating an AR app that allows you to open a portal to a new world and look inside. 

I have a shading problem to solve, here is a video explaining my issue (it was easier than trying to explain): https://www.youtube.com/watch?v=MO6vUpIjI-I

I am currently using geometry with a hole cut through it, then applying a depth mask shader which is simply rendering nothing through to the video texture generated by vuforia. However I'd like to control the mask that occludes the cube using a shader forge node. This will allow me to have lots of creative control over how this "portal" looks and behaves.

I have the video texture working with shader forge. Only problem now is the UV mapping. The video texture is the entire video from the camera fed into a square texture, therefore what ever the users camera/screen resolution is, the mapping from screen space needs to be managed.

See screen grab attached for the current UV mapping problem I have. You'll see that although the video mapped to the geometry in screen space, the video is not aligned correctly. For this to be working properly, the video texture needs to work like a projection from the camera. For reference the correctly aligned image in the background is the vuforia "background plane". This works because it is locked to the camera, however my geometry needs to move around as it needs to be parented to the tracker (UnityVuforiaVideoBackground.jpg)

I have also attached a screen grab of my shader forge node tree for reference (ShaderForgeNodeTree.jpg)

So, what can I do to adjust the mapping of the video texture to behave as per the vuforia video background?

Really hurting my brain so thanks in advance for any help!!

AttachmentSize
Image icon ShaderForgeNodeTree.jpg210.08 KB
Image icon UnityVuforiaVideoBackground.jpg329.61 KB

Mapping video texture to moving object (the tracker!)

October 17, 2016 - 6:00am #2

Hi there,

 

I was wondering if you ever solved this? I am currently facing the same issue?

 

My thinking was as you have above in your node tree...

 

Mapping the background video texture to the object with screen space uvs, and masking that with a custom mask.

 

Cheers,

 

O.

Log in or register to post comments