Announcement

Collapse
No announcement yet.

How to create a vertex shader similar to Subway Surfers?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    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-...ens-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?

    #2
    something like this
    Click image for larger version

Name:	deform_wpo.jpg
Views:	1
Size:	130.6 KB
ID:	1079975
    Rocketeer

    my portfolio
    my youtube

    Camera Volumes System
    Procedurally Instanced Meshes
    Simple Portals
    Water Flow For UDK
    Setup Swarm

    Comment


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

      Comment


        #4
        Originally posted by kodmistrz View Post
        Is it possible to make pivot point a little away from camera? Something like this:
        I'd guess that then you just have to add an offset vector to the camera position.

        Comment


          #5
          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.Click image for larger version

Name:	2016-02-01_2008.jpg
Views:	1
Size:	93.9 KB
ID:	1099687
          Last edited by redbox; 02-01-2016, 02:10 PM.
          Rocketeer

          my portfolio
          my youtube

          Camera Volumes System
          Procedurally Instanced Meshes
          Simple Portals
          Water Flow For UDK
          Setup Swarm

          Comment


            #6
            Hello what am i doing wrong? Im trying to create the "Curved World" example
            Click image for larger version

Name:	bp curve.png
Views:	1
Size:	158.8 KB
ID:	1113917

            It also Flickers..
            Click image for larger version

Name:	floor01.png
Views:	1
Size:	409.0 KB
ID:	1113918
            Click image for larger version

Name:	floor02.png
Views:	1
Size:	416.0 KB
ID:	1113919

            Thank You

            Comment


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

              Comment


                #8
                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

                Comment


                  #9
                  Has anyone got an updated version as all of these don't properly work.

                  Many thanks.

                  Comment


                    #10
                    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:

                    Click image for larger version

Name:	20180623_1123.png
Views:	1
Size:	133.1 KB
ID:	1492734


                    And how it works:




                    This mesh have size like 10000*2000*1000 UU

                    Click image for larger version

Name:	20180623_1147.jpg
Views:	1
Size:	51.6 KB
ID:	1492735
                    Rocketeer

                    my portfolio
                    my youtube

                    Camera Volumes System
                    Procedurally Instanced Meshes
                    Simple Portals
                    Water Flow For UDK
                    Setup Swarm

                    Comment


                      #11
                      redbox thank you very much, will try again later !

                      Comment


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

                        Thanks again.

                        Comment

                        Working...
                        X