Tried a few different attempts. SceneComponent2D didn’t work. The portal environment camera doesn’t move the same speed as the real phone camera. Also to much work to set all the objects in a large scene to not be visible to the owner.
Tried a stencil. The window part is good but the rest of the scene is all white from the stencil which isn’t the desired result.
Tried Custom Depth but the objects behind the invisible portal plane don’t sort correctly all the time. Also sounds like a lot of over draw perhaps for a large scene.
Also tried using the Android Camera as a texture. This was interesting when I set the materials uvs to screen aligned. However, when I tilt the camera from vertical to horizontal the tilt in the texture feed is noticeable less accurate than straight camera feed. A door for example will not remain exactly straight up and down, it slants a little which breaks the illusion.
Any help would be greatly appreciated. Attached are some images of my stencil and custom depth attempts.
This is the effect I’m trying to duplicate for Unreal4. Hoping his video can help us find a way to do something similar…
I noticed that the sky lines up perfectly even though the level static meshes don’t. I’m guessing that has something to do with the sky being a fake skybox or something? Even if the camera is set up so that the static meshes don’t line up at all, the sky still lines up perfectly.
I still notice with this method that the ScenCap2D material has aliasing and you can see what appears to be slight motion blur in the image when you move quickly by it, compared to the surrounding geo.
Played with those location values a little more and got the SceneCaptureComponent2D to line up perfectly with the player camera, so that part is now good.
New problem has shown up. Strafing side by side makes object in the RenderTexture looks blurry for some reason. In the video, the blurriness is most noticeable if you look at the specular spot on the far sphere. Any ideas on what is causing this?
Video is here…
I added some spheres that only show up in the RenderTexture for fun.
Now the only thing that remains, I’m being a little picky here since you may not ever notice it on a small phone device, but I notice there is a very slight distortion when strafing side to side on my PC monitor. I’m guessing it has something to do with how the antialiasing is being done but I’m not sure? I tried changing the antialiasing features in the post process volume but didn’t notice a difference.
The cubes in the background appear to shift up and down a couple pixels worth, as I move side to side.
Video is here…
P.S- Ignore when I get close to the default texture at the beginning of the video. The texture jitters around very slightly as if a very small amount of motion blur is taking place but the video compression makes it not appear.
Tried porting this over to the latest 4.19.1 ArCore. The camera doesn’t line up at all. Not sure what is going on there yet. Also the Render Texture material is very very dark.
The Render target texture also isn’t rotating correctly when I rotate the phone 90 degrees. The texture looks correct when the phone is in one orientation but as soon as goes past 90 degrees, it gets all stretched out since it’s width and height is no longer correct for the new orientation.
Any ideas on how the fix the dark texture and the render texture not scaling correctly with phone orientation?
I tried “Trey Z” method and it has the same bad offset.
Trey mentions that he requested a node to “…do this more easily, and to automatically deal with edge cases such as portrait rotation”. I recently saw these nodes added on 2-15-2009. So I’m wondering if UE4.22 now addresses these issue and if so, how to use these nodes to make an invisible ArCore object.
Thanks for the info wickerman123. I tried the latest 4.22 preview and found the “Get Camera Texture” and “Get Passthrough Camera Image UV” nodes but not the “Transform ARCoordinates 2D”. node.
Thought these might have been in the material editor but they were found in the blueprint scripting section instead. I’ll have to get familiar with compiling the engine like you mention so I can try the latest version. Thanks for the link.