Everyone Should Learn This Basic Shader Graph (Auto Tiling) - Unity Shader Graph Tutorial

Philip Herlitz
12 Nov 202325:54

Summary

TLDRIn this tutorial, the creator thanks their Patreon supporters and introduces a beginner-friendly Shader Graph tutorial for Unity. They demonstrate how to create a Shader Graph that automatically tiles textures when objects are scaled, enhancing workflow efficiency. The tutorial covers creating a lit Shader Graph, adding inputs for texture and object scale, and adjusting tiling through a multiplier. It also briefly touches on emission properties for textures. The creator encourages viewers to experiment with Shader Graphs and hints at future content exploring more advanced shader techniques.

Takeaways

  • 🎉 The video begins with a shout out to recent Patreon supporters, appreciating their contribution and motivation for content creation.
  • 🛠️ The tutorial focuses on creating a Shader Graph in Unity, despite initial hesitation due to the complexity of Shader Graph tutorials.
  • 🔧 The goal is to demonstrate a simple yet essential Shader Graph that should ideally be a built-in Unity Shader for tiling textures across surfaces.
  • 🌐 It clarifies that Shader Graph can be used with Unity's built-in render pipeline, contrary to a common misconception.
  • 📦 The process involves installing Shader Graph through the package manager and starting with a new, lit Shader Graph.
  • 🖼️ The tutorial aims to solve the issue of texture scaling and tiling on objects like floors and walls, enhancing visual quality.
  • 🛒 An example is given on applying a texture to a plane object in Unity and adjusting its material to handle automatic tiling.
  • 🔄 The importance of creating inputs for texture and object scale within the Shader Graph is emphasized for dynamic tiling effects.
  • 🎨 The Shader Graph is edited to include a tiling multiplier, allowing users to adjust the scale of the texture tiling.
  • ✨ Additional features like emissive textures and emission intensity are demonstrated to add glowing effects to the material.
  • 🧱 The tutorial concludes with a comparison of tiling on different object types like floors and walls, noting the need for separate Shader adjustments.

Q & A

  • What is the main topic of the video?

    -The main topic of the video is creating a Shader graph in Unity that allows for automatic tiling of textures on objects like floors and walls when they are scaled.

  • Why does the creator feel that a Shader for tiling should be a built-in Unity feature?

    -The creator feels that a Shader for tiling should be a built-in Unity feature because it's a common requirement to have textures tile seamlessly when objects are scaled, and it would simplify the process for users.

  • Can Shader Graph be used with the built-in render pipeline in Unity?

    -Yes, the creator demonstrates that Shader Graph can be used with the built-in render pipeline in Unity by installing it via the package manager.

  • What is the purpose of the 'floor tiling' Shader graph shown in the video?

    -The 'floor tiling' Shader graph is designed to automatically adjust the tiling of a texture based on the scale of the object, specifically for floor planes, ensuring that the texture scales cleanly without manual intervention.

  • How does the creator propose to handle tiling for walls differently from floors?

    -The creator suggests creating a separate Shader for walls because the typical scale for tiling on walls (X and Y axes) is different from floors (X and Z axes), and this would allow for more control and realism in texture scaling.

  • What is the significance of the 'tiling multiplier' input in the Shader graph?

    -The 'tiling multiplier' input allows users to adjust the size of the texture tiles without altering the Shader code, providing flexibility to scale the texture independently of object size.

  • How does the Shader graph handle emission to make objects glow?

    -The Shader graph handles emission by using a separate texture input for emissive textures and multiplying it by an emissive color and intensity value to control the glow effect.

  • What is the importance of setting default values for inputs like 'tiling multiplier' and 'emissive intensity'?

    -Setting default values for inputs like 'tiling multiplier' and 'emissive intensity' ensures that the Shader behaves predictably when first applied to an object and helps in maintaining a consistent look across different objects using the same Shader.

  • Why might the tiling effect look strange on the edges of a wall object?

    -The tiling effect might look strange on the edges of a wall object because the Shader is designed to work correctly only on the primary face of the wall, and the tiling logic does not account for the different scaling that occurs on side faces.

  • What is the creator's advice for users who are new to Shader Graph?

    -The creator advises new users of Shader Graph to start with simple projects like the tiling Shader shown in the video to get comfortable with the process before moving on to more complex Shaders.

  • How can viewers support the creator and get one-on-one help?

    -Viewers can support the creator and get one-on-one help by joining the Patreon page mentioned in the video description, where they can link their Discord account for special access.

Outlines

00:00

🎨 Shader Graph Tutorial Introduction

The speaker begins by expressing gratitude to new Patreon supporters, emphasizing their appreciation for the channel's content. They introduce the topic of the tutorial, which is the creation of a Shader Graph in Unity. The speaker clarifies that they won't be explaining Shader Graph in depth, as it can be overwhelming, but instead will demonstrate a simple, essential Shader Graph that should ideally be a standard feature in Unity. They proceed to show how to install Shader Graph through the package manager, even when using the built-in render pipeline, and set up a new project with a plane object to serve as a floor. The goal is to create a material that tiles a texture nicely when the object is scaled, which Unity does not handle by default.

05:01

🛠️ Setting Up the Shader Graph

The tutorial continues with the creation of a new Shader Graph aimed at achieving texture tiling that scales with the object. The speaker explains the process of setting up the Shader Graph using the built-in render pipeline and how to select the correct Shader type. They also discuss the importance of differentiating between Shaders for floors and walls due to the different tiling scales required. The focus then shifts to creating inputs for the Shader Graph, starting with a texture, and the speaker demonstrates how to apply this texture to the plane in the scene view. They also mention the alignment of the main camera for a better view and proceed to edit the Shader Graph to include the texture input.

10:02

🔍 Scaling Textures with Object Size

The speaker delves into the technical aspects of the Shader Graph, explaining the need to calculate the tiling of the texture based on the object's scale. They guide through adding a texture input node and demonstrate how to retrieve the object's scale within the Shader Graph. The process of calculating the tiling from the object's scale is detailed, including the use of nodes for tiling and offset, and the creation of a Vector2 for the tiling values. The speaker then connects the texture sample to the Shader Graph and shows how to adjust the tiling in the material's inspector, allowing for dynamic resizing of the texture pattern.

15:02

🌟 Adding Emission and Color Controls

The tutorial moves on to adding emission to the Shader, allowing the material to glow. The speaker duplicates the existing texture setup for the emission and introduces the concept of base and emissive colors. They explain how to multiply these colors with the texture to achieve the desired visual effect and mention the potential need for an emissive intensity control. The process involves adding more nodes to the Shader Graph to handle these new inputs, and the speaker ensures that the Shader Graph updates correctly to reflect these changes. They also address a temporary issue with the Shader Graph preview and resolve it by setting default values for certain inputs.

20:04

🧱 Applying the Shader to 3D Objects

The speaker explores the application of the Shader Graph to 3D objects, specifically a cube used as a wall. They discuss the challenges of resizing and rotating objects in Unity and how the Shader Graph behaves when applied to different faces of a 3D object. The tutorial highlights the need to create a separate Shader for walls to handle the different scaling requirements compared to floors. The speaker duplicates the floor tiling Shader and modifies it for wall tiling, demonstrating how to adjust the scaling inputs for the Y-axis instead of the Z-axis. They also show how to create materials for walls and apply the Shader Graph to achieve the desired tiling effect.

25:05

🔗 Wrapping Up and Future Tutorials

In the concluding part, the speaker summarizes the tutorial and expresses hope that it has demystified Shader Graph for the viewers. They mention the possibility of creating more advanced Shader Graph tutorials in the future, depending on viewer feedback. The speaker also encourages viewers to like, comment, and subscribe, highlighting the channel's progress towards 2000 subscribers. They remind viewers of the Patreon page and the benefits it offers, including a special Discord channel for patrons, and offer one-on-one help. The tutorial ends with a promise to see the viewers in the next video.

Mindmap

Keywords

💡Shader graph

A Shader graph is a visual programming framework in Unity that allows for the creation of shaders through a node-based interface rather than traditional coding. It simplifies the process of creating complex shaders and is designed to be more accessible to artists and those without a deep programming background. In the video, the creator discusses using Shader graphs with Unity's built-in render pipeline, demonstrating how to create a custom Shader graph for tiling textures across different scales of objects.

💡Patreon

Patreon is a crowdfunding platform where creators offer exclusive content to subscribers, or 'patrons,' who pledge financial support. In the script, the speaker begins by acknowledging recent patrons, indicating that their support is appreciated and motivates the creator to continue producing content. Patreon is a way for the creator to engage with their audience and provide additional value to those who choose to support the channel financially.

💡Unity

Unity is a widely-used game development engine that provides a comprehensive set of tools for creating 2D, 3D, virtual reality, and augmented reality games. The video's context involves using Unity's Shader graph feature to create custom shader effects, showcasing the engine's capabilities for material and shader creation.

💡Tiling

Tiling in the context of the video refers to the process of repeating a texture across the surface of a 3D object to cover its entire surface area seamlessly. The tutorial aims to create a shader that automatically tiles textures as objects are scaled, which is a common requirement in game development for creating environments with repeating patterns like floors or walls.

💡Texture

A texture in 3D graphics is an image applied to the surface of a 3D model to define its appearance. In the script, the creator mentions applying a hex floor texture to a plane object and discusses how the shader will affect how this texture tiles across the object's surface as it scales.

💡Material

In Unity, a material is a resource that defines the appearance of rendered graphics. It includes properties like textures, colors, and shader settings that determine how light interacts with the object's surface. The video involves creating a new material and applying a custom Shader graph to achieve the desired tiling effect.

💡Render pipeline

A render pipeline refers to the sequence of steps that a 3D graphics engine follows to generate a final image from 3D models. Unity offers different render pipelines, such as the built-in pipeline and the Universal Render Pipeline (URP). The script clarifies a misconception that Shader graphs can only be used with URP, showing that they are also compatible with the built-in render pipeline.

💡UV mapping

UV mapping is the process of defining how a 2D texture is applied to a 3D model. In the tutorial, the Shader graph is used to manipulate UV coordinates to achieve the desired tiling effect across the object's surface dynamically as the object is scaled.

💡Emissive texture

An emissive texture is a special type of texture that defines how much light an object emits, as if it were a light source itself. In the script, the creator shows how to incorporate an emissive texture into the Shader graph, allowing objects to glow based on the texture.

💡Tiling multiplier

The tiling multiplier is a value used in the Shader graph to control the frequency of the texture tiling. The video demonstrates how to create an input in the Shader graph for a tiling multiplier, which can be adjusted in the Unity editor to change the scale of the texture tiling without altering the shader code.

💡Prototyping

Prototyping in game development refers to the early stages of creating a game where basic versions of gameplay mechanics and visuals are developed and tested. The script mentions that the shader techniques discussed are particularly useful for prototyping, as they save time and allow for quick iteration on game environments.

Highlights

Introduction to creating a Shader graph for Unity's built-in render pipeline.

Explanation of why Shader graph tutorials can be overwhelming.

Goal to create a Shader graph that tiles textures automatically with object scaling.

How to install Shader graph in Unity's package manager.

Creating a new Shader graph and selecting the 'Lit' graph type.

Importance of understanding the difference between floor and wall tiling.

Setting up a new material and applying a texture to a plane in the scene.

Problem of texture scaling and the need for automatic tiling.

Creating a Shader graph to handle automatic tiling based on object scale.

Explanation of Shader graph inputs and the need for a texture input.

Using the 'Object' node to get the scale of the object in the Shader graph.

Creating a tiling multiplier input to adjust the size of the texture tiles.

Connecting the texture sample to the base color in the Shader graph.

Adding emission to the Shader graph to make objects glow.

Using a separate Shader for floors and walls due to different tiling needs.

Creating a wall Shader that tiles based on the Y scale instead of X and Z.

Demonstration of how the Shader graph works on different objects like planes and cubes.

Addressing the limitations and potential improvements for the Shader graph.

Encouragement for viewers to try Shader graph with a simple project for better understanding.

Invitation for viewers to support the channel through Patreon and Discord.

Transcripts

play00:01

hey welcome back to the channel just

play00:02

want to give a big shout out to all of

play00:04

my recent patreons patrons thanks for

play00:07

joining the patreon page that really

play00:08

makes me feel like you'll appreciate

play00:10

these videos and it motivates me to keep

play00:11

making more the what I'm doing today

play00:13

I've been putting off for a while and

play00:15

that's a Shader graph I guess tutorial

play00:18

but I'm not really going to be breaking

play00:19

down Shader graph because I've seen a

play00:21

lot of Shader graph tutorials and it can

play00:23

become overwhelming at first so what I

play00:25

want to do is show you a Shader graph

play00:28

that I feel like everyone should know

play00:30

how to make it's a great way for you to

play00:32

get started with Shader graph um it's

play00:34

also something that I feel like should

play00:35

just be a built-in Unity Shader anyways

play00:38

so let's jump into it so I'm going to be

play00:40

using a a built-in render pipeline

play00:43

project which um if you're like me you

play00:45

might have thought you can't use Shader

play00:47

graph with built-in pipeline but you

play00:49

can't um just go into the package

play00:50

manager and search Shader graph and you

play00:53

can indeed install it so apparently I

play00:55

already have it in here this is a

play00:57

built-in render pipeline isn't it oh oh

play01:00

yes it is I forgot that I was using this

play01:02

to test uh a frame rate issue I was

play01:04

having on a project that I was also

play01:05

using Shader graph so yes Shader graph

play01:06

is installed on this all right so

play01:09

uh let's go ahead and get started so how

play01:12

do we make a new Shader graph well first

play01:15

let's talk about what our goal is going

play01:16

to be so if we open up scene view here

play01:19

because I don't really care about game

play01:20

view so in scene view let's say I create

play01:23

a uh uh plane all right let's say this

play01:27

is going to be my floor and let's just

play01:29

go ahead and reset its position rotation

play01:32

okay so this is my floor and let's say

play01:34

that I want to put a texture on it which

play01:36

I guess I need one oh good I have one um

play01:39

so we have a nice tiled texture here

play01:41

it's a little hex floor texture and

play01:44

let's just go ahead and create a new

play01:45

material for

play01:47

it uh let's see create material heex

play01:51

floor non

play01:53

tiling and um my hex floor texture is

play01:57

now gone let's just come in here and I'm

play01:59

going to I'm going to search my hex

play02:00

floor

play02:01

texture and let's just grab this on

play02:04

there okay so we have this floor right

play02:07

but if I resize this floor um floor um

play02:11

it just scales the texture and it looks

play02:13

really gross this is one of those things

play02:14

I feel like Unity should just have like

play02:17

built in to where you could just it

play02:19

should be part of the standard Shader I

play02:21

just feel like

play02:23

because if you have a texture on your

play02:27

shape you probably want it to tile if

play02:28

you scale it and then you can do it

play02:30

manually so if I like take this floor

play02:31

and I scale it 10 by 10 I can then come

play02:35

to the

play02:37

material and change my tiling to 10 by1

play02:40

and I get the same um pattern and it

play02:43

scales over the thing but doing that for

play02:46

like let's say I have multiple floors or

play02:48

I have multiple walls that are separate

play02:50

objects but they might be sharing the

play02:52

same material I don't have to go create

play02:54

a new material for each object because

play02:56

that's what you would have to do to

play02:58

manually set the tiling I also don't

play03:00

want to have to do it at runtime with a

play03:02

script I would like to just my material

play03:04

to handle it with a Shader so let's do

play03:07

that so let's create a Shader graph and

play03:12

we're using the built-in render pipeline

play03:14

that's where I was getting stuck before

play03:15

whenever I was first trying this is I

play03:16

was going to Shader graph and I was just

play03:17

doing blank Shader graph but that's like

play03:19

assuming urp but since we're not I'm not

play03:22

using urp I'm doing built-in which

play03:24

showing you these steps if you're using

play03:25

urp they're going to be close enough you

play03:27

can still do it and I'm going to make

play03:29

this uh let's make it a lit Shader graph

play03:31

why not and there it is and I'm going to

play03:34

call this floor tiling one thing worth

play03:36

noting the Shader I'm going to show you

play03:38

and I'll probably show you both ways is

play03:40

there'll be I'll use a separate Shader

play03:42

for floors then I will for walls because

play03:46

um the scale that you're going to be

play03:47

looking at for it to tile on is going to

play03:49

be different so for floors it's going to

play03:51

be x and z for walls it's probably going

play03:53

to be X and Y and we'll take a look here

play03:56

so here we have the floor tiling Shader

play03:58

I can go ahead and come over over here

play03:59

to this floor and I can go to Shader

play04:02

Shader graphs and we get my floor tiling

play04:06

Shader you see nothing's happening

play04:08

because we haven't told us to do

play04:09

anything yet so if I go to the floor

play04:11

tiling and I open up the Shader error

play04:14

editor it likes to put it in this little

play04:16

tab up here let's just go ahead and

play04:18

maximize it so my friends who are coming

play04:20

from visual scripting like playmaker um

play04:23

one thing that might throw you for a

play04:24

loop with this is you're like well where

play04:26

do I start where's the beginning of my

play04:29

node logic and there isn't really um

play04:32

like if I just create a

play04:34

node and I don't know let's just I'm

play04:37

just going to pick something random okay

play04:38

so this is a node and I can connect it

play04:41

to anything so I can just drag it drop

play04:44

it off I don't know utility logic and I

play04:47

don't know I'm just putting in some

play04:48

random nodes here it just there is no

play04:51

start the only real finish is over here

play04:55

so this is what actually happens to your

play04:58

material this is what you're going to

play04:59

connect um I don't really ever do

play05:01

anything with vertex all we're going to

play05:03

be using for this is the fragment and

play05:05

we're just going to be connecting to

play05:07

base color um these steps that we're

play05:10

doing maybe we'll if we have time we'll

play05:11

take a look at a mission to but um

play05:14

basically we'll be doing the same nodes

play05:16

to connect emission to have the emission

play05:18

tile as well all right but first things

play05:21

first what do we need to make this work

play05:24

so we need some inputs so one thing that

play05:26

we're going to need is we're going to

play05:27

need a texture so texture 2D and I'm

play05:30

just going to leave it called texture 2D

play05:32

and if I save the asset and I un

play05:34

maximize and we come over to the

play05:37

floor let's look at it in scene view too

play05:40

and you know what just for fun let's

play05:41

take our main camera and let's go to

play05:43

game object align with view so we can

play05:45

see it down here too all right so if we

play05:46

look at our floor it now wants a texture

play05:49

so now we can come here and I can search

play05:52

my texture there is my texture we got

play05:55

one of our inputs huzzah so let's now go

play05:58

back into the Shader and I'm going to

play06:00

maximize this for easy editing and um

play06:03

what are we going to need well we're

play06:04

going to need to know the scale of the

play06:08

object so I'm going to right click and

play06:10

I'm going to create a node and can I

play06:12

just search scale how do I normally do

play06:15

this um seriously how do I normally do

play06:19

this uh maybe it's not scale give me a

play06:22

second so I did search scale and I think

play06:24

what we want is my mouse quit working um

play06:27

we do want this object um so we're going

play06:30

to grab object there we go my mouse is

play06:31

working again so we're going to grab

play06:32

object and if I can zoom in there we go

play06:35

so it gives us our position and our

play06:37

scale on this object node so we want the

play06:40

scale and we're just going to drag this

play06:41

off and we're going to um split

play06:46

this all right and so what this is now

play06:49

is it's getting an input three it's

play06:52

getting an input with a vector three I'm

play06:55

not sure why it's outputting uh a four

play06:58

for Alpha because I'm not sure where

play07:00

it's going to get that fourth Channel um

play07:02

but we're getting the RGB is also going

play07:05

to be

play07:06

XYZ all right so that's what split is

play07:08

going to do so now we're going to do um

play07:11

basically calculate our tiling from this

play07:14

so let's just go ahead and rightclick

play07:16

create node we're going to go to UV and

play07:18

we're going to go to tiling and

play07:20

offset all right so here we have our

play07:22

tiling and offset we need to have our

play07:24

tiling value so um what we could

play07:27

probably do here is create a vector

play07:32

2 um and yeah this would be a float so

play07:36

Vector 2 float and so we can take our

play07:38

this is the floor and I'm going to gohe

play07:41

and save this just to make sure I'm not

play07:42

losing my mind I'm going to look at the

play07:44

floor and the scale is on the X and the

play07:46

Z so let's maximize this and so we're

play07:50

take the X which is the first value here

play07:52

and the Z which is the third value here

play07:55

and this should now be our XZ scale

play07:57

which we can then bring into do the

play07:59

tiling here so now that we have our

play08:03

tiling in

play08:05

offset um now what do I

play08:08

do oh we we need to use our texture I

play08:11

think I can just grab this texture and

play08:12

like drag it and drop it there boom and

play08:15

so this should now

play08:16

be our UVS right no what what does this

play08:21

give me what does this give me this

play08:23

gives me I can come out to a UV

play08:28

here what do I have to do here can I go

play08:31

out to

play08:33

here all right so we actually need here

play08:35

is we need a sample texture 2D which did

play08:38

it give me the option from that if I

play08:40

went out

play08:42

here do I get sample texture suggested I

play08:45

don't think I do there we go yeah we do

play08:47

okay sample texture 2D all right double

play08:50

click on that all right so there we have

play08:54

our sample texture 2D which I think

play08:56

means we can then take our tiling in

play08:58

there

play09:01

and now we have our RGB and we can just

play09:04

drag that into the base

play09:07

color and um I think that's done let's

play09:11

let's see if that

play09:13

works um it did there you go all right

play09:17

so um now we are tiling with our texture

play09:21

and so now if I take my floor and I

play09:23

resize it you can

play09:27

see that it goes right along with it but

play09:31

maybe we don't like that maybe we want

play09:34

our hexes to be bigger or smaller so if

play09:38

I come back over here and on my floor

play09:41

time these are inputs that we can adjust

play09:43

in the inspector so I want to have a

play09:46

float and I'm going to call this uh

play09:49

tiling

play09:52

multiplier and let's drag that in

play09:55

somewhere um where do I want to put it

play09:58

at

play09:59

let's just drag it in here on tying

play10:01

multiplier and so this is our multiplier

play10:04

and so now we actually need to multiply

play10:06

something so I'm going to search

play10:07

multiply all right so there's multiply

play10:09

right there and so one value that we're

play10:12

going to multiply is uh this and the

play10:18

next thing that we're going to multiply

play10:21

is this Vector two I don't think that's

play10:23

going to

play10:24

work oh it can all right great Vector

play10:26

two can work all right so then we're

play10:28

going to take that and let's see if we

play10:30

now take this and drag it into tiling if

play10:34

that broke everything or if it's working

play10:37

so if we come back out we go to our

play10:39

scene right now it's gray but let's go

play10:41

look at our Shader we have a zero tiling

play10:44

multiplier if I set it to one there we

play10:46

go we have that or I can just keep

play10:48

scaling it up and I can make them tiny

play10:51

or I can do

play10:52

like25 and now I have giant tiles and I

play10:56

can scale them how I want but what if we

play10:59

also want this thing to glow like what

play11:02

if we want to do it to a missive um not

play11:05

really any different I'm going to set

play11:06

that back to one so we can come like

play11:09

this and we can add um another texture

play11:14

2D and we can call this emissive

play11:19

texture and we are essentially just

play11:22

going to copy this same thing so if we

play11:25

go basically just take all of this and

play11:29

we go copy

play11:32

paste and all we have to do now is take

play11:37

our texture 2D and remove that and we

play11:40

grab our missive texture 2D and we drag

play11:43

that into texture and then we take our

play11:46

rgba and we drop it into a mission there

play11:50

if we save hopefully oh you know what we

play11:53

need one more thing we also need a

play11:57

color which which we could do a color

play12:00

for both of

play12:02

them uh so we can go we're need two

play12:05

colors so we can do uh base color and

play12:10

you can really name these whatever you

play12:11

want and then we can do um emissive

play12:16

color and I think we multiply the color

play12:22

values sorry I forgot where we left off

play12:24

um I had to step away CU my kids were

play12:26

getting into things they shouldn't have

play12:27

um one thing we can do I think here is

play12:29

we can get rid of some of this math so

play12:32

if I take all of

play12:35

that and I delete that and then we

play12:39

take these and put them like here right

play12:43

we can then take the

play12:46

tiling and boom because they're sharing

play12:49

the same math so there's no reason for

play12:50

us to have that stuff there

play12:53

twice but now to deal with color so

play12:57

color is really not overly difficult

play13:00

once we have our texture we are going to

play13:06

um put in uh we're just going to

play13:09

multiply our color values and one thing

play13:10

I thought about that might be easier for

play13:12

you to visualize What's Happening Here

play13:15

is if we go to our texture 2D we can go

play13:17

ahead and put a default texture in here

play13:19

and let's just pick the one that we're

play13:20

working with and when we do that we

play13:24

should be able to

play13:26

see yes use tying and op set why

play13:29

wouldn't we use tying no I don't think I

play13:30

have to do that all right so we should

play13:32

be able to see the texture in here but

play13:36

for some reason we can't that's a bit

play13:40

weird um yeah I'm not sure why it's not

play13:43

showing it for us in the preview but you

play13:44

know what

play13:45

whatever um that's so weird did I break

play13:49

something let's maximize back out I did

play13:51

break something what did I

play13:53

break so the issue is there's not a

play13:55

default emissive texture so if we come

play13:57

over here where are we using that app by

play13:59

the way okay good we have theive texture

play14:01

there but we just need to probably pick

play14:03

a default missive texture which we're

play14:06

just going to do the same thing the

play14:08

hex and

play14:10

now now you should be like you should be

play14:14

you should be telling me what's going on

play14:15

here what's going on here I'm also going

play14:17

to go ahead and add it over here there's

play14:20

the hex floor okay so we're seeing it

play14:22

here doesn't really make sense why I'm

play14:25

not seeing it in the Shader graph I was

play14:27

going to say the scene but worried about

play14:29

it right now oh because we don't have

play14:31

default uh probably a default tiling

play14:34

multiplier so let's go ahead and set

play14:35

that to one hey there we go all right

play14:39

that did something so it's still not

play14:41

showing here oh yeah it's showing here

play14:43

too all right great so now we can

play14:45

actually see what we're doing um we need

play14:50

to uh do our colors so if we take this

play14:56

and we move this over here we have our

play14:58

textures now all we do is let's drag in

play15:01

our base

play15:03

color and then we're going to um right

play15:06

click add a node

play15:09

multiply and if we bring this in here

play15:12

double click and I'm sorry probably

play15:14

can't see this very well because that's

play15:15

the hard thing about Shader graph

play15:17

tutorials is to see everything that's

play15:19

going on you really got to zoom out but

play15:21

we're going to take our base

play15:24

color and then we're going to notice how

play15:27

it also updated it was a vector two and

play15:29

now it's doing a vector 4 so now we can

play15:32

take uh the sample texture and we can

play15:34

drop it in here and then we can take our

play15:36

output and go into our base

play15:39

color um and so our base color is black

play15:43

just for fun let's change the default of

play15:45

that to White and now we can see our

play15:48

tiling again and so if we come down here

play15:51

and essentially um I don't really need

play15:53

to copy it I'm just going to create the

play15:55

multiply node

play15:57

again and I'm going to take my emissive

play16:01

color and we're going to take the

play16:03

emissive color drop it into the first

play16:05

port and then get our rgba drop it in a

play16:07

second and then take our output into a

play16:11

mission and then if we click on our

play16:14

emissive color and set that to

play16:17

White we can see our texture

play16:21

again but one more thing we might want

play16:24

to do and that's to give our emission

play16:29

sub

play16:30

intensity because maybe we want our

play16:32

emission to be really bright so we need

play16:33

another float and we're going to call

play16:35

this

play16:36

emission SP let's just call it emissive

play16:40

intensity and let's just go ahead and

play16:42

give it default value of

play16:44

one and we can do one more

play16:50

multiply and we're going to take our

play16:53

emissive

play16:54

intensity and we're going to multiply it

play16:56

by what we have going on here and then

play16:58

we just output put it back into a

play17:01

mission and I think we should be pretty

play17:03

much done with hit controls to try to

play17:06

save that um with that so if we go to

play17:09

the scene now it's black but that's

play17:12

because we haven't set any colors yet

play17:15

now when you have an emissive texture

play17:17

like if I come in here and I choose my

play17:19

base color as I don't know yellow okay

play17:22

good we can see it but what is it going

play17:24

to look like if I set my emissive color

play17:27

to like blue

play17:29

all right it's like you kind of lose

play17:30

some of the yellows but it's still

play17:32

something you might want and we can pull

play17:34

up our emissive intensity and me once

play17:35

you get to a certain value like your

play17:37

base color just doesn't even really

play17:39

matter um but there you go we now have a

play17:42

floor

play17:44

Shader that tiles whenever we scale it

play17:47

and we can also change our tiling

play17:51

multiplier however we want so I guess we

play17:54

can go ahead and do wall tiling you I'm

play17:58

going to save this uh scenes and we're

play18:01

just going to call this uh tiling

play18:05

tutorial so let's create a wall then um

play18:09

now here's the thing with walls walls

play18:12

usually have thickness to them so you're

play18:15

generally not going to this isn't going

play18:19

to be perfect now as long as you don't

play18:20

see like as long you're only seeing the

play18:23

face of the wall it's going to look fine

play18:24

if you're seeing the edges of the walls

play18:26

it might look a little weird um why

play18:28

can't we use the Shader that we already

play18:29

have Okay so let's say we take this

play18:31

plane and we call this wall and we

play18:35

rotate it 90 degrees on the X all right

play18:39

what if we do minus

play18:40

90

play18:42

okay well you know what I was not

play18:44

expecting that to work but it does seem

play18:46

to work for a

play18:49

plane wonderful well there you go all

play18:52

done for using a plane um now you can't

play18:55

see the backside you can give that

play18:58

option so if we go into floor

play19:02

tiling we maximize it and let's add um a

play19:06

bu for show

play19:14

backface and so can I do that in

play19:20

here I don't think we can yeah we can't

play19:23

do it with a bull bu maybe there's a way

play19:26

if you know if there's a way to do it

play19:27

with a bu to be a to change this Shader

play19:30

type to um because if we just set it for

play19:33

both I wish I had the option to do it in

play19:35

the graph but it doesn't look like I do

play19:36

I'm gonna go and delete that um but if

play19:39

we come back now we come into scene you

play19:42

can see it renders on both sides

play19:44

now and I mean of course it's going to

play19:46

do it for the floor too um there's going

play19:48

to be a bit more processing expense for

play19:50

that so just keep that in mind um I'm

play19:52

just going to go back and I'm going to

play19:54

turn it off for now because that's not

play19:56

really the purpose of this but where

play19:59

where was it here front

play20:01

save all right but what would happen if

play20:04

we um didn't use a plane but instead we

play20:07

had a cube for a wall so let's do 3D

play20:10

object Cube and um right now it's facing

play20:15

that way and let's just go ahead and

play20:19

keep it facing that way for

play20:21

now and I'm going to hit V so I can grab

play20:24

the corner vertex you might not see what

play20:25

I'm doing here but if you hold V on the

play20:27

keyboard you can grab verts and you can

play20:29

snap them to other verts so I'm just

play20:31

gonna hold control V and I'm just gonna

play20:33

snap that bottom corner

play20:35

there and one thing that is really poor

play20:37

in unity is being able to resize with

play20:40

the wct tool because sometimes you just

play20:42

can't get it facing the direction you

play20:44

want but right now it's doing okay and

play20:47

it's getting me the direction that I

play20:48

want to go I wish there was a way to

play20:50

snap when changing the rec transform but

play20:53

there's not you kind of have to eyeball

play20:54

it so if you know a way to snap the rec

play20:56

transform let me know but as far as I

play20:59

know there's no way to snap when using

play21:00

the rec transform and let's just make

play21:02

our wall come on seriously

play21:05

undo undo let's make our wall look like

play21:08

that um but maybe I don't want my wall

play21:10

as thick so here's an example of not

play21:12

being able to now I'm looking at it from

play21:14

this side and I can't adjust it still

play21:16

wants me to go up and down I can't

play21:18

adjust it sideways what happens if I

play21:20

change it to ISO

play21:23

though hey ISO is the solution all right

play21:27

which I thought about that when I was

play21:28

messing with that in my last project

play21:30

okay all right so let's say that's our

play21:31

wall

play21:33

thickness and um now if we just want to

play21:36

take

play21:37

the where's our floor's material

play21:40

at oh we we already we kept it non-

play21:43

tiling oh well it's tying now let's re

play21:46

let rename this to

play21:50

tiling if we drop in on the wall you can

play21:52

see it's

play21:54

instantly crazy now the top face it

play21:57

looks fine because that's the the top

play21:58

face um but if I take the cube and let's

play22:02

just use our free rotate tool here and

play22:04

if I rotate

play22:06

it oh it's fine huh what Shader was I

play22:09

using that it was weird like that but

play22:11

it's it's

play22:13

always the way this one's working is

play22:15

it's looking at the X and Z scale so it

play22:18

does not care about this y scale so

play22:20

we're going to take this floor tiling

play22:23

Shader and we're going to duplicate this

play22:25

and we're just going to call it wall

play22:27

tiling

play22:29

you might think oh no there's another 15

play22:31

minutes left in this tutorial but not

play22:32

shouldn't be um now we can just come

play22:35

like this and if we go to where we're

play22:38

splitting our scales instead of

play22:40

connecting Z we're going to click on

play22:43

that line click delete and we're going

play22:46

to take the G which is also the Y and we

play22:49

should be able to connect it we should

play22:51

be able to save it get out let's go look

play22:54

at our wall and now it's still jacked up

play22:57

oh because cuz we didn't change our

play22:59

Shader so now let's go to Shader grabs

play23:03

wall

play23:04

tiling and there you can

play23:07

see oh but I didn't make a new

play23:10

material okay

play23:12

undo uh let's call this hex wall

play23:17

tiling let's put it on the

play23:20

wall now let's go oh let's name this

play23:23

wall now let's pick the right Shader

play23:26

Shader graphs

play23:29

wall tiling and now you can see we have

play23:32

a nice tile on the wall face there but

play23:34

you can see the sides are a bit the top

play23:38

and this edge here is a bit jacked up

play23:39

but the other side's fine so um that's

play23:43

where as long as you're hiding those

play23:44

walls it's not going to be that big a

play23:46

deal because I can now duplicate this

play23:48

wall and I can rotate it 90 Dees on the

play23:52

Y and if I hold get this tool hold down

play23:55

V grab that corner and it press that's

play23:58

not really where I want it but that'll

play23:59

be fine and um yeah so you can see it

play24:03

looks fine um and if you have a ceiling

play24:06

you're not going to see that top part

play24:08

and I can still grab this and really I

play24:11

can go and I kind of want to be able to

play24:13

see the hex a little bit better so let's

play24:15

change our tiling multiplier to uh 0.

play24:18

five and if I grab my wall this should

play24:21

be tiling now to see and if I tile it

play24:24

taller it's taller too all right so it's

play24:26

not perfect there could be more done um

play24:29

to handle these edges but most of the

play24:31

time you know especially if you're like

play24:33

prototyping you're not even going to be

play24:35

carrying that much and this is help

play24:37

really helpful for prototyping but you

play24:38

might make more complex shaders down the

play24:40

road hope this was helpful for you um

play24:42

you might have been afraid of getting a

play24:43

Shader grass before hopefully this shows

play24:45

you that um you can at least get your

play24:47

foot in the door um not doing the most

play24:49

complex thing yet but at least something

play24:51

at the bare minimum is probably going to

play24:53

save you a lot of hassle um just dayto

play24:55

day cuz just not having to mess with the

play24:57

those the the tiling on the materials

play25:00

will help a ton maybe in the future if

play25:02

this gets a lot of likes and youall

play25:04

comment down below that you want me to

play25:05

do it um maybe I'll take a look at how

play25:08

you can take a look at

play25:11

um the

play25:14

height of the because I've seen a lot of

play25:18

tutorials in 2D where they can draw a

play25:21

shape and based on the height of the

play25:23

shape it like automatically applies

play25:25

different textures and blends them I'll

play25:27

look might look into that and try to

play25:29

learn more about shaders but thanks for

play25:31

watching don't forget to like comment

play25:33

subscribe we're on our way to 2,000

play25:34

subscribers that'd be really sweet if we

play25:36

could do that before the end of the year

play25:37

um if you want to support the channel

play25:38

check out links in the description for

play25:40

my patreon page my itch and if you do

play25:43

join patreon make sure you link up your

play25:44

Discord I have a special Discord Channel

play25:46

just for patrons and uh you get the

play25:48

benefit of one-on-one help from me if

play25:50

you like it and uh that's it we'll see

play25:52

you next time

Rate This

5.0 / 5 (0 votes)

Related Tags
Unity ShaderShader GraphTiling TextureBeginner TutorialGame Development3D ModelingMaterial ShaderUV MappingEmissive TextureUnity Tutorial