Object Space Gradient in UE4

Поділитися
Вставка
  • Опубліковано 31 січ 2025

КОМЕНТАРІ •

  • @Kokuyous3ki
    @Kokuyous3ki 2 роки тому +4

    I'm so happy that there are people here who actually only include what we need in their tutorial. Not starting from how to make a cube in blender and import it so that we can learn what materials are before finally starting to talk about what is actually in the title

  • @filipprimus7875
    @filipprimus7875 6 років тому +11

    One of the best UE4 material technics tuts. The explanation of every node is invaluable. Thanks a lot!!

  • @MarkOfArgyll
    @MarkOfArgyll 4 роки тому +1

    I won't pretend to understand everything there, but it's exactly the sort of thing I've been looking for! Thank you so very much for doing tutorials! :) Subscribed - no brainer :D

    • @tharlevfx
      @tharlevfx  4 роки тому +1

      Mark Brown thanks man, let me know if you have any questions or topic requests!

    • @MarkOfArgyll
      @MarkOfArgyll 4 роки тому

      @@tharlevfx Once I've watched all of your UE4 vids, perhaps but I generally feel uncomfortable making requests from folks I haven't had much interaction with. Feels like I'm being "one of those" - you know what I mean? lol

  • @aweidenhammer
    @aweidenhammer 5 років тому +1

    Great tutorial, thanks! I've used several of your tutorials now to build up an ever-increasing library of MatFuncs that help our productions out a ton! This one in particular is so useful. I'm always wanting to make a quick object grad on something but not wanting to go bake one, or bother with ingesting a texture for the purpose. I added some cheapContrast, direction (component mask) switches, and paramaterized the offset value so the MF has some more control.

    • @tharlevfx
      @tharlevfx  5 років тому

      Andrew Weidenhammer making it into a function is a great idea! Glad you’re finding these useful :)

  • @oisit
    @oisit 3 роки тому

    Thank you so much for all you do to help everyone understand what's going on. Your tutorials are excellent!

  • @xylvnking
    @xylvnking 10 місяців тому +1

    man you've come in clutch for me so many times. using this to reduce wpo wind for trees based on height. thank you.

  • @__dane__
    @__dane__ 3 роки тому +6

    This is likely the only video I've seen where someone shows a simple way to create an object world space gradient

  • @Obiwahn89
    @Obiwahn89 3 роки тому

    Very high value content! I needed this and remembered you did a video about this.

  • @privaatsak
    @privaatsak 3 роки тому +1

    Precisely what I was looking for - thanks so much!

  • @esk6a
    @esk6a 2 роки тому

    Was looking for this! So useful and well explained! Thank you sir!

  • @MelvilleG
    @MelvilleG 4 роки тому +1

    Thanks man. As always - the most valuable info comes in a most humble manner. Just pure essense. Thank you for your work.

  • @Lumpappsofficial
    @Lumpappsofficial 5 років тому +1

    Just what I needed for a SynthWave project videoclip ;) Thanks!

  • @ForeverPrototyping
    @ForeverPrototyping 4 роки тому

    This was brilliant, thanks for explaining so clearly mate

  • @Daniel-be6cj
    @Daniel-be6cj 3 роки тому

    Exactly what I needed, thank you!

  • @werti4894
    @werti4894 11 місяців тому

    this is what I needed!! thank you so much

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

    You can sort of get it to work with instances, using a VertexInterpolator after the Object position you now get the position of the instance, but no idea how to get the scale or bounds

  • @nintenjo64
    @nintenjo64 26 днів тому

    Great video, used it many times (you think id have learnt by now).. Would love to see a version of this that uses the same logic, but ignores object rotation, so the gradient is based on the bounds size, bit not the bounds rotation and you can define in the material the axis to align it too.. And if you can tweak the gradient size it would be great too.. I know its all maths, but its messes with my head. :D

  • @user-jw9zn1fg9n
    @user-jw9zn1fg9n 3 роки тому +2

    Amazing tutorial! This makes all the hassle we go through trying to create UVs in C++ unnecessary!

  • @RupertMcGruber
    @RupertMcGruber 4 роки тому

    Thanks a bunch for this, super helpful and pleasant to follow!

  • @Happy-Dog-Hero
    @Happy-Dog-Hero 4 місяці тому

    You could actually determine your own bounds size to work on foliage or other instances

  • @_UpVector_
    @_UpVector_ 3 роки тому +5

    Hey, thanks man this is wornderful. To make it work with foliage over uneaven terrains (I need to inject a ramp on trees so they look like occluding each other the closer we get to the base), just stick a VertexInterpolator between the Object Position's TransformPosition branch and the subtract. Cheers!

    • @SuWoopSparrow
      @SuWoopSparrow 3 роки тому

      Its not letting me use the vertex interpolator because its only available in pixel shaders. I'm not sure how to set my foliage material to a pixel shader. Do you know what determines this?

  • @cr3ap3r1
    @cr3ap3r1 2 роки тому

    Thanks for this pivot point gradient AO control! I was trying to use Texcoord control and it just wasn't working the way I wanted since the texture orientation on an atlas is not always bottom to top.

  • @solennripoteau6218
    @solennripoteau6218 4 роки тому +1

    Great tutorial, thank you!

  • @glennet9613
    @glennet9613 3 роки тому

    Great video, I'm planning to use it for a water shader by plugging it into opacity.

  • @agathayu
    @agathayu 4 роки тому +1

    Thank you so much for the tutorial. I was wondering how can i stretch the gradient across a fixed height from the bottom of object to say 2 units up?

    • @tharlevfx
      @tharlevfx  4 роки тому

      try multiplying the gradient to change how quickly it goes from black to white, and adding to it to move where the black point starts. dont forget to clamp it if you only what values between 0 and 1

    • @agathayu
      @agathayu 4 роки тому +1

      @@tharlevfx sorry It's not super clear for me. are you saying to add a multiply patch after the divide (by objectlocalbound) and connect it to a add node?

    • @tharlevfx
      @tharlevfx  4 роки тому +1

      Agatha Yu I’m not sure exactly your problem - can you email me with screenshots? tharlevfx@gmail.com

    • @agathayu
      @agathayu 4 роки тому

      @@tharlevfx I just sent you an email. Thanks so much!

  • @Fortunate_Son979
    @Fortunate_Son979 3 місяці тому +2

    OK, so I know how you can make this gradient magic works for foliage painting tool guys. Check this out: Transform vector from World to Instance'n'particle space and use ObjectPivotPoint node(Mesh particle Pivot Location socket) instead of Object Position node and you done. I am pretty much sure this wasn't available in time this tutorial was recorded, but in UE5 this works for me. So Subtract stuff to define vector, then transform from world to particle space, then mask B then everything else.

    • @scarneck180
      @scarneck180 3 місяці тому +2

      Came back to do the same thing. I'm using a regular ISM but I assume it'll work for foliage too since it's the same method. I didn't see that OPP node but I found a much easier way, I just take the AWP -> TransformPosition from WS to IPS -> Mask -> Divide (100) -> Add (0.5). Though I am just using this with cubes so maybe it won't work for other meshes.

  • @anthonypossobon
    @anthonypossobon 5 років тому +1

    This was what I was looking for! Thanks for putting this together. Quick question, I'm using what you've done here as a UV just like you've shown by the end of the tutorial. I'm using this UV to funnel in my own custom gradient among other things. Everything is mapping correctly however, I am getting banding from my gradient which I assume is happening because of the Divide node with the ObjectLocalBounds. Mind pointing me into the right direction to smooth this out? Thanks in advance!

    • @tharlevfx
      @tharlevfx  5 років тому

      Anthony Possobon do you mean like a gradient map? It might be worth trying different compression settings, the uvs are mathematical so shouldn’t get banding but if you’re using a texture gradient too that might.

    • @anthonypossobon
      @anthonypossobon 5 років тому

      @@tharlevfx Actually I believe it's because I'm trying to cheat the system in what I'm sure is a very noob way of doing things :3. I used what you've shown in your tutorial to create a UV that plugs into the my objects material base color pin. Later, in a post processing material, I use ScreenTexture: Diffuse Color to get "UV" pass to do other effects like adding gradients and such. I'm sure because of this I'm getting the banding. Thanks for the reply and help!

  • @kromenoi9082
    @kromenoi9082 5 років тому +3

    Just thought I'd mention, this does work with foliage instances if you use the fairly new vertex interpolator node!

    • @tharlevfx
      @tharlevfx  5 років тому

      Good to know! I’ll have to check it out :)

    • @VRock121
      @VRock121 5 років тому

      Wanna elaborate on how to achieve this?

  • @habib90ful
    @habib90ful 2 роки тому

    great tuts, subscribed

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

    HOLY SHIT THIS IS AWESOME

  • @huard666
    @huard666 4 роки тому +1

    That is great, helped me a lot - THANKS

  • @alxleiva
    @alxleiva 2 роки тому

    This is great, I just would like to know if there's a way to achieve this local bounds range on a post-process material? TransformVector only works on Surface materials. I'm trying to use the post-process volume's bounds as my domain.

    • @tharlevfx
      @tharlevfx  2 роки тому

      You could probably use a blueprint to pass the volume dimensions to a material parameter collection?

  • @3xchris
    @3xchris 2 роки тому

    Great video! How would I change this if I always wanted the black part of the gradient at the bottom all the time if the object gets rotated around?

    • @tharlevfx
      @tharlevfx  2 роки тому

      If you use the World Position node you can create a gradient that’s always the same regardless of how the object is rotated

  • @MrFabutan
    @MrFabutan 2 роки тому

    I would love to know how to generate these gradients on a character in pre skinned space.

  • @legacythegame
    @legacythegame 5 років тому +2

    Great stuff, cheers!

  • @LeonardoViale
    @LeonardoViale 5 років тому +1

    Sweet! Great tutorial! Question, what if we want to keep the gradient always aligned to the Z axis regardless of the object's rotation, but keep the gradient relative the the object bounds?

    • @tharlevfx
      @tharlevfx  5 років тому +1

      Leo good question! If you take the world position z, subtract the object position z to get the gradient 0 at the pivot and then divide by the object z bounds to get the scale correct? I think that should work!

    • @LeonardoViale
      @LeonardoViale 5 років тому

      @@tharlevfx Thanks! I tried that but doesn't make a difference, specially since there's a mask after those calculations are done, right? I tried without the world/local transform and kinda works but the gradient stays in the same position so it's not really working. I think the matter comes to getting the bounds to work independent of the object transforms so that way it reads the bounding box changing as you rotate for instance.

    • @tharlevfx
      @tharlevfx  5 років тому

      Leo I think you’re over complicating it - the world position z gives you a vertical gradient, subtracting the object position moves the gradient start point to the object and scaling by the object bounds scales it to be 0-1 on the object. I guess you technically need the lowest point of the bounding box and the vertical size of the rotated bounding box to get it perfect but I don’t think you can get that data in the material editor directly, so maybe the approximate solution isn’t good enough for your needs...

    • @LeonardoViale
      @LeonardoViale 5 років тому

      @@tharlevfx yeah maybe I'm trying to overthink it lol, your method is really good and works great, I'll add a parameter for the height and that'll work. Thanks for the help and great tutorial!

  • @ScottBarrettihq
    @ScottBarrettihq 4 роки тому +1

    good tutorial, but for future ones, because there is so much on screen, it is mostly impossible to read anything (even on my 40" screen). I recommend allowing the name of the node to fully appear before you slam enter and as well, call it out, more clearly, as though you were talking to a dog. My dog wasn't able to follow this at all.

  • @yacue2843
    @yacue2843 4 роки тому

    I have a question. When applied to a mesh, the gradient is well applied in the local direction. Why is it applied to a mesh particle and the gradient is in world coordinates? When the particle rotates

    • @tharlevfx
      @tharlevfx  4 роки тому

      Mesh particles have their own space since the introduction of niagara - try transforming the gradient into mesh particle space and see if that works?

  • @terraint3697
    @terraint3697 5 років тому +2

    Thanks for this!

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

    sweet !! thanks man !

  • @NOOBIEPIE
    @NOOBIEPIE 2 роки тому

    Hey Great video Thanks! Is there any way to make it work with Landscapes? because right now it just uses each draw cell as an object..

  • @davinsaputraartandgamedev9453
    @davinsaputraartandgamedev9453 4 роки тому

    or the last thing you show, If I change the color to blue, and the transformvetor into world space, will I get a snow effect?

    • @tharlevfx
      @tharlevfx  4 роки тому

      You could use this for a snow effect but check out my video on the dot product - that’s how I would automate snow on top of meshes

  • @SomeKindOfMattias
    @SomeKindOfMattias 4 роки тому

    Ahh, very pedagogical, thanks! UV's and positions can be a bit hard to... wrap your head around ARRRR :))

  • @nobody5825-b3l
    @nobody5825-b3l 2 роки тому

    will this work if the mesh is used in a niagara system? the gradient seems to resort back to world position in that case

  • @anderl22
    @anderl22 2 роки тому

    very helpful! thanks!

  • @manmohan_manoj
    @manmohan_manoj 2 роки тому

    Is there a way to make this work with vertex animation, it seems to treat is similar to the instances.

    • @tharlevfx
      @tharlevfx  2 роки тому

      i'm not sure there is unfortuanately - the vertex animation won't affect the bounding box of the object which is used in the gradient calculation

    • @manmohan_manoj
      @manmohan_manoj 2 роки тому

      @@tharlevfx one of my friends found a solution. PreSkinnedPosition node seems to be the solution. It gives you the right data and convert it though vertex interpolator and it goes with the mesh

  • @IndyStry
    @IndyStry 2 роки тому

    Thanks man!!

  • @witchreturns2263
    @witchreturns2263 2 роки тому

    Thank you very much! I have a question... a small detail about to ask.
    I created the exhaust for a floating craft with this and when I move it on the map the gradiant material is constrained to the obj. But, the problem appears when the object has it's own animation, such as... it raises a meter above earth so the gradiant get modified. In relation to the map is ok, but in relation to it's animation it gets modified.
    I hope you understand the issue... what can I do to fix it, to stay the same fully to itself, no matter what? except UV

    • @tharlevfx
      @tharlevfx  2 роки тому +1

      If the object is animating and changing the bounding box then this might not work - probably uvs are the best solution I’m afraid. They usually are - there’s just some times where techniques like this can add something.

    • @witchreturns2263
      @witchreturns2263 2 роки тому

      @@tharlevfx Thank you for the reply! what I found is to simply try to animate the material's offset, when it's down and when it's up (to be the same). I think it will solve the issue fully

  • @cmds.learning7426
    @cmds.learning7426 4 роки тому

    cool work!tnanks

  • @samliveshere88
    @samliveshere88 4 роки тому

    is there a way to rotate the gradient after its set up for instance have it on a 45 degree angle?

    • @tharlevfx
      @tharlevfx  4 роки тому

      If you take your two gradients and append them into a vector2 you should be able to plug that into a Rotator node and plug a constant into time to rotate the gradients

    • @tharlevfx
      @tharlevfx  4 роки тому

      FYI - Rotators take an input in radians so a value of 2*pi will give you a full rotation. There’s also an inbuilt function containing pi if you need it.

    • @samliveshere88
      @samliveshere88 4 роки тому

      thanks for getting back to me, just to clarify I'm appending the abs world position and the object position right after their transform position nodes and pluging that into the coordinate node for the rotator while having a constant in the time, sorry for the questions, materials can get confusing sometimes

  • @miloszgierczak4806
    @miloszgierczak4806 4 роки тому +1

    thank you!

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

    Hugs for that!

  • @ryanjstever
    @ryanjstever 2 роки тому

    hmm, anyone know why my material blinks like crazy as soon as I divide obectlocalbounds? Latest UE5 build

  • @Rossilaz58
    @Rossilaz58 2 роки тому

    Could you theoretically use PerInstanceCustomData to get this working on foliage? (I don't need to get it working on foliage, just curious)

    • @tharlevfx
      @tharlevfx  2 роки тому

      Check out the vertex interpolator video - it’s actually pretty simple to get per object data on foliage instances with that

  • @byunjoy1320
    @byunjoy1320 3 роки тому +1

    This objectlocalbound and divided is so useful

  • @fanyang2876
    @fanyang2876 4 роки тому +1

    thanks this's help mush.

  • @rysone3173
    @rysone3173 3 роки тому

    Thanks!

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

    How many of you checked your phone at 3:29?

  • @smsjs5138
    @smsjs5138 2 роки тому

    thank you!!!!!!!

  • @myelinsheathxd
    @myelinsheathxd 3 роки тому

    thx!

  • @ali3ser
    @ali3ser 10 місяців тому

    hello oliver!

  • @richarddrenka
    @richarddrenka 3 роки тому

    this basic material mappings for object based gradients should be already 'built in', even in basic mesh mapping settings..
    not mentioning UE compiles thousands of 'shaders' in vain whenever possible, and still there are really basic things missing..

  • @DonEsteban3D
    @DonEsteban3D 4 роки тому

    now borrow me magnifier glass to see your nodes...

    • @tharlevfx
      @tharlevfx  4 роки тому

      Haha, sorry - it’s in 4K, I don’t make videos in this resolution anymore

    • @DonEsteban3D
      @DonEsteban3D 4 роки тому

      @@tharlevfx Thx for this anyway :)