How to create a vertex shader similar to Subway Surfers?

I’m trying to make a post processing shader/material for an infinite runner like Subway Surfers. In SS they spawn their map pieces all in a straight row then use the shader to simulate the turning. I’ve got a cubic lens distortion shader working from a tutorial from http://eat3d.com/free/ue4-shader-fx-cubic-lens-distortion but I can’t figure out how to get it to work without a texture. The post processing effect simply shows the texture and not the rest of the game.

Can anyone point me in the right direction as to how to do this? I haven’t used UE4 long, I’ve got more of a Unity background. Would it be possible to find and grab the material/shaders from the VR demo and use that?

something like this

Is it possible to make pivot point a little away from camera? Something like this:

https://scontent-lhr.xx.fbcdn.net/hphotos-xpf1/t31.0-8/1291782_877193258971472_913421140384402982_o.jpg

I’d guess that then you just have to add an offset vector to the camera position.

In my example it uses Clamp node to remove negative values between CameraPosition and StartDistance. so there bend = 0, and on StartDistance it grows to “Offset” (direction).
If you remove Clamp, you will get negative values before StartDistance.

Hello what am i doing wrong? Im trying to create the “Curved World” example

It also Flickers…


Thank You

Hi, any idea why this is not working on 4.19.1?

I got it working by applying the offset only to the Z axis and works fine when the camera is static but if the camera moves forward it only works for a while as the meshes begin to disappear after a while. So as long as the camera x coordinate grows there is a point where the algorithm do not work for the pixels that are too close to the camera view

Has anyone got an updated version as all of these don’t properly work.

Many thanks.

It flickers because original mesh goes out of camera view, its culled. And I’m not sure what size of mesh should be, make it work perfectly.
That material was just an small expreriment.

I found it in my archives and checked in 4.19.2
everything works fine.
maybe it not really accurate, but for now I don’t have a time to make any imrovements, sorry ))

here is material:

And how it works:

This mesh have size like 1000020001000 UU

@redbox thank you very much, will try again later !

Just want to bump this thread as it works very nicely(Still using the same layout as redboxposted in 4.21.1)

Thanks again.