Object Blending with Dither Fade, Pixel Depth Offset and Distance Fields

Sdílet
Vložit
  • čas přidán 8. 09. 2024
  • This week I show you how you can use Dither Fading and Pixel Depth Offset to blend solid objects together and then also how you can use Distance Fields to mask this automatically.
    If you want to learn more about Materials in Unreal Engine check out my new course here:
    tharlevfx.gumr...
    If you have any questions about Game Art VFX or the Unreal Engine then email me: tharlevfx@gmail.com
    Or you can find more tutorials on my website: www.tharlevfx.com
    or check out my work on the Unreal Marketplace:
    www.unrealengi...
    or follow me on Twitter: @tharlevfx If you'd like to support the channel you can do so on Patreon: www.patreon.com/tharlevfx

Komentáře • 75

  • @davidsawchak4575
    @davidsawchak4575 Před 2 lety

    I was about to just give up on this after a day of searching for a way to do it. Cheers!

  • @S-I-T
    @S-I-T Před 4 měsíci +1

    This may not be the place to ask this question but here goes. Embergen renders out really nice depth maps for flipbook renders. Is there a way of using these to essentially "Push and Pull" pixels in screen depth buffer in UE5? Hope the question makes sense. I'm very new to UE5 (propietry engines and whatnot in the past) and your Udemy videos have been a godsend. thank you :)

    • @tharlevfx
      @tharlevfx  Před 4 měsíci

      What would be the result you’re hoping to get? You could certainly use the depth texture with depth fade for a nicer intersection - check my latest video from yesterday

  • @AndrewWeirArt
    @AndrewWeirArt Před 5 lety +2

    Gods work! great stuff. I found this in the paragon assets, but i dont think it used distance fields. either way. i forget how to use it every time. this vid saved me! :)

  • @divyabaranwal6825
    @divyabaranwal6825 Před 4 lety +1

    Thank you so much. I saw this in another tutorial but you teach it so better.

  • @baorichard4345
    @baorichard4345 Před 4 lety +3

    Someone buy this dude a great mic! Nice video though~

    • @tharlevfx
      @tharlevfx  Před 4 lety +1

      Bao Richard I’ve just got one! Hopefully should be better from now on :)

    • @AdelaideBen1
      @AdelaideBen1 Před 2 lety

      @@tharlevfx I am so grateful for your videos, but at the same time watching them back now makes me want to pull the hair (out of my ears)...I couldn't understand the audio drop-outs and didn't know if it was a CZcams artefact or from your recording. Anyway, thanks for all your efforts.

  • @malindurashmika8386
    @malindurashmika8386 Před 8 měsíci

    Great video so far. Thank you

  • @rendermanpro
    @rendermanpro Před 4 lety +6

    Nice! (but to show the effect you could use different colors, not white on white :) )

    • @tharlevfx
      @tharlevfx  Před 4 lety +2

      renderman.pro thanks for the idea, I’ll try and show this sort of thing off better next time!

  •  Před 4 lety +1

    Thanks! Amazing tut

  • @drekenproductions
    @drekenproductions Před rokem

    whoa distance fields might be quite useful in refraction keeping the water line stable

    • @tharlevfx
      @tharlevfx  Před rokem

      Generally I used depth fade for that but distance fields would totally work too

    • @drekenproductions
      @drekenproductions Před rokem

      @@tharlevfx which would be more performant do you think?

    • @tharlevfx
      @tharlevfx  Před rokem

      @@drekenproductions I’m not 100% sure - you would have to do some tests. Distance fields are quite cheap to access if you’re happy paying the disc space to enable it.
      Probably they’re both so cheap it’s unlikely to make a big different in all honesty.

  • @carlvalleray
    @carlvalleray Před 4 lety

    Hi tharlevfx, thank you for the tutorial!

  • @BigfootU
    @BigfootU Před 3 lety

    Sooo helpful! Thank you sir!

  • @allanportilho
    @allanportilho Před 3 lety

    Thank you so much, very helpfull

  • @indust64
    @indust64 Před 5 lety +1

    Thanks brother, this is the clearest guide I could find

  • @remon563
    @remon563 Před 3 lety

    super helpful mate. Your tutorials are the best :)!

  • @xeoncat
    @xeoncat Před rokem

    In the end you connected it to the PDO output, but mine only works in Opacity Mask

  • @Dhieen
    @Dhieen Před 2 lety

    very good!

  • @callandekeijzer4128
    @callandekeijzer4128 Před 5 lety

    Hey Tharle, thanks for the video. would you care to explain what the difference between the Saturate Node is and a regular Clamp?

    • @tharlevfx
      @tharlevfx  Před 5 lety +3

      Thanks for the question, I’ve actually just covered that in my latest video - Unreal Shader Math 102. Check that out and let me know if you have any more questions!

  • @blouko
    @blouko Před 5 lety +1

    This is amazing, thank you so much😊

  • @kegssparx8086
    @kegssparx8086 Před 3 lety

    Very helpful!! =D

  • @embereve-chan
    @embereve-chan Před 4 lety +2

    Best way to blend objects is simply to use the DitherTemporalAA node and put a scalar parameter of 2-5 on the Alpha Threshold and put that on PDO in the material attributes.

  • @AllmakeDesigner
    @AllmakeDesigner Před 2 lety

    Hi. How to get smooth edge when i use masked material and ditter temporal AA node. This is good for optimize but i need more smoothest edge because i need smoke

    • @tharlevfx
      @tharlevfx  Před 2 lety

      in that case you would just have to use a transparent shader and pay the extra shader cost. Temporal dither AA is a nice technique for some things, but not suitable for every shader

  • @Firespectrum122
    @Firespectrum122 Před 3 lety +1

    I'm not sure if you are still doing tutorials but here is a question - imagine two meshes - Mesh A and Mesh B, which intersect. Is there a way to make the area on mesh A transparent based on where Mesh B intersects it?

    • @tharlevfx
      @tharlevfx  Před 3 lety

      Haven’t for a while but will again soon hopefully! And yeah - check out the custom depth buffer - Tom looman has a great article about it iirc. Or possibly just a world space mask depending on your use case. I made a video about them.

  • @e2dx
    @e2dx Před 2 lety

    Well well

  • @n1lknarf
    @n1lknarf Před 4 lety +16

    please, get rid of the noise gate in your mic. sometimes your voice doesn't even come forth

    • @tharlevfx
      @tharlevfx  Před 4 lety +3

      thanks for the feedback - i've turned it off for now but i live in a busy area so hopefully there's not too much background noise. Hopefully i can upgrade my setup soon and get a better mic!

  • @norbertswierczek7749
    @norbertswierczek7749 Před 3 lety

    Hi! It's all great but unfortunately it doesn't seem to work with geometry that doesn't have any volume (e.g plane or landscape). Even if the object is cube, the effect is different depending on the cube scale (if its too thin it doesnt work at all). Is there any way around it? Maybe some AO based calculation?

    • @tharlevfx
      @tharlevfx  Před 3 lety

      Could you try and use a distance field proxy mesh to add to the distance field, even if the object doesn’t have volume?

    • @tharlevfx
      @tharlevfx  Před 3 lety

      Pixel offset and dither fade should still work no?

    • @norbertswierczek7749
      @norbertswierczek7749 Před 3 lety

      @@tharlevfx Well, offset kinda works when its value is below 0, but what it does it changes the overall color of whole object (in this example sphere).
      In general I'd like it to be universal setup, so I can't just create proxy mesh for every object I need, It would take ages in some cases :D I ended up with leaving the "Affect Distance Field Lighting" turned on and working with this noisy thing that's generated intsead of smooth gradient - it's still better than dithering all over the object :)

  • @caiyan26
    @caiyan26 Před 3 lety

    hi! fast forward to year 2021. Is this technique working with Raytracing? Thanks!

    • @tharlevfx
      @tharlevfx  Před 3 lety +1

      I’ve not tried with raytracing I’m afraid but I believe pixel depth offset should still work. There’s actually better blending techniques using runtime virtual textures - look out for a new video soon!

  • @SouthernHunter
    @SouthernHunter Před 4 lety

    Do you have a fix for that banding in the z-depth?

    • @tharlevfx
      @tharlevfx  Před 4 lety

      Southern Hunter if you mean the skybox then it shouldn’t be an issue - it’s just the way large numbers are displayed

  • @aliceduarte1034
    @aliceduarte1034 Před 3 lety

    follow all the steps but my mesh is getting this awful shaddowing :( and when I turn on distance field lighting gets better (??) haha

  • @Mr_Tea_Rexx
    @Mr_Tea_Rexx Před 3 lety +1

    know this is old but wish the mic would stop cutting out

  • @SouthernHunter
    @SouthernHunter Před 4 lety

    Hi I'm new to UE4 and I can't seem to find a node called "Offset", could it be know as anything else?

    • @tharlevfx
      @tharlevfx  Před 4 lety +2

      Southern Hunter it’s probably a Scalar Parameter that I’ve named Offset. Hold S and click to create one. It’s a value you can name and edit to make your materials

    • @SouthernHunter
      @SouthernHunter Před 4 lety

      @@tharlevfx thanks so much

  • @suitoha9336
    @suitoha9336 Před 3 lety

    I am profiling my game, and stuck with high translucency and lights numbers. Do you have any ideas on how to profile and identify the culprit?

    • @tharlevfx
      @tharlevfx  Před 3 lety

      Check the shader complexity view mode for where you have areas of high overdraw - and the gpu profiler should help identify which lights are expensive

    • @suitoha9336
      @suitoha9336 Před 3 lety

      @@tharlevfx Thank you for the answer!
      Lights? I thought Translucency was related to materials and not the lights??

    • @tharlevfx
      @tharlevfx  Před 3 lety

      @@suitoha9336 translucency is mateirals - sorry you mentioned lights too.

    • @suitoha9336
      @suitoha9336 Před 3 lety

      @@tharlevfxOh, yeah! I decided to turn off all lights in the particle effects. And, try to add gradually while measuring.
      Optimization graphics for a newbie is very overwhelming.

    • @tharlevfx
      @tharlevfx  Před 3 lety

      @@suitoha9336 if you check out the reading list on my website : tharlevfx.com there’s some links to articles about optimisation. But yeah, it can get pretty complex!

  • @metekavruk_Alanya
    @metekavruk_Alanya Před 3 lety +1

    The conclusion is that we should not use this method for many objects. I was looking for a solution for rocks blending nicely with terrain - i mean thousands of them.

    • @tharlevfx
      @tharlevfx  Před 3 lety +1

      take a look into runtime virtual textures - they work with landscapes and are the best way to do material blending these days - i've not got a video on them yet, but check out Ben Clowards youtube channel, i think he just covered them

  • @suitoha9336
    @suitoha9336 Před 3 lety

    Can this be used with lerp to the alpha value? I've tried it, but I'm getting such a low resolution, pixelized effect :(

    • @tharlevfx
      @tharlevfx  Před 3 lety

      Particles can read from distance fields but not write to them. Generally particles are translucent or additive and you just use a depth fade to deal with blending. There’s also a new technique with Runtime Virtual Textures, I’m just putting together a video on them now.

    • @suitoha9336
      @suitoha9336 Před 3 lety

      @@tharlevfx Thank you for the detailed response!
      I actually edited my question to ask about "lerp the alpha" instead of using it with particle effects. Do you have any ideas on lerping alpha with Masked blending?
      I have another question that I put in another comment.

    • @tharlevfx
      @tharlevfx  Před 3 lety

      @@suitoha9336 masked will always just be on or off so you need to use translucent or dither fade to get a nice soft transition

    • @suitoha9336
      @suitoha9336 Před 3 lety

      @@tharlevfx Thank you for the reply! Is there a difference between translucent and dither fade in terms of calculation costs?

    • @tharlevfx
      @tharlevfx  Před 3 lety

      @@suitoha9336 dither fade with masked material will be much cheaper but there's a big visual difference between the two.

  • @emranbayati1869
    @emranbayati1869 Před rokem

    Loved your video but the sound was constantly getting on and off

  • @goldennboy1989
    @goldennboy1989 Před 3 lety

    Doesnt work for me. Sphere just stays black o.O

  • @misseren
    @misseren Před 2 lety

    Hi Thanks for the useful tutorial, I tried it in UE5 but it didn't work, it had the same behavior until 10:36, but as soon as I set it to Opacity mask, the whole sphere became translucent and it was displayed on the back side. What should I do? Here is the video : czcams.com/video/3YO78BYjU_w/video.html

    • @misseren
      @misseren Před 2 lety

      nvm, resolved by changing the version to 5.0.2 :)

  • @RB-hd4vr
    @RB-hd4vr Před 3 lety

    EH UH EUH EH