x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[Closed] AR Passthrough Material

I'm trying to make a Passthrough material to use for hiding models in an AR scene on iOS and Android. Getting the actual camera texture isn't an issue, but getting the UVs to line up with the passthrough background is. I've tried to use Screen Aligned UVs, but they don't seem to work properly in the Vertex Shader on Android*

alt text

Screen Aligned Pixel To Pixel UVs provide a somewhat better result, but still not perfect.

alt text

This is how I tried setting the UVs up.

alt text

Is there a node that I'm missing that can accomplish what I'm trying to do, or am I using these nodes wrong? Any help would be greatly appreciated!

Thanks, Logan

Product Version: UE 4.18
Tags:
more ▼

asked Nov 30 '18 at 09:10 PM in Using UE4

avatar image

Trey Z ♦♦ STAFF
997 3 4 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

The question has been closed Nov 30 '18 at 09:15 PM by Trey Z for the following reason:

UDN Conversion


1 answer: sort voted first

Hi Logan,

A ScreenPosition node almost works correctly as the input to a GoogleARCorePassthroughCamera node. It gives the screen's UV coordinates in the value from 0-1. The camera's coordinates also use a 0-1 range, but they're for the camera texture's aspect ratio which might not be the same as the screen's aspect ratio. The post processing used for the regular passthrough clips the camera texture at the top and bottom, so we need to modify the V coordinate to do the same.

Here is my material, and an AR scene with a red-tinted passthrough cube placed in it (Galaxy S8).

Note that the material is doing the calculation in the pixel shader. In the vertex shader, it is correct at the triangle vertices but because of texture perspective correction, the texture coordinates are not interpolated linearly across a 3D triangle, leading to a very weird effect.

I also added a ticket, UE-54833 to request a material node to do this more easily, and to automatically deal with edge cases such as portrait rotation, where I expect the camera is clipped horizontally rather than vertically.

Cheers Jack

alt text alt text

more ▼

answered Nov 30 '18 at 09:14 PM

avatar image

Trey Z ♦♦ STAFF
997 3 4 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question