The Switch Node | 5-Minute Materials [UE5]

  Рет қаралды 13,641

PrismaticaDev

PrismaticaDev

Күн бұрын

Hello! Today we're looking at a material node that flew under the radar, The Switch Node! This is a very handy tool for atlassing materials cheapy and tidily in order to reduce draw calls and optimize Unreal Engine. It can also be used to switch (hence the name) between multiple effects or textures at runtime without the need to Flipbook.
----------------------------
Patreon: / prismaticadev
Twitch: / prismaticadev
Discord: / discord
KZbin: / prismaticadev
Twitter: / prismaticadev
----------------------------
Computer Specs:
Ryzen 3900x 12-core CPU
MSI Geforce RTX 2080 Super
64GB Corsair RAM
One of those fancy nvme m.2 SSD's
Programs of choice:
Unreal Engine - (Game Dev)
Blender - (Animation and Modelling)
OBS - (Video/screen capture)
Davinci Resolve - (Video editing)
Adobe Photoshop - (Graphics and Texturing)
ProTools 11 - (Compositions and mixing)
OldSchool Runescape - (The best game)
Filmed using:
Sony A7s2 body
Sony 24-70mm f/2.8 GM lens
Yonguo YN360 LED's for colour
Yongnuo YN760 chip LED w/ Godox softbox for key
My lovely cats names are Boycat, Girlcat and Ladycat :)

Пікірлер: 61
@b5a5m5
@b5a5m5 7 ай бұрын
A beard has appeared on your face as a physical manifestation of your game dev wisdom.
@LoganPinney
@LoganPinney 7 ай бұрын
Fantastic overview of the switch node!! Thanks for the detailed showcase on using it.
@btmhustles2265
@btmhustles2265 7 ай бұрын
To be honest in the beggining I just had no clue how to follow your tutorials.. but now I no my way around Unreal your videos are great... Its strange using Unreal is like learning to read..
@jonludwig1632
@jonludwig1632 7 ай бұрын
I once built something that did effectively this for 8 "shades" of 32 "colors", 256 colors total. I thought then that nope, here's where I hit the limit and just use a texture sample instead, as it was some 800 instructions for the whole thing. I am very excited to rebuild that with a few of these bad boys and see what the cost diff is. Thanks for the video!
@TheTELproductions
@TheTELproductions 7 ай бұрын
8:03 This is the classic lol, it happens every time, great video definitely stealing a couple things from this
@DeltaNovum
@DeltaNovum 7 ай бұрын
Oh my science. This has so many possibilities! And opens a lot of creative opportunities.
@blackdevilcreations
@blackdevilcreations 7 ай бұрын
I literally wanted to start working with your old video tomorrow.. To create such a batch function... And now that.. Nice to know that 😂
@PrismaticaDev
@PrismaticaDev 7 ай бұрын
I should add this to the description of that video!
@Fabio-zc7bs
@Fabio-zc7bs 7 ай бұрын
Just adding to what you said. Static switch parameter can actually be used dynamically in UE5. There is an option on the node that is called dynamic branching that allows it to be branched in realtime. I'm using it to change from different material outlines on the character (When they are friendly, aggressive, neutral etc.). Don't know that much about performance information since I didn't see anyone talking about this (not even in the documentation, tbh).
@Chris-jo1zr
@Chris-jo1zr 7 ай бұрын
One would assume its like branches in Unity Shader Graph, it will compute both sides of the branch/static switch and then read the boolean value and apply the true or false branch.
@FireF1y644
@FireF1y644 7 ай бұрын
​@@Chris-jo1zrNo, I think this is a real [branch] if. There have been conversations about this since at least 2015, and it appeared in 5.2. I haven't tested performance yet. So I can't say for sure. For [flatten] if, we already have the If node
@PrismaticaDev
@PrismaticaDev 7 ай бұрын
Sounds really intriguing! I’ll have to have a doodle with it in my next session. I’d assume that it compiles both versions of the shader and switches between them, or it’s computing both sides and showing the selected one. I’ll do a few tests and report back with my findings!
@brandonjacksoon
@brandonjacksoon 7 ай бұрын
Thanks mate!
@DanteReaver
@DanteReaver 7 ай бұрын
This is going to make VFX so much easier to do.
@ScorpyX
@ScorpyX 7 ай бұрын
wait, your right! different textures and stuff in 1 material instead of many daaaamn...
@FootPrint.Studio
@FootPrint.Studio 7 ай бұрын
For some reason your hair plus slightly longer beard makes me think "viking vampire..." Great video, I've accidently grabbed this node a few times when trying to get the static switch, never bothered to find out what it does.
@Procedural_Minds
@Procedural_Minds 7 ай бұрын
One of the limitations I found with the Switch Node is you can't use it with something really advanced like a Make Material Node to use with Material Attributes unfortunately. That's something I would really like to create some really advanced setups. And maybe Unreal will one day get an enum parameter in the material section.
@soulshard7229
@soulshard7229 7 ай бұрын
Or just let us do some degree of HLSL coding which is not the "custom" node.
@PrismaticaDev
@PrismaticaDev 7 ай бұрын
That would be quite handy indeed
@billmore6486
@billmore6486 7 ай бұрын
If you talking about cartoon texture faces like Megamand Legends, they have all facial expression textures combined in one image. Less texture samples for materials, less heavy shader. Unless I was confused on your explanation. Also thankyou for another video! The material world of unreal gets demystified when you talk abotu it!
@PrismaticaDev
@PrismaticaDev 7 ай бұрын
Yeah some projects use texture atlases/flip books, but it means your overall texture size can get really big (8k+) depending on the resolution of the faces. It was a bit of a bad example but I think it explains the function well enough haha
@mb.3d671
@mb.3d671 7 ай бұрын
Well well look who it is…thanks!
@keithbandles4137
@keithbandles4137 7 ай бұрын
Thank you for this video. Can you please do a tutorial on optimizing materials eg draw calls and instructions and how best to optimize materials in situations we run into day to day. I really appreciate any help you can provide.
@cameroncowen5011
@cameroncowen5011 7 ай бұрын
Will we get another devlog of the game soon? Loved those videos so much
@PrismaticaDev
@PrismaticaDev 7 ай бұрын
SoonTM
@timryan4510
@timryan4510 7 ай бұрын
I used something like this for team colors on uniforms.
@now_ever
@now_ever 5 ай бұрын
Oh, this shaders' complexity debugging looks like great topic for a video. At least, I definitely find it useful, if I'll need to check what logic in my materials performs better
@PrismaticaDev
@PrismaticaDev 5 ай бұрын
Haha I don't like to rely on Instruction count alone (which is what the Shader Complexity viewmode uses) so I decided to do some brute-force testing instead!
@now_ever
@now_ever 5 ай бұрын
@@PrismaticaDev i mean, yeah. So would be cool to see is one video how you testing your performance, if you have some other tips)
@iansmith3301
@iansmith3301 6 ай бұрын
Are you going to make any videos on the new Substrate material features with UE5? :)
@alexandredepail1154
@alexandredepail1154 7 ай бұрын
Thanks for the tip, really useful, as usual! I'm a bit sad that if we put a value like 1.5, it doesn't lerp the value of 1 and 2 to create an interpolated result. But hey, it's better than nothing
@PrismaticaDev
@PrismaticaDev 7 ай бұрын
Yeah, an X Lerp would be amazing. It’s pretty easy to set up a material function that does it but having variable inputs would make it so much cleaner
@estellairon9448
@estellairon9448 4 ай бұрын
If you're ok with using 2 switches, you could do: - make a "A" switch, say with your options 1 to 10, with a default for looping over ("0" or "11" value) - copy it as the "B" switch - make a scalar to go 1 through 10 - take Frac out of it, use as the Lerp node alpha - connect the switches to Lerp - from your scalar, make it +1 and attach to the "B" switch input I haven't tested, maybe it works?
@PrismaticaDev
@PrismaticaDev 4 ай бұрын
@@estellairon9448 that would work for sure!
@dmnyktv2739
@dmnyktv2739 6 ай бұрын
What if we connected multiple textures to the switch then used a scalar and custom primitive data the set the value so it changes dynamically? Or used custom data values as an input for the number ?
@Mireneye
@Mireneye 6 ай бұрын
I wonder how conceivable it is to make a tool with the Geometry Scripting, etc in Unreal, that will take a selected mesh or some list of meshes, and create a second UVmap and place the UVs of the mesh into it. Since a lot of projects deal with many meshes coming in from the marketplace, this sort of tool could come in real handy. Maybe I'll look into it. I never quite understood how the second UVs relate to the first UVs (I don't mean lightmap). EDIT: I guess the tricky part is the selection of an element by material ID, and then assigning that to a particular square, none overlapping.
@PrismaticaDev
@PrismaticaDev 6 ай бұрын
There are definitely tools in the engine that can remap UVs and stuff, and you could use the Material Slot (if using multiple mat slots) for the index etc
@UndiniTuts
@UndiniTuts Ай бұрын
This one definitely flew under the radar. Thanks for sharing!
@mendeleev_9H2PDsgXu7NmphCUEH
@mendeleev_9H2PDsgXu7NmphCUEH 7 ай бұрын
Finally, materials in UE5 have something like enumerators. Can't wait for them to add enheretance, incapsulation and polymorphism and cycles and variables to make this finally usable.
@PrismaticaDev
@PrismaticaDev 7 ай бұрын
We already have inheritance, sort of. You can make children of material instances which inherit the default params from the parent instance. You can use material functions for greater modularity as well
@kevinbittner5069
@kevinbittner5069 7 ай бұрын
Science adjacent
@finsi_moon
@finsi_moon 28 күн бұрын
I can’t figure out if it’s possible to recreate the master material using switch nodes. I don't understand how I can add a normal map to a color. It turns out that the node switch merges the “channels” of colors together and there is no way to add normal maps for each color. or am I missing something?
@PrismaticaDev
@PrismaticaDev 28 күн бұрын
You just need to have 2 separate switch nodes - one for the colour, one for the normal maps
@finsi_moon
@finsi_moon 28 күн бұрын
@@PrismaticaDev Thanks!! it looks like it worked, however I don't understand. Using texture coordinates 1 for normal maps, it should use small (changed) UV maps, but it looks as if it is using full scan for normals. I'm confused, but it seems to work
@alhusseinali
@alhusseinali 3 ай бұрын
How many texture samples I can use in switch node ? Cuz I think its limited to 5 texture samples. When I go above that number the engine shows me an err message.. something like sm5 c:\engine\private...
@PrismaticaDev
@PrismaticaDev 3 ай бұрын
If you're using lots of textures in 1 material, you'll need to set the Sampler type to "Shared: Wrap". It's best to use this setting anyway, as there is no downside. I think it's not the default purely for older rendering tech backwards compatibility
@alhusseinali
@alhusseinali 3 ай бұрын
@@PrismaticaDev But how to do that, I looked up for some tutorials bout "Shared: Wrap" but I didn't find any!.
@PrismaticaDev
@PrismaticaDev 3 ай бұрын
@@alhusseinali if you click on the texture sample node, it will be in the Details panel (usually bottom left of the screen)
@alhusseinali
@alhusseinali 2 ай бұрын
Thanks brother, it worked... u r the best 👌.
@PrismaticaDev
@PrismaticaDev 2 ай бұрын
@@alhusseinali Beauty!
@seapickels9087
@seapickels9087 7 ай бұрын
no way I caught this video 0 seconds after it was uploaded lmao
@turtledevstudio8206
@turtledevstudio8206 7 ай бұрын
No honey stop, you don’t need to go stay at your sisters for a while, Prismatica dropped another video
@Pokepark1
@Pokepark1 7 ай бұрын
Activate Windows Go to Settings to activate Windows
@PrismaticaDev
@PrismaticaDev 7 ай бұрын
Activate Windows Go to Settings to activate Windows
@EdmundDupont
@EdmundDupont 7 ай бұрын
Nintendo switch?
@PayxiGandia
@PayxiGandia 7 ай бұрын
Indeed
@nawhz6292
@nawhz6292 7 ай бұрын
im suprised switch went under your radar when its a beginner function.
@PrismaticaDev
@PrismaticaDev 7 ай бұрын
It was only added in one of the latest versions, hence why I'd made my own version previously haha
@nawhz6292
@nawhz6292 7 ай бұрын
@@PrismaticaDev I see. How strange! How were people doing state machines with the absence of switch?
@PrismaticaDev
@PrismaticaDev 7 ай бұрын
@@nawhz6292 this is in the shader graph, where we don’t use states (shaders are stateless and read-only usually)
@nawhz6292
@nawhz6292 7 ай бұрын
@@PrismaticaDev so much to learn with this program Thank you bro.
Essential Environment Art Trick - "WPO Stickers" [UE5]
21:47
PrismaticaDev
Рет қаралды 11 М.
Универ. 10 лет спустя - ВСЕ СЕРИИ ПОДРЯД
9:04:59
Комедии 2023
Рет қаралды 1,1 МЛН
ТАМАЕВ vs ВЕНГАЛБИ. Самая Быстрая BMW M5 vs CLS 63
1:15:39
Асхаб Тамаев
Рет қаралды 3,9 МЛН
Material Overlay - Everything You Need to Know -  [UE5]
21:21
PrismaticaDev
Рет қаралды 23 М.
Unreal Engine Materials in 6 Levels of Complexity
44:12
pwnisher
Рет қаралды 137 М.
Introducing EasySnow for Unreal Engine 5
19:34
William Faucher
Рет қаралды 98 М.
World Position | 5-Minute Materials [UE4]
8:04
PrismaticaDev
Рет қаралды 41 М.
D-Buffer Decals changed my life! [UE5]
24:12
PrismaticaDev
Рет қаралды 14 М.
Animating Materials in Unreal Engine 5
10:47
Lively Geek
Рет қаралды 42 М.
Sine and Cosine Nodes | 5-Minute Materials [UE4]
9:27
PrismaticaDev
Рет қаралды 35 М.
CCTV/Security Cameras - Unreal Engine 4 Tutorial
3:53
Matt Aspland
Рет қаралды 27 М.
Linear Interpolate | 5-Minute Materials [UE4]
8:26
PrismaticaDev
Рет қаралды 21 М.
Универ. 10 лет спустя - ВСЕ СЕРИИ ПОДРЯД
9:04:59
Комедии 2023
Рет қаралды 1,1 МЛН