Announcement

Collapse
No announcement yet.

Finally, Parallax Occlusion Mapping!!

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

    Finally, Parallax Occlusion Mapping!!

    UPDATE: Now available for purchase! http://gameappmakerco.itch.io/displacer-best

    So UE4 doesn't include a parallax occlusion mapping shader.

    Well, it does, but it's this horrible inflexible homunculus of a node graph that I can't even screenshot fully when zoomed all the way out.




    It achieves this through overlapping opacity maps, taking tiny slices of the height information from top to bottom, and shifting the slices' UVs at differing magnitudes based on their desired depth.

    It's slow, it's static, the number of iterations is fixed, it's nearly impossible to edit, it doesn't compute silhouettes, the layers aren't interpolated, and that's just off the top of my head.


    I'm making a "real" parallax occlusion mapper with variable iterations, easy plug-and-play heightmap replacement, better visual results, and a whole lot of other goodies I'll talk about soon. Here are some work in progress shots using unmodified T_Cobblestone_Pebble textures from the starter content:



    Oh yeah, and you can animate it:



    I plan to make this available on the Marketplace for ~$30 dollars, with a large example library done in the style of Epic's walkable content demos.

    Any comments, feedback, suggestions, or requests you might have are extremely welcome! More images to come shortly.
    Last edited by SFtheWolf; 05-13-2015, 04:51 PM.
    Senior CEO in Chief of Game Builder Club and Building 3d Game Birds Gameapp Maker Co.

    Oldskooler PreDigital CRTify illustrious Patreon


    #2
    but you just got it fr.... pom material

    Comment


      #3
      That's actually the first I've seen of that thread. I assure you my material is original work based off Tatarchuk's AMD presentation + some modern additions, and was mostly finished by Fall of last year (Here's a post about it on my company site from December 9th). I only just now got around to posting about it here. I didn't expect to be the only one working on this, and competition is healthy!
      Last edited by SFtheWolf; 02-13-2015, 08:42 PM. Reason: Added proof
      Senior CEO in Chief of Game Builder Club and Building 3d Game Birds Gameapp Maker Co.

      Oldskooler PreDigital CRTify illustrious Patreon

      Comment


        #4
        Very cool Sf looks wonderful.

        Comment


          #5
          Well seems that parallax is starting to work on it's own but I would pay 30 bucks for the materials if they work the way you demonstrate above.
          Clarke's third law: Any sufficiently advanced technology is indistinguishable from magic.
          Custom Map Maker Discord
          https://discord.gg/t48GHkA
          Urban Terror https://www.urbanterror.info/home/

          Comment


            #6
            Originally posted by SF View Post
            That's actually the first I've seen of that thread. I assure you my material is original work based off Tatarchuk's AMD presentation + some modern additions, and was mostly finished by Fall of last year (Here's a post about it on my company site from December 9th). I only just now got around to posting about it here. I didn't expect to be the only one working on this, and competition is healthy!
            no problem

            Comment


              #7
              Would this work with terrains? if so, can you show a picture of parallax on a terrain

              Comment


                #8
                If you make a system that is reliable and performs well. One that you can easily hook up new materials to within the same material (a landscape material) then I'd buy it in a heartbeat.
                I've been using the POM system from the other thread and it works great but it's a pain to get it to reference the right texture sample for height maps when you have multiple.
                So preferably an easy to use material function that lets you plug in desired textures and a height map.

                What kind of performance do you get with this? Does it affect your frame rate a lot?

                Comment


                  #9
                  Originally posted by kkhaial View Post
                  Would this work with terrains? if so, can you show a picture of parallax on a terrain
                  Haven't tested this yet but I'll be sure to and post about it here!

                  Originally posted by Sitrec View Post
                  If you make a system that is reliable and performs well. One that you can easily hook up new materials to within the same material (a landscape material) then I'd buy it in a heartbeat.
                  Glad to hear it! The entire thing is packaged in a drag-and-drop Material Function. I've done a fair bit of testing to find sensible defaults for everything so that if you only want to prototype you're not asked to fuss around with iteration values and whatnot. Just give it a heightmap object and it'll give you the parallaxed UVs to use or further manipulate however you like.

                  Originally posted by Sitrec View Post
                  What kind of performance do you get with this? Does it affect your frame rate a lot?
                  It's not a cheap effect, but it's surprisingly affordable if you don't use a high res heightmap or won't be covering much of the screen with it. I checked the other thread and it looks like we use basically the same algorithm, however mine has some early outs for efficiency, adjustable view angle falloff for per-asset iteration scaling, and a refinement phase to drastically reduce staircasing if you have extra power to spare.

                  I'll write a post detailing some more features later this week. Here's an example of just how accurate the most recent version can be!


                  Senior CEO in Chief of Game Builder Club and Building 3d Game Birds Gameapp Maker Co.

                  Oldskooler PreDigital CRTify illustrious Patreon

                  Comment


                    #10
                    Originally posted by SF View Post
                    Haven't tested this yet but I'll be sure to and post about it here!



                    Glad to hear it! The entire thing is packaged in a drag-and-drop Material Function. I've done a fair bit of testing to find sensible defaults for everything so that if you only want to prototype you're not asked to fuss around with iteration values and whatnot. Just give it a heightmap object and it'll give you the parallaxed UVs to use or further manipulate however you like.



                    It's not a cheap effect, but it's surprisingly affordable if you don't use a high res heightmap or won't be covering much of the screen with it. I checked the other thread and it looks like we use basically the same algorithm, however mine has some early outs for efficiency, adjustable view angle falloff for per-asset iteration scaling, and a refinement phase to drastically reduce staircasing if you have extra power to spare.

                    I'll write a post detailing some more features later this week. Here's an example of just how accurate the most recent version can be!


                    Sounds good!
                    Most importantly for me is to not have to change the HLSL code in the custom node when I want to reference another texture sampler.
                    And that there won't be any issues with having multiple of this material function in the same landscape material without having them go apeshit and reference the wrong samplers.

                    I noticed about a 10fps decrease (on a GTX 970) when using the old system with 40 samples, 2k Base color, Normal, Roughness and Height for parallax and covering a large landscape with just one layer, but without silhouette(wasn't supported for landscape), compared to the same material without POM.
                    Are we talking this kind of performance or would it be a lot costlier? Are we able to lower quality of it from certain distances/angles so there is more Staircasing/pancaking when not close or at certain angles and such? I'd rather have slightly lower quality but be able to use it for every ground material than perfect quality but too costly for something that big. Would of course fade it out by distance to save resources.

                    Comment


                      #11
                      I would also love to know the details on performance. Landscape materials can get rather large, so adjustable quality based on distance and other settings like it would be useful.
                      --
                      Joshua
                      Multimedia Artist, Druid Gameworks
                      www.joshuaezzell.com
                      www.druidgameworks.com

                      Comment


                        #12
                        Originally posted by Sitrec View Post
                        Sounds good!
                        Most importantly for me is to not have to change the HLSL code in the custom node when I want to reference another texture sampler.
                        And that there won't be any issues with having multiple of this material function in the same landscape material without having them go apeshit and reference the wrong samplers.
                        I am unfortunately currently relying on the magic-number sampler hack in the custom code node (I'm guessing Ehamloptiran and I looked at the same workaround post, heh) and so multiple POM materials do cause reentrant expressions in certain configurations. I'm looking into workarounds that don't require an entire plugin for one material, and will of course update this package post-release once Epic actually fixes texture object inputs.

                        Originally posted by Sitrec View Post
                        I noticed about a 10fps decrease (on a GTX 970) when using the old system with 40 samples, 2k Base color, Normal, Roughness and Height for parallax and covering a large landscape with just one layer, but without silhouette(wasn't supported for landscape), compared to the same material without POM.
                        My POMer has a number of optimizations the other one doesn't and otherwise uses a similar algorithm (linear raymarching followed by a refinement phase) so it should be just as performant at a minimum.

                        Later on, I'm considering also adding Material Functions which perform quadtree displacement mapping (requires a tiny bit of pre-processing, skips empty space quickly and is faster for dramatic heightmaps) and relaxed cone step mapping (huge pre-process time, but like twice as fast to render and looks super accurate).

                        Originally posted by Sitrec View Post
                        Are we talking this kind of performance or would it be a lot costlier? Are we able to lower quality of it from certain distances/angles so there is more Staircasing/pancaking when not close or at certain angles and such? I'd rather have slightly lower quality but be able to use it for every ground material than perfect quality but too costly for something that big. Would of course fade it out by distance to save resources.
                        Originally posted by joshezzell View Post
                        I would also love to know the details on performance. Landscape materials can get rather large, so adjustable quality based on distance and other settings like it would be useful.
                        It does scale the number of iterations based on viewing angle, and you can even control the falloff exponent! So, for example, if you had a particular texture with not a lot of dramatic pointy bits, you could relax the view angle scaling so it only starts to approach the maximum step size at really dramatic angles. My improved refinement phase also makes each "slice" a much smoother transition, meaning you may need fewer iterations in the first place.

                        I also have a feature I haven't seen implemented anywhere else: A parameter that interpolates between maximum offset limits. This can be used to selectively retain legibility at sharp viewing angles, as well as reduce staircasing dramatically for no performance cost. Naturally this introduces warping, but depending on where your material is used it may not be visible. Anyway, all this will be detailed in the media post later this week.
                        Last edited by SFtheWolf; 02-17-2015, 09:52 PM.
                        Senior CEO in Chief of Game Builder Club and Building 3d Game Birds Gameapp Maker Co.

                        Oldskooler PreDigital CRTify illustrious Patreon

                        Comment


                          #13
                          Originally posted by SF View Post
                          I am unfortunately currently relying on the magic-number sampler hack in the custom code node (I'm guessing Ehamloptiran and I looked at the same workaround post, heh) and so multiple POM materials do cause reentrant expressions in certain configurations. I'm looking into workarounds that don't require an entire plugin for one material, and will of course update this package post-release once Epic actually fixes texture object inputs.



                          My POMer has a number of optimizations the other one doesn't and otherwise uses a similar algorithm (linear raymarching followed by a refinement phase) so it should be just as performant at a minimum.

                          Later on, I'm considering also adding Material Functions which perform quadtree displacement mapping (requires a tiny bit of pre-processing, skips empty space quickly and is faster for dramatic heightmaps) and relaxed cone step mapping (huge pre-process time, but like twice as fast to render and looks super accurate).





                          It does scale the number of iterations based on viewing angle, and you can even control the falloff exponent! So, for example, if you had a particular texture with not a lot of dramatic pointy bits, you could relax the view angle scaling so it only starts to approach the maximum step size at really dramatic angles. My improved refinement phase also makes each "slice" a much smoother transition, meaning you may need fewer iterations in the first place.

                          I also have a feature I haven't seen implemented anywhere else: A parameter that interpolates between maximum offset limits. This can be used to selectively retain legibility at sharp viewing angles, as well as reduce staircasing dramatically for no performance cost. Naturally this introduces warping, but depending on where your material is used it may not be visible. Anyway, all this will be detailed in the media post later this week.
                          Sounds perfect! If you manage to work around the silly way we currently have to sample heights (or Epic fixes the problem) I'd buy it in a second.

                          Comment


                            #14
                            I already have my POM implementation based on this: https://forums.unrealengine.com/show...material/page4
                            But It needs some improvements, like self-shadowing, tillable silhouette, better performance, less instructions, etc,
                            if you have none of that, then you have nothing new to offer than we already have.

                            Regards
                            Last edited by Majority; 02-23-2015, 07:00 AM. Reason: change my opinion

                            Comment


                              #15
                              Sorry for the delay, my health took a turn for the worse as it so often tends to. Whipping up a Content Examples project style setup to demo all the material's features. I'll screenshot that for the media post here!

                              Originally posted by Majority View Post
                              I already have my POM implementation based on this: https://forums.unrealengine.com/show...material/page4
                              But It needs some improvements, like self-shadowing, tillable silhouette, better performance, less instructions, etc,
                              if you have none of that, then you have nothing new to offer than we already have.

                              Regards
                              I'm adding self-shadowing this week, my version allows you to clip tiled materials to an arbitrarily defined border, and so far as I can tell my performance is slightly better than that implementation (or it gets higher fidelity for similar performance, depending on how you look at it).

                              If you have something you already like, great! My target audience is people who want something immediately usable yet still flexible and with minimal setup required on their end. If $30 saves you an hour of skilled labour then it's paid for itself. Plus I'm going to include alternative algorithms and update the package in the future for free.
                              Senior CEO in Chief of Game Builder Club and Building 3d Game Birds Gameapp Maker Co.

                              Oldskooler PreDigital CRTify illustrious Patreon

                              Comment

                              Working...
                              X