Blend Between Textures in a Shader (Vertex Colors) | ShaderGraph Unity Tutorial

Learn how blend between 2 (or more) textures using Vertex Colors. This gives you a similar experience to using the Terrain Tools to paint on a Terrain, but on a mesh!
🌟 Learn more about ShaderGraph with my ShaderGraph Course: www.gamedev.tv/p/unity-shader...
💸 Ongoing sales 💸
⚫ Check out the latest Humble Bundles www.humblebundle.com/software...
⚫ Publisher Sale! 50% OFF an entire publisher's Assets! Publisher changes weekly! assetstore.unity.com/publishe...
⚫ Save up to 50% on NEW Assets: assetstore.unity.com/?new_sal...
👨‍💻 As always, all code from this video is available on GitHub: github.com/llamacademy/vertex...
📚 Resources:
⚫ Learn more about ShaderGraph with my ShaderGraph Course: www.gamedev.tv/p/unity-shader...
⚫ PolyBrush: unity.com/features/polybrush
⚫ ProBuilder: unity.com/features/probuilder
❤ Believe in LlamAcademy's mission and have received value from the videos? Become a Supporter:
⚫ Patreon: / llamacademy
⚫ KZread Member: / @llamacademy or click the Join button on any video
⚫ GitHub Sponsor: github.com/sponsors/llamacademy
----
I also have some Unity Assets: assetstore.unity.com/publishe...
Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.
#unitytutorial #tutorialtuesday #gamedev #tutorial #unity #llamacademy #gamedevelopment #shaders #shadergraph
Chapters:
00:00 Topic Introduction
00:43 Shader Conceptual Overview
01:40 Setup / Using PolyBrush / Using ProBuilder
04:29 Make the Shader!
07:08 Apply Shader & Paint Vertex Colors
09:17 Special Announcement!
09:48 How to Support LlamAcademy

Пікірлер: 39

  • @alec_almartson
    @alec_almartson9 ай бұрын

    Thank You for this Lesson 💯👍🏻 Very cool video. This is a very interesting topic, maybe for adding more realism..., for instance when a grenade explodes in front of a wall and you want to paint a section black (because of the blast).

  • @LlamAcademy

    @LlamAcademy

    9 ай бұрын

    Great idea!

  • @Gerier1
    @Gerier19 ай бұрын

    Great tutorial as always! I fiddled around with the exact same setup as showcased in this video before. I wasn't very satisifed with the 4 texture limitation, especially for ground meshes. Couldn't find a better solution for it tho. My last idea before giving up on the whole thing was using multiple vertex textures, but it felt very janky how some textures could override some and not others. Got any idea how to do more than 4? Also great to hear about that gamedev TV course. I took courses from them before and they're really good, looking forward to it!

  • @LlamAcademy

    @LlamAcademy

    9 ай бұрын

    I do not have an idea going beyond 4 additional textures per material 🤔. That would require some real trickery.

  • @MatrixRex05

    @MatrixRex05

    9 ай бұрын

    you could do splatmapping, just like unity terrain. I don't know exactly how its done, but I have some guesses. Instead of using vertex color, we could use a image texture, and use its channels to blend between 4 materials. This will be our mask texture that is uv mapped 1:1 along the whole mesh. And we could add more then one mask textures. Needs some thought on how to blend between multiple mask textures.

  • @Netroshin
    @Netroshin9 күн бұрын

    I did this twice now but my material is going to be pink and applying vertex colors doesn't do anything at all. What did I do wrong? Edit: I downloaded your code from github and it does the same error... something is missing on my project. EDIT2: I didn't had a Scriptable Render Pipeline Setting in "Project Settings" -- "Graphics". It works now. Very good tutorial!

  • @sadkid9157
    @sadkid91579 ай бұрын

    I'm a huge fan of your game development content and I've been working on a project where I want to create an AI that can climb buildings similar to what we see in Assassin's Creed, using Nav Mesh agents. I've been struggling with this and would greatly appreciate it if you could create a tutorial or offer some guidance on how to achieve this in Unity. Your expertise in this area would be invaluable to me and many others in the game development community.

  • @LlamAcademy

    @LlamAcademy

    8 ай бұрын

    That’s definitely a tricky one to set up where it would look nice 🤔 I’ll have to think about it

  • @dotomomo
    @dotomomo5 ай бұрын

    Hi @LiamAcademy, thanks for the great video... Do you think this method would be possible to use for blending two lightmaps together? I'm making a procedural game and need to blend the lightmaps of two rooms together in a small hallway that connects them? Would be greatly appreciated...

  • @LlamAcademy

    @LlamAcademy

    5 ай бұрын

    Not sure. Best way to find out is to give it a shot!

  • @tommyrowe2k9
    @tommyrowe2k96 ай бұрын

    Great Tutorial, I've just started playing around with shaders after a few years of game development and it is a shocker. Quick question, what was the reason to us the 'Split Texture Transform' and 'Tiling and Offset' nodes rather than plugging the BaseMap directly into the 'Sample Texture 2D' node? It seems to have the same effect on my setup but I'm wondering if I'm not understanding something? Again pretty new to shaders so there's a good chance I've missed something :)

  • @LlamAcademy

    @LlamAcademy

    6 ай бұрын

    By splitting the texture transform it allows us to customize the tiling and offset to get more/less repeating of the texture before going to the Sample Texture 2D

  • @PRodi_
    @PRodi_9 ай бұрын

    Great tutorial! How can we make this without ProBuilder? Will you make a tutorial about it?

  • @LlamAcademy

    @LlamAcademy

    9 ай бұрын

    You can set vertex colors in code using Mesh.colors & Mesh.SetColors docs.unity3d.com/ScriptReference/Mesh.html Or I’m sure they can be set in a 3D modeling program but I don’t know how to do that 🙂

  • @robertengstrand4314
    @robertengstrand43145 ай бұрын

    What would be a practical way to be able to detect material with raycasting to set up various footstep material sounds while using Polybrush Shader Blend? Thanks!

  • @LlamAcademy

    @LlamAcademy

    5 ай бұрын

    I think you can do something like this: kzread.info/dash/bejne/i4xsp5N6dZaoidY.html In this video we handle simple single textures and renderers and terrains. Following similar logic as we do on the terrain, you can identify which triangle was hit on the mesh and figure out the vertex colors active on that triangle and then you can tell which texture was active. Not sure if there’s an easier way but that’s my initial thought.

  • @Space_Masters
    @Space_Masters9 ай бұрын

    Awesome! Could show how to change the vertex colors in code to make a splatoon like panting effect?

  • @LlamAcademy

    @LlamAcademy

    9 ай бұрын

    For Splatoon it is probably painting to a virtual texture or using decals instead of vertex colors. The level of detail on those is higher than is feasible with Vertex colors. For setting in code, you can use Mesh.colors and Mesh.SetColors docs.unity3d.com/ScriptReference/Mesh.html

  • @carlt8693
    @carlt86939 ай бұрын

    Cool! Could be used for blood splash on a character?

  • @LlamAcademy

    @LlamAcademy

    9 ай бұрын

    Sure. On higher poly meshes you can get some good looking results. For lower poly meshes, using a similar pattern based on a texture you manipulate would give better results.

  • @karole5646
    @karole56469 ай бұрын

    Hi, anyone using mac having problem with probrush like me: anytime i try to use the paint brush, the window goin crazy, it keep zooming in and out and super hard to paint. It happen on my M1 mac, but work fine on window xD

  • @kaderkader792
    @kaderkader7929 ай бұрын

    I have a 2d texture flag sprite. I want to make a flag shader and I couldn't manage it, please make a video. ı use urp

  • @Rdp0300
    @Rdp0300Ай бұрын

    hi i just wondering can we use custom pre built models outside from blender etc?

  • @LlamAcademy

    @LlamAcademy

    Ай бұрын

    Yup!

  • @PablosCorner
    @PablosCorner3 ай бұрын

    I wonder how feasible this would be to do with the built in renderer to be used in VRChat.

  • @campbellwinslow6986

    @campbellwinslow6986

    2 ай бұрын

    Wondering this myself, I've definitely seen this used in VRC worlds, but not sure if it's using the probuilder material

  • @trafalger_law_0562
    @trafalger_law_05624 ай бұрын

    Hi, can you please help me use this at runtime?

  • @LlamAcademy

    @LlamAcademy

    4 ай бұрын

    What aspect of this is not working at runtime for you?

  • @Bond007in
    @Bond007in9 ай бұрын

    ❤🎉✌💯👏

  • @DirtyShampoo
    @DirtyShampoo7 ай бұрын

    Is there a way to add normals etc

  • @DirtyShampoo

    @DirtyShampoo

    7 ай бұрын

    Edit to my comment is there a way to add more than two textures like 4/5 or something like that I didn’t watch the full video and that’s the reason I commented the thing before hand.

  • @LlamAcademy

    @LlamAcademy

    6 ай бұрын

    Yes. You can use each R, G, B, and A channels for a different texture

  • @testt3134

    @testt3134

    13 күн бұрын

    @@LlamAcademy how to do it?

  • @LlamAcademy

    @LlamAcademy

    12 күн бұрын

    @testt3134 it’s the same process as we used for the R channel here, just with each of G/B/A showing a different texture

  • @testt3134

    @testt3134

    12 күн бұрын

    @@LlamAcademy how i can make more colors, e.g pink or orange?

  • @caponeart3596
    @caponeart35963 ай бұрын

    Unfortunately this doesn't seem suited to typical gamedev pipelines because polybrush creates a new mesh, so if you're making assets in a 3D program (i.e not probuilder) then if you need to do revisions and re-export it's not going to update in engine because it's using the mesh from polybrush. Please someone correct me if wrong?

  • @LlamAcademy

    @LlamAcademy

    3 ай бұрын

    You are right. In your 3D modeling program you can do the vertex color painting and re-export / import to Unity to avoid the poly brush mesh creation, or you can also export the modified mesh and use that as your new mesh

  • @caponeart3596

    @caponeart3596

    3 ай бұрын

    It’s good to have clarification, wasn’t quite sure. The export option is nice, just wish it wasn’t needed (like Unreal). Hopefully something that is addressed in the near future. Thanks for the info!

  • @shpoinkervr
    @shpoinkervrАй бұрын

    i cant even get polybrush to begin with