Parallax Occlusion Optimization - Advanced Materials - Episode 15

Поділитися
Вставка
  • Опубліковано 17 вер 2024
  • Parallax occlusion mapping is a great way to add shape and detail to surfaces. It's much more convincing than normal mapping, and works better than offset or parallax mapping. The main downside is that it's a bit more costly on performance. In this video, I show a couple of ways to make it perform better and put the cost where we need it while reducing it where we don't.
    Here's last week's video on creating sand:
    • Sand Shader - Advanced...
    Here's the playlist for all of the videos in the series:
    • Advanced Materials
    Shader Book Recommendations
    www.bencloward...
    ------------------------------
    Theme Music
    Peace in the Circuitry - Glitch Hop
    teknoaxe.com/Li...
    Background Music
    Speo - The Little Things
    • The Little Things
    #UnrealEngine #shadergraph #Unity
    ------------------------------

КОМЕНТАРІ • 56

  • @snakeywakey4109
    @snakeywakey4109 Рік тому +7

    This not only increased my performance, but also somehow removed some of the serious artefacting i had!

  • @3DWithLairdWT
    @3DWithLairdWT Рік тому +4

    I always look forward to your videos!
    I don't doubt that following your channel helped me break into my first industry position, and I still learn something new with each one. Thanks for all you do!

    • @BenCloward
      @BenCloward  Рік тому +1

      That's awesome! Really glad I could help.

  • @jonilo8792
    @jonilo8792 Рік тому +3

    Best channel on UA-cam. Thanks Ben!

  • @devmishra18
    @devmishra18 Рік тому +6

    Texture instead of a constant value for steps! Why didn't I think of that. Thank you so much!
    PS. Those Cobblestone textures are legendary. I think I saw them even in your old HLSL series. Almost as old as the channel :D.

    • @BenCloward
      @BenCloward  Рік тому +5

      Hah! Yes, I made that cobblestones texture set like 18 years ago and use them in just about everything. Too lazy to look for something else. :P

  • @ActualJRod
    @ActualJRod Рік тому +1

    Brilliant video, I'll be employing this immediately!

  • @da-mor
    @da-mor Рік тому +2

    Great tutorial as usual! Thank you very much!

  • @ErikBorchersVR
    @ErikBorchersVR Рік тому +1

    I just found your channel Ben. Amazing content! I’m working on my first indie VR game for Meta Quest 2 in Unity and I’ve been using urp shader graph for all my shaders. I learned shader basics from Freya Holmer’s UA-cam channel a few weeks ago. It’s great to see you have so many videos on advanced techniques 🙂

  • @dreamisover9813
    @dreamisover9813 Рік тому +1

    These videos are so good!

  • @morganlak4337
    @morganlak4337 Рік тому

    wow I'm only halfway through, but these optimizations feel really obvious in hindsight lol. I did a bunch of experiments with POM last year and ultimately gave up on it due to cost, but this helps so much. Great video!

  • @GeeCeeAte
    @GeeCeeAte 9 місяців тому

    Absolutley A+! amazing! thank you so much!

  • @mlecz
    @mlecz Рік тому +7

    It would be amazing if you brought up the topic of 'silhouette parallax occlusion mapping' and showed how to implement it from scratch in UE4.

    • @mrmensje1
      @mrmensje1 Рік тому

      this would be amazing!

    • @dylankuzmick3122
      @dylankuzmick3122 Рік тому

      Holy… I didn’t even know this existed. I’m trying to figure out a way to make better twig silhouettes for a SUPER high detail tree and even with nanite available, I can’t assemble models with the polygons required before bringing into unreal (it would be like 200M tris at least for a big spruce). A material displacement method (not using vertices) like POM would work great if it can do silhouettes.
      Tutorial would be amazing!
      Edit: this is for VFX, definitely not games lol. Also I'm not a big fan of premade opacity cards since they don't look great from every angle, but with Ben's other videos I might try to make that work instead. A sillhouette displacement method tutorial without tesselation would be great though!

    • @DanielElliott3d
      @DanielElliott3d Рік тому

      Does this reference a particular paper or specific technique? The only thing I could find was a cryengine shader called sillouette POM and also a paper from AMD that raycasts prisms...
      developer.amd.com/wordpress/media/2012/10/Dachsbacher-Tatarchuk-Prism_Parallax_Occlusion_Mapping_with_Accurate_Silhouette_Generation%28SI3D07%29.pdf

    • @mlecz
      @mlecz Рік тому

      @@DanielElliott3d There are a couple of approaches to solving this problem, this is one of them: www.cs.nthu.edu.tw/~chunfa/PG08_1258.pdf

  • @ra-di2wu
    @ra-di2wu Рік тому

    Thanks, these optimizations helped me develop my POM system that works fairly well with a distance of about 8 units.
    It would be great to take a look at blending POM between multiple landscape textures, as they appear to float above each other.
    Perhaps something like including multiple textures in the POM core loop and raymarching all of them and taking the "highest" one. But it would seem that the other textures need pulled down into the screen as if they are the lower parts of the texture that's winning.

  • @Kolyasisan
    @Kolyasisan Рік тому

    Curious!
    Never worked in-depth with POM and I always assumed that it's a linear loop that is better not be disturbed to support constant unrolling. But now dug through the code and saw that it's dynamic, so might as well reduce the sample count under specific cases anyways.
    Love your channel, got to it after watching your excellent Anthem talk, thank you!

  • @GreasyBirb
    @GreasyBirb Рік тому +3

    Any chance you can cover Cone Step Mapping as an alternate to POM?

  • @impheris
    @impheris Рік тому +1

    this is AAA stuffs, thank you!

  • @bovineox1111
    @bovineox1111 8 місяців тому

    Nice. I wonder if near objects when filling the screen st flat angles the cost is spiky or whether balanced out 🤔
    I tried this on quest two ages back and it ate the gpu but I think that was a alternative method still, wort another look, especially from q3

  • @cgcowboy
    @cgcowboy Рік тому

    Fantastic! Any chance you would do a video combining this technique with your Interior Mapping content to simulate geometry in an interior-mapped room? For instance, showing a chair in the middle of the room using a parallax effect.

  • @antonovivan3008
    @antonovivan3008 9 місяців тому

    Hey Ben, thank you for the tutorial.
    I am wondering how the LOD input works in Unity?
    I tried to test it by myself and seems like it has nothing common with LOD Group component settings.
    Seems like it works the way Parallax Mapping linearly becomes flat when it's LOD input value is between (LOD Threshold) value and (LOD Threshold+1) value.
    So probably I can easily use distance from camera calculation plugged in LOD input to make Parallax Occlusion being flat on distance.
    I am wondering if it can make the material even more optimized than you did at this video? Or it just affects the POM amplitude value and does nothing for performance?

  • @Sweenus987
    @Sweenus987 Рік тому +2

    What would the performance difference be between this an tesselation?

    • @dylankuzmick3122
      @dylankuzmick3122 Рік тому +2

      It depends on the scale you’re working at. POM works great for larger objects that need lots of detail like terrains. Tessellation has relatively similar performance impacts to polygon count, because essentially tessellation is adding polygons. Tessellating a 4km landscape makes no sense. But for smaller objects, say a tree trunk, it works out very nicely. POM is generally for flattish surfaces and won’t let you make nice silhouettes on corners. Think of the corner of a brick wall, it goes in and out with the grooves, a look that POM can’t really do. POM is also great if you don’t want to even deal with bad topology or anything, it just “works.” The advantage of tessellation and POM is that you don’t have to deal with all the headaches of high poly models until the very end when you see it in engine, and you can easily scale it depending on hardware.
      Tessellation at landscape scale is dumb and hurts performance, but at small scale is very nice. POM is somewhat okay at any scale but you kinda get diminishing returns as you scale down, better just to represent with triangles at a certain point. What exactly that point is I’m not 100% sure (though it somewhat depends on your specific hardware) but I just like to use POM sparingly where triangles start to become an issue and where it makes sense to do so (flat stuff w/straight/no corners)

    • @GhtPTR
      @GhtPTR Рік тому +1

      @@dylankuzmick3122 UE5 doesn't care about polycount anymore but your reply is enlightening nonetheless. I personaly like it better to use a height map in the modeling tools displacement deform tools because it's easier but hey! you got me thinking 🤔

    • @dylankuzmick3122
      @dylankuzmick3122 Рік тому +1

      @@GhtPTR Very true, but in fact UE5 doesn't actually have dynamic tesselation as a feature anymore, they got rid of it (except virtual heighfield meshes which tessalate only terrains based on a faloff distance, but that's an edge case I hardly use because of POM anyway, even in UE5). Regarding heightmaps, absolutely, I use them all the time! Sometimes people confuse displacement and tesselation since they go so hand in hand. Tesselation subdivides geo and adds triangles (realtime tesselation removed in UE5), displacement moves the geomety's verteces up and down based on the colors and uv mapping of the heightmap (in UE it's called WPO). Usually adding more tesselation gives more detailed displacement, but since realtime tesselation isn't a thing in UE5, you have to make sure your geometry has enough verteces when imported into the engine to look nice.
      One thing to note though is that you CAN add tesselation to meshes in UE5 using the mesh editing tools, but you really should bake it (which takes a couple minutes depending on the tri count) and enable Nanite for it to not slow your system down. If you're working with meshes you've made yourself, it's usually faster to do this in your DCC of choice (Blender, Maya, ect.) instead of Unreal.
      Also, for general reference, I find that for a 2X2m plane, I need to add at least 2-4 million tris for it to look comparible to POM, and even still it's not quite there (depending on the steps for POM shader and the angle you look). Though I would guess that with Nanite enabled it would perform better than POM at this scale.
      While Nanite is amazing, I wouldn't do anything more than 10 million tris with it, simply because it takes FOREVER to load into the engine, and it takes about as long to bake meshes.
      What I like to do is take a bunch of blank 2x2 or 4x4m planes with 5-10million tris each, and just stack them next to each other. Then I apply a displacement material to all of them with global UV mapping (so you don't notice that they're individual planes). For small-medium sized scenes where you don't need landscape mesh features and you want some real displacement instead of POM, this can work wonders. I often like to mix and layer this technique with landscape meshes using POM for larger scenes.
      As a last note, given that Nanite is such a beast, I use Nanite + displacement (aka WPO) for pretty much everything except for large, planar objects that can't easily be broken into peices and that I won't see the silhouette of. So far I've yet to encounter such a mesh besides my main landscapes, so I've personally only used POM for Unreal's landscape meshes. Everything else I personally use Nanite, but maybe you'll find a situation in which POM suits you better.

  • @sarabuajay1938
    @sarabuajay1938 Рік тому

    Hi ben love your tutorial can you do a tutorial on stone wall texture tile repetition from bridge textures

  • @nishblr6522
    @nishblr6522 Рік тому

    There is one thing I don't understand. When you connect both two multiplied masks straight to the base color and move away on a distance- the object becomes black. But how could it be, if we have a ceiling node at the end of all multiplications? I mean, you said the ceiling node would round the number to one, but on a distance I got black color. The first mask works correctly and never goes lower than one (the object is always white), but the second mask goes to black on a distance, having a ceiling at the end, after the all masks multiplication. I mean, this is how it should work in the best conditions, but I don't understand the math here (having a ceiling at the end, we somehow get black(0)).

  • @importon
    @importon Рік тому

    Very cool! could this be used with a render target to create a dynamic damage effect?

  • @joantonio6331
    @joantonio6331 Рік тому

    How does parallax performance compare with nanite?

  • @dxiii5056
    @dxiii5056 8 місяців тому

    Hello sir Ben, can i ask, How to use Parallax Occlusion Mapping for Triplanar Project? i have tried combine 3 faces with use only 1 time sample but still fail, it only working in Z face, X Y is not :( Help me please.... Thanks for reading, sorry for my English

  • @dannys_85
    @dannys_85 Рік тому

    I believe that it would be better in the end to clamp the steps to the max value lets say 120 max what do you think? Ben
    good video as always.

    • @BenCloward
      @BenCloward  Рік тому

      I'm not sure I completely understand what you're saying - but the best thing to do if you have an idea for improving it is to compare it and see. Try what I'm showing and then try your idea and see which ones gives you better performance. I go over methods for performance measurement in this video: studio.ua-cam.com/users/videoiQLBbcqNv2E/edit

  • @3dsmax_metronomus480
    @3dsmax_metronomus480 Рік тому

    Dear Ben, do parallax materials work with trim sheets (multiple textures on one sheet and mesh cut up into pieces) or just tiled textures? I am having issues to get trimsheets to work properly with pom. Somehow the pom doesn’t know when a trim ends and bleeds into the next one on the sheet. I asked on discord and somebody said that one would have to change uv mapping?!

    • @quartermaster2809
      @quartermaster2809 3 місяці тому

      That's just how trim textures work, if the uv mapping is off for the mesh, the texture will have other parts of it appearing on it.
      For example if we have a simple trim texture, top half being red and bottom half being blue - the way UVs are mapped should be done properly, because if a little bit of it goes up or down that part will be visible on the mesh.
      You can use modeling tools in UE5 to change it if you're in that engine or just opening the model in blender to move the UVs.

  • @TheDevBlock
    @TheDevBlock Рік тому

    I could be wrong, but you can't change shader complexity only changing camera distance and switch steps or so on. It still will have same number of instructions. Only way to optimize material its use different simplyfied mats between lods, or iаm wrong?

    • @BenCloward
      @BenCloward  Рік тому

      This is one of those cases where instruction counts are very deceptive. Just judging by the instruction count, you could easily make the conclusion that you can't change performance based on distance. But in this case, the parallax node is using a for loop internally, and the instruction count only shows you the maximum instructions. If you change the number of steps dynamically, it actually DOES reduce the number of loops it's doing in the for loop, so it ends up making it a LOT cheaper. But don't take my word for it. Try it out for yourself and verify!

    • @TheDevBlock
      @TheDevBlock Рік тому

      @@BenCloward Thank you Ben) will make some tests with this technique with different type of shaders.

  • @Theironlefty
    @Theironlefty Рік тому

    A question is it cheaper to use the Fresnel node instead of the custom view + dot product shown in the video?

    • @BenCloward
      @BenCloward  Рік тому +1

      It may be a TINY bit cheaper to use the custom method but the difference will be so small it won't be measurable. But of course the best answer to every "is it cheaper" question is to test it!

  • @foodcuisinepoint
    @foodcuisinepoint Рік тому

    I watched your Post Process Cartoon Outlines - Shader Graph Basics - Episode 57 and I am facing a problem in the hd sample buffer node in unity. It does not give clear texture in the sky. My outlines just stick in the sky. They are not cleared every frame. please help

    • @BenCloward
      @BenCloward  Рік тому +1

      If I knew the solution to your question that you posted on the other video, I would have answered it there. I didn't answer it because I don't know. This is something that I could probably figure out given time, but unfortunately, I don't have time to investigate and solve this issue for you. If someone else has a solution, they're more likely to post it under the other video.

  • @ArkTemplarioMaster
    @ArkTemplarioMaster Рік тому

    If I use texture normal plus tessellation, I think it's more expensive and you get almost the same effect, is this a better alternative in terms of performance? Or I'm wrong

    • @BenCloward
      @BenCloward  Рік тому +1

      That's a really good question and I image the answer may be different depending on the hardware. Only way to know is to test it!

    • @Trass3r
      @Trass3r Рік тому

      See for example this excellent talk: ua-cam.com/video/BD1zXW7Uz8Q/v-deo.html

  • @Slu2112
    @Slu2112 Місяць тому

    will it work on mobile?

    • @BenCloward
      @BenCloward  Місяць тому

      Yes, but you'd probably need to use it very sparingly and keep the max sample count very low. May not be worth it, but you'll need to be the judge because it depends on how it's being used.

  • @alexanderalikin1210
    @alexanderalikin1210 Рік тому

    Last video was about sand, not about parallax. Or am I missing something?

    • @BenCloward
      @BenCloward  Рік тому

      Yes, you are correct. The episode right before this one was about sand. Did I make a mistake and say somewhere that it was something else? I think I mentioned that I had done a previous video about parallax mapping. That video is here: ua-cam.com/video/wc0StMr3CQo/v-deo.html

    • @alexanderalikin1210
      @alexanderalikin1210 Рік тому

      @@BenCloward oh, I got it now, thanks.

  • @LuxAlibi
    @LuxAlibi Рік тому

    Thank you for your great tutorials!
    When I try to apply parallax occlusion on an object that is not based on a main flat surface I get very weird effects: I tried to make some bumpy moss on some rocks, but the result was quite bad 😞
    Is it me doing something wrong or this method doesn't work well when the material is applied on a complex shape mesh?
    Thank you

    • @TechArtAlex
      @TechArtAlex Рік тому +1

      Simple PoM casts its rays based on the assumption that the surface is flat. You can get acceptable results on surfaces that have gentle curves (like terrain), but the more curved a surface is, the worse artifacts you will have. The greater the offset is, the worse artifacts you will have. If you stick to a small offset amount, and mainly offset down/inward and not up/outward, you can get acceptable results on even fairly curved surfaces.

  • @Trass3r
    @Trass3r Рік тому +1

    TLDR: reduce the number of steps based on viewing angle and distance from the surface.
    Thanks for the video! :)

    • @ItsBaffledd
      @ItsBaffledd 8 місяців тому +1

      How are you going to be rude and then say thanks?