Reducing Draw Calls in Unreal! [UE4/UE5/Blender] (Check Description!)

  Рет қаралды 65,762

PrismaticaDev

2 жыл бұрын

NOTE: check out my video on the new SWITCH node for a simpler atlassing function!
----
Today we're looking at my current system for creating complex, modular, detailed, multi-textured objects without incurring extra draw calls. This system is quite easy to use once you wrap your head around it, and is a great way to convert existing multi-material assets into a unified material setup! Your GPU will thank you, and your artists will as well.
You can also use this method to convert existing "texture atlas" assets to be able to use interchangeable textures.
---- Friendly reminder: Set ALL your texture samplers to "Shared: Wrap" ----
Resources:
Batch UV Operations: madllama.gumroad.com/l/Batch_UV_Operations_Blender
Material Atlas Function: blueprintue.com/blueprint/fn7z96yh/
------------------------------
Discord: discord.gg/HUacdHUaXq
KZbin: kzbin.info
Twitch: twitch.tv/prismaticadev
Patreon: patreon.com/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 4 - (Game Dev)
Blender 2.8 - (Animation and Modelling)
OBS - (Video/screen capture)
Davinci Resolve - (Video editing)
Adobe Photoshop - (Graphics and Texturing)
Quixel Mixer - (Texturing)
ProTools 11 - (Compositions and mixing)
OldSchool Runescape - (Chillax time)
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 :)

Пікірлер: 217
@Mireneye
@Mireneye 2 жыл бұрын
I do not understand how it doesn't quite matter where you put the islands to UV2 other than just.. somewhere on the section it needs to be in for the lookup. Care to elaborate more on that? In the same breath as I think of that, if a texture occupies 0-1 space on it's UV0, I doubly don't understand how that's going to map to the correct textures.. *confused*
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Hey hey! So as for the first question, the beginning section of our math will quantize the 0-1 space in to equal sections by using Floor, which rounds the value down to the nearest integer. We do this after multiplying it by the number of sections we want. So let's say we want 10 UV sections, for simplicity's sake. If our shrunken UV island has values like 0.24, 0.25 and 0.26, then we multiply it by 10 (now 2.4, 2.5 and 2.6) and then we Floor it. (Now all the values are 2) Then if we subtract 2, those values become 0 while all the other values around them are non-zero. We can Absolute them (turn the negatives in to positives) and the 0 values stay at 0. When we OneMinus the result, we get our beautiful bitmask! :) ---------- For the second part, imagine we have 2 groups of vertices. ABC and DEF. Both of these are mapped to a texture in UV0 as per normal and apper to be overlapping. ABC's UV2 values are in the "3" section of our grid, while DEF's UV2 values are in the "5" section of our grid. Texture 3 gets put through the "atlas function" to be masked on to triangles that are in the "3" section of our UV2 grid, and appears black on any other triangles. Texture 5 gets put through the "atlas function" to be masked on to triangles that are in the "5" section of our UV2 grid, and appears black on any other triangles. We can then sum the results for our desired outcome :)
@williamgodwin5582
@williamgodwin5582 Жыл бұрын
To call a sampler only once, people came up with a great invention - texture arrays. =))
@mashonoid
@mashonoid Жыл бұрын
@@williamgodwin5582 Texture array doesnt have mip maps
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
A fun little analogy that we talked about during the premiere: Let's replace "draw call" with "pizza call". You want to order 10 pizzas! Would you rather call and order 1 pizza, wait for it to arrive, call up again and order another pizza and repeat 10 times? Or would you rather order 10 pizzas and have them delivered together? They might take more time to cook and process individually this way but you cut out all the delivery time. This is basically the problem that the CPU runs in to when telling the GPU what to draw. How that helps explain what's going on behind the scenes! :)
@bobcharlotte8724
@bobcharlotte8724 2 жыл бұрын
made me hungry
@johnp3103
@johnp3103 Жыл бұрын
Great analogy! I love it!
@LukeAhearn
@LukeAhearn Жыл бұрын
Does this work for wings too?
@Matt-he7om
@Matt-he7om 2 жыл бұрын
I picked up some experience in blender for the past few months, so now I'm gonna move back to Unreal and start learning again. I think I'm going to watch EVERY video you made from start to last because your content is educational, entertaining, and just borderline awesome! Just want you to know you are a massive help and keep doing what your doing!
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Thanks so much my friend :) Best of luck on your journey! Glad to hear you're excited to get back to it
@ShoryYTP
@ShoryYTP 2 жыл бұрын
I love seeing smart techniques like these being used
@alienrenders
@alienrenders Жыл бұрын
If your UVs don't overlap, you can use a mask texture instead. A lot of things don't have that many materials, so red, green and blue gives you three meterial switches. You can combine them and/or use 128 (half intensity) to get more masks. Another method if you don't want to use another UV map is to use the same technique as UDIM. You move the original UVs by 1, 2, 3, etc. horizontally. Yes, they will be outside the 0-1 range, but that's fine. You can even move them vertically. In the material graph, you use frac on the UV's to get the original UV's back. The integer part is the UDIM tile and you can group texture lookup and whatnot by UDIM tile. The other stuff in the video still needs to be done like merging the materials into one.
@PrismaticaDev
@PrismaticaDev Жыл бұрын
A texture requires another texture sample/lookup, which is a lot more expensive than using some math to separate the sections. I guess the upside is that you can mask between materials on a per-pixel level. You could also use gradient-packing to get 12 masks for an RGBA texture (0, 0.5 and 1 per channel) As for using a UDIM-style method, it's definitely a banger! I do something like that for my characters which need non-overlapping UV's for their damage painting, and it doubles up as a mask.
@unrealengine5-storm713
@unrealengine5-storm713 2 жыл бұрын
You are an extremely talented solo Game Dev. You learn very quickly and acquire practical skills
@GekogaWishnya
@GekogaWishnya 2 жыл бұрын
That looks really cool. Thank you for sharing your experience with us.
@RogueTurkey
@RogueTurkey 2 жыл бұрын
Huge thanks for everything your doing. These tutorials are just the right amount of info to not be spoon feeding. You have really pushed me to rub my brain cells together, and I'm learning so much. Proud to say I got this functioning!
@erishiongames4608
@erishiongames4608 2 жыл бұрын
Thank you for making this overview Charlie. This helped bridge the gaps that I was missing from your character overview. Cheers!
@rashadfoux6927
@rashadfoux6927 Жыл бұрын
Dude. I didn't even come in to this video for Blender tips, and you had two tips in the first 17 minutes that are going to save me so much time and irritation. Thanks, and subscribed! You've got the spark of a great teacher.
@Abdullah_Ba_Amer
@Abdullah_Ba_Amer 2 жыл бұрын
I honestly learned a lot from this video and your "Unlimited Customization" dev log... My understanding of how to apply multiple materials in performant ways has significantly expanded! Keep up the good work, mate!
@0rdyin
@0rdyin 8 ай бұрын
If you don't mind please can you share the link to the dev blog that you mentioned.. cheers...
@Abdullah_Ba_Amer
@Abdullah_Ba_Amer 8 ай бұрын
@@0rdyin It was dev blog #11 and was about character customization: kzbin.info/www/bejne/d16zYZ-igsieidksi=am-0shksVqkSW-Ai
@xabunoxx2850
@xabunoxx2850 2 жыл бұрын
Brilliant! Thx for taking the time to make it. I had to watch it twice to really absorb it all 😅
@bitesizedtech8095
@bitesizedtech8095 2 жыл бұрын
This is DOOOOPE!!! Charlie you're Awesome!
@samohickey
@samohickey 2 жыл бұрын
This is great! I make all of my own assets, from skeletal meshes and animations to static meshes and what not. But I really wanted my game to have a stylized look with a color pallet that I've created... Do initially I had just a master material to hold my base color and such, with material instances from it for each color in my pallet... But that meant that each of my models had a material slot for each different color from the pallet they used. The draw calls were getting out of hand the larger my world became. So using this technique to simply organize my pallet and have it run on one material slot is going to save my entire project. Thank you!!!
@blackdevilcreations
@blackdevilcreations 10 ай бұрын
Downloaded that video and will definitely learn from that for my own Models. That's awesome!!❤
@muralist1
@muralist1 2 жыл бұрын
Thanks for this. I saw the other video last week and this clarifies it.
@bal_duin
@bal_duin 2 жыл бұрын
Thanks mate! Very helpful explanation
@TheLordDino
@TheLordDino 2 жыл бұрын
Thanks for sharing your knowledge
@Fokkusu
@Fokkusu 2 жыл бұрын
This is game-changing :o, thanks a lot! I will be testing this workflow soon :D
@Fokkusu
@Fokkusu 2 жыл бұрын
Update, I've been adapting lots of assets to this system and it works PERFECTLY in VR in Forward Shading, is such a game changing feature! It saved us like half the drawcalls in most cases, in some even more than half the drawcalls :D
@drekenproductions
@drekenproductions 2 жыл бұрын
yes i have been too lazy to look into draw call reduction perfect timing.
@wolflight25
@wolflight25 2 жыл бұрын
Thanks for sacrificing 3 hrs of your life to film this, because the amount of time you gifted me from being able to add this into my project is likely going to save months. Your a hero Charlie-boy, thanks as always for you well presented knowledge dump :) I was wondering though, when you started your project did the gameplay abilities system exist and do you use it? Would love to hear your thoughts on it, been tryna wrap my head round the whole thing the last two weeks in spare time, was wondering if you had any insights you might be sharing in the future on it at all.
@TheFrederickz
@TheFrederickz 2 жыл бұрын
Fantastic idea! This is going to help me a ton in one of my projects. :)
@JayCreationsDev
@JayCreationsDev 2 жыл бұрын
Sheesh charlie hitting the new year with some bangers
@grizzle2015
@grizzle2015 4 ай бұрын
i just learned so much watching this thank you so much!
@jamesfield8023
@jamesfield8023 2 жыл бұрын
Damn. Always miss the live streams as working. Thanks again chief.
@jamescleave7024
@jamescleave7024 2 жыл бұрын
It's blown my mind.
@MarioAndYoshi1409
@MarioAndYoshi1409 2 жыл бұрын
amazing tutorial again!
@Falconite
@Falconite Жыл бұрын
Your hair is glorious, man. Also thanks for all the amazing tutorials!
@Neverbomb
@Neverbomb 2 жыл бұрын
Thank you for the insight
@aurintalik
@aurintalik 2 жыл бұрын
Man I love this spooky material magic! It took me a bit to get it working with my materials, but man, once it does, it's so neato! I was a little confused by the texture coordinates - so if you're like me and using this with plugging in normal/occ/textures as well as colors - MAKE SURE YOU LEAVE THE TEXCOORD NODE AT 2 (if that's where your atlas is) otherwise you end up with a stripey mess. >.> Whew. Super cool stuff as always. :)
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Haha glad to hear you're digging it!!
@aurintalik
@aurintalik 2 жыл бұрын
@@PrismaticaDev Next I get to figure out if I can get some random color variation options (or get it to work with the custom data colors). I've got it partially but it's only applying to the first texture so I've got some exploring to do! :D
@bobn.1556
@bobn.1556 Жыл бұрын
I only took a glance of this video, but I must comment before I dive into this further. From at a glance, gives me an excellent idea in resolving my multi-purpose road texture. In the beginning, I was I trying to develop a way to differentiate between the number of lanes, passing lanes, no passing lanes, and so fourth. I thought I could separate the R-G-B-A channels for masks. However, I needed more than 4 channels, and I could not figure out how to implement that. I wish I could afford supporting your channel, but, if you do not mind, I will certainly spread the word about you and this video. Please let me know if that is okay. Excellent job Charlie!!!!!!!!😁
@PrismaticaDev
@PrismaticaDev Жыл бұрын
Haha that's the exact same problem I ran in to - Vertex Colour is sacred and should be saved for more important things. They're also a bit hard to manage if you want to re-order them etc. UV maps are much easier to edit! Thanks for the kind words :)
@tiaanadlem
@tiaanadlem 2 жыл бұрын
Great video, thanks
@HEAVY_AS_STONE
@HEAVY_AS_STONE 2 жыл бұрын
This is genius! I am using a similar method, nearly a half-step away from doing just this and I can't believe I never made this connection. Still learning shader stuff though, so my method is a little bit more bone-headed if you will haha. I also have a separate UV channel, but I fill faces/islands in with R, G, and B to create an RGB mask texture, then in Unreal that RGB mask takes in that separate UV channel as its texcoord, and then I use the RGB channels to lerp out each albedo (which is receiving the traditional UV channel). So unfortunately I only get 3 maximum textures/colors per material instance this way and I need another texture sampler for the RGB mask. I'm seriously considering shifting to this method! Thanks!
@3DWithLairdWT
@3DWithLairdWT 2 жыл бұрын
another excellent video
@knightofbrokenglass9237
@knightofbrokenglass9237 11 ай бұрын
Thank you!
@MustafaBerkeGureltol
@MustafaBerkeGureltol Жыл бұрын
Great video.
@SimonSlav-GameMakingJourney
@SimonSlav-GameMakingJourney 2 жыл бұрын
This is like an atlas material on steroids :D
@dotbmp
@dotbmp Жыл бұрын
engagement, via comments. Thanks though, found you on reddit and i'm learning so much.
@fodderfella
@fodderfella 2 жыл бұрын
nice functionality
@jiwik731
@jiwik731 Жыл бұрын
Damn... this is cool. Still working on my first little boring racing game and i don´t need this but if i will stick with games in the future i will come back for this. :D
@balthezur
@balthezur 2 жыл бұрын
Charlie has unlocked the first stages of Unreal Ultra Instinct, he's too powerful.
@devonroyer8044
@devonroyer8044 10 ай бұрын
39:45 lmao you got my like for the content. You got my subscribe right in this moment lmao
@kairu_b
@kairu_b 2 жыл бұрын
Awesome!
@riversandwine
@riversandwine 2 жыл бұрын
Maybe it would be good to collect some of the limitations of this technique in the comments. We tried using this on our foliage, but we use early-z on masked materials and unfortunately this is a bad combination with this setup. The foliage with default Unreal materials (8 different materials per tree) had almost if not more than twice the fps than the same foliage with this supermaterial applied. We made this observation both on PC and on Switch, but it really made the biggest difference when we tested on Switch. With the supermaterial the SceneDepthZ pass made up almost half of the whole rendering pass. It would be great to get to read some more experiences where this technique actually excelled over the default Unreal method, but also where it absolutely failed like for us. Thank you anyways for the inspiring video!
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
That's a very good find! I can see why it would affect the Early Z-pass negatively, since it would be testing against all textures at once
@riversandwine
@riversandwine 2 жыл бұрын
@@PrismaticaDev That's what we thought too, yes
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
@@riversandwine out of curiosity, are all of your texture samplers set to "shared: wrap or just left default?
@riversandwine
@riversandwine 2 жыл бұрын
@@PrismaticaDev "shared: wrap" due to the amount of texture samplers and because it doesn't seem to have any downsides.
@Develavid
@Develavid 6 ай бұрын
Kind of necroing the comment section here but I got an idea while watching your video... First of all: great work on those tutorials you make! I recently found your channel and I greatly enjoy your videos! An idea flew through my head for blending between the different materials... another approach would be to create material attributes for each submaterial and then to BlendMaterialAttributes them based on the material mask. I have seen you are using a whole bunch of multiply and add for all sorts of different textures (diffuse, normals, etc.), it may be easier to combine them into material attributes and just blend them in one after another (maybe doing some simplest black material to switch out when not using those, for optimization purposes).That way you can have each submaterial group up seperately in the material graph and just switching the results based on the mask.
@PrismaticaDev
@PrismaticaDev 6 ай бұрын
Yep yep! You could absolutely do that - the only reason I opt to do otherwise is since I only tend to use 1 texture per "layer" and the rest is weird colour logic. I'm not sure how MaterialAttributes blends handle empty entries (might be doing a lot of unnecessary operations even if you aren't using specular/roughness) but yeah, for big photo-real materials you sure could :)
@Develavid
@Develavid 6 ай бұрын
@@PrismaticaDev Thank you for your fast reply :D I have come to stress-test my approach finally last night... BlendMaterialAttributes seems to do take into account if the values are actually different from one another - like if you are blending between materials wich all have their specular channel set to 0, the instruction count goes down a bit... nonetheless the instruction count is ridiculously high for the blend. I have tried it with an If-node, that seems to work and gets the instruction count down a bit further. You can't Switch MaterialAttributes unfortunately though, it will implicitely cast the whole attributes to a single float vaule and blows it up into your face when you try to use it as input for the MaterialAttributes node. I have an other problem with this... using one texture for each material subslot seems to use a texture sampler each... When I get to the count of 16 material subslots, the material complains about having too many texture samplers. I looked into your video and you seem to have just 4 texture samplers active at once, despite having a texture for each subslot active... how did you do that?
@PrismaticaDev
@PrismaticaDev 6 ай бұрын
@@Develavid nice finds! Also, for the texture samplers thing - click the texture sample node and check the dropdown on the left hand side and set it to one of the "Shared" modes. It will combine them and allow for 128+ textures per material. It's a must-have for landscapes hahah. I don't know why it isn't the default option since it has 0 downsides, I think it's just for backward compatibility with REALLY old hardware/rendering
@Develavid
@Develavid 6 ай бұрын
@@PrismaticaDev oh MANY many thanks for this tip! You are fantastic!
@Develavid
@Develavid 6 ай бұрын
@@PrismaticaDev I have given this approach a bit more testing... and it seems that when using If-nodes it doesn't matter if the If applies before or after putting together the material. An If seems to just use one shader instruction either way and it's the same instruction count to do it on the texture as to do it on materials putted together with a SetMaterialAttributes node (the MakeMaterialAttributes node doesn't seem to work in ifs... I have no [swearword] clue why that is) So it might be even cheaper on an instruction count basis to create the materials seperately and If-ing them at last - maybe even doing some SetMaterialAttributes afterwards to make global things like rain, wind and such things. When you make the StaticSwitchParameter the way that you even don't calculate the if when the material is not used, it saves some juice aswell. I may be doing a pastebin in the near future if I can get myself to it so I can share the stuff - if you are interested, that is. EDIT: Nevermind, it seems it doesn't matter if you are doing two Ifs which hook to one material or two materials that hook to one If... The instruction count is the same. Apparently it is implicitely calculating the if for every material input and even optimizing itself against things that are hooked up the same way in different materials... so it may even not matter how you line it up.
@user-xo7lq2th7f
@user-xo7lq2th7f 10 ай бұрын
Hi Charlie, thanks for the awesome video! Do you think this would be possible with the use of vertex colours and z up too in a PBR workflow. Thinking of trying it on a project I'm currently doing :)
@mmertduman
@mmertduman Жыл бұрын
Great video! Can you tell me why you pass the atlas function output through Vertex Interpolator on your master material at 29:42, but you didn't need to do that with the example material you were building at 27:50? Follow-up: How expensive would it be to convert the default value of 0 to an input parameter that sets the default value for all other inputs? Follow-up-follow-up: Any reason why you put the switch statements before the multiplication and not after? As far as I can tell, putting it after the multiplication would simplify to ignoring the atlas operations for that material. Am I missing something?
@EthanFilms
@EthanFilms 2 жыл бұрын
Aw yeah, knowledge
@Krilium
@Krilium 2 жыл бұрын
Aw yeah
@AndrewWeirArt
@AndrewWeirArt 2 жыл бұрын
great tutorial! some really cool ideas here that i've had a look at myself in some experiments, great to see someone else using similar methods. however, have you explored the material layering system in unreal? it is almost what you have created here, i'd definitely check it out if you have not seen it. Judging by your performance, its not too important. but the user experience might be nicer :)
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Hey hey! I have looked at it indeed, and it should be implementable using this same UV-island method as the masking/blending method. The only reason I haven't used it myself is because my materials are quite simple in terms of texturing compared to other games and it seemed a bit overkill, and it's also hard to know how well it scales/its performance since it's a bit more under-the-hood
@peschken23
@peschken23 2 жыл бұрын
Using material layers, how would you map the relevant faces on to their respective material layer? Say i've got an asset that's a wooden chair with metal legs, how would I tell Unreal that the legs need to use the metal layer and the rest needs to use the wooden one? As I understand it the layer blending happens using a texture mask, but would that not come down to the same system as this video, still needing the seperate UV channel to put the UVs on the relevant part of the mask (say that we use 0(black) for metal and 1(white) for wood, putting those UV's on either black or white)?
@i-anc.262
@i-anc.262 2 жыл бұрын
Thanks for the tutorial! I'm a bit confused and wasn't able to follow too well going from master material to material function, but is there a way to use this to go around the 16 texture sampler cap (especially if more texture types are added like roughness, normal, etc)? That list of Material Color at 5:09 is particularly scary. Were these blueprints meant to eventually replace those v4 parameters by textures? Or were they meant to allow us to have some color variety (organized by type/UV clusters) blended into the diffuse map while keeping the same microdetail normals, roughness, metallic, etc? For instance, if I have a bunch of leaves, I use this to have different hues of green, but the leaves would have the same normals/cutout masks, etc? Thanks in advance!
@Ben501181
@Ben501181 Жыл бұрын
This is my question as well. By default you can only use 16 texture samples in a single material before hitting the limit on the sampler register index. So that would basically invalidate this entire process if you wanted to use full PBR materials for each of the slots. I've read that you can change the Material Expression's Sampler Source to "Shared: Wrap" or "Shared: Clamp" to get around that limit, but I'm unsure if that would be the correct way to address the issue. @PrismaticaDev It would be great to have some clarification on this.
@brokenhdd9291
@brokenhdd9291 2 жыл бұрын
This is awesome stuff! But you want to be careful about the quantity of switches. In Unreal 4, each side of a switch gets compiled into your shader cache as a different variant. So if you have many many many switches, the worse case being switches under switches, Unreal will bloat out a lot of variants. Depending on your platform limitations and your cook configuration it might be better to avoid the switch and use Multiply & Add to create the masking effect. Probably less relevant for Indies and NextGen consoles. But if you do something on mobile, memory limitations are a big deal.
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Yep, very good point there! Every material instance that has a different switch configuration gets recompiled as a completely different shader. I think finding the balance between having them be broad enough to encompass multiple objects, but also with as low complexity as possible is the key. For example, my “floors” instance had a couple of mostly redundant layers that only appear in 2 assets out of 20 etc
@cepryn8222
@cepryn8222 2 жыл бұрын
So cool, amazing job! One question though, im new to the channel and i havn't heard on which platforms are you planning to realase the game? Cause this level of optimalization looks like a bit too much for a regular pc? Or am I just unexperienced :D?
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Hey there! Just planning on PC currently, although using this method is a big time-saver as well when it comes to designing levels :) And the extra juice is always good to have for some cool effect later on
@cepryn8222
@cepryn8222 2 жыл бұрын
​@@PrismaticaDev Right! That seems logical, thanks! :)
@ezelominish3767
@ezelominish3767 2 жыл бұрын
Draw Calls = Demonic !
@coffeediction
@coffeediction Жыл бұрын
Great video as always man! A few questions tho: Isnt it the same as the layered material system? How does it differ and is this one more effecient? What if I want to add an AO+Curvature (Packed) Texture - Slot, so I can add dirt and edge damages on top of all that soup? Where would I have to add the slot for the packed texture? What would be enough is to have one slot each material instance. This slot is unique for THIS mesh only. Wall1 uses Mat_Wall1 and has WearTexture_Wall1 Wall2 uses Mat_Wall2 which is a copy of Mat_Wall1 but has WearTexture_Wall2. Obligatory: Obviously I cant have everytime 1 drawcall, with unique texture anyways not. And also I would need another UV channel, ofcourse, and bake down and pack all the stuff into one texture, unwrapping properly too just for AO and Curvature (which isnt that hard). So main issues here are, extra uv channel and adding the slot for the packed texture "mask" with ao+curv which uses extra 2 materials for dirt and edge damage. Because as I can see you arent using any ao dirt or edge damages so its pretty straight forward, but what if you would want to? ;D Ty Charlie
@CyberWolf755
@CyberWolf755 2 жыл бұрын
When making a ruined building model, do you use 1 normal map and the 16 channel for just color selection or is it some funky thing that I'm missing? How do you align the wood grain or the wall brick on the model?
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
For these assets, they use multiple different textures - some of them are simple tiling textures (like the brick wall pattern) and some of them are baked atlases/high-low bakes. All of the textures are aligned using UV index 0, and then swapping between the textures/colours is done in UV index 1
@lucadevi9678
@lucadevi9678 2 жыл бұрын
Great video! Do you advice using a master material for foliage too?
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Absolutely - I have a few master materials. Characters, Foliage, Props, Landscape and Trees all have logic that is very different to one another so they all have their own specific material setup.
@lucadevi9678
@lucadevi9678 2 жыл бұрын
@@PrismaticaDev Thank you very much, you are the best!
@FloodAnxiety
@FloodAnxiety 2 жыл бұрын
Great video. Have you used HLODs? Do HLODs do something similar and generate their own atlas material?
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Hey there! I haven't actually looked in to HLODs yet since Prismatica is a top-down game and we don't run in to many LOD issues yet haha. Definitely something I want to cover in the future
@BigMoneyGs
@BigMoneyGs 4 ай бұрын
4:55 aight imma head out
@PrismaticaDev
@PrismaticaDev 4 ай бұрын
KEKW
@DuneGames
@DuneGames Жыл бұрын
Thanks for this, yet I've a few questions. |I'm new to unreal. I've been doing tutorials on making a game, and am now getting ready to start my first demo. I've been downloading assets from the marketplace and had noticed that some (probably all) have many materials and knew from other videos that that meant multiple draw calls. So, tonight I come upon your video. In the beginning of your video it seemed you were going to delete all the materials and make it just one or two. If I understand it, you are creating a stack of paper (IE one per material - the atlas) in one master material, is that right? Though if there are more than 16, are you just chucking the extra? Or did you choose 16 because the asset pack used 16? Once done with this new atlas / master material, that is now just one draw call? Also, is the master material for just this asset pack, or can you use it across other asset packs? Though likely have to go through each pack and do the export to blender thing and back again. And would any of this benefit from C++?
@koo6108
@koo6108 11 ай бұрын
Nice
@diomiziofattorelli6609
@diomiziofattorelli6609 2 жыл бұрын
Thank you for the video! Very interesting! I have a question. Would this method still be convenient even if we use multiple Albedo Textures instead of pure colors for the materials?
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
It should still work perfectly, and all the Albedo/Normal/RoughnessMetallicAO will be in sync
@medmel2160
@medmel2160 Жыл бұрын
would it be possible to make some textures world position but still taking the UV channel for layering as you do in your system?
@PrismaticaDev
@PrismaticaDev Жыл бұрын
Sure would be! :) You'd just need to add a switch for each "layer" that changes it's main UV channel's coordinates
@medmel2160
@medmel2160 Жыл бұрын
@@PrismaticaDev awesome thanks for the info!
@fallenhoenix1255
@fallenhoenix1255 Жыл бұрын
Hey Charlie, great tut! Not sure if you know by now, but unreal has a checkbox to combine all meshes on .fbx import.
@PrismaticaDev
@PrismaticaDev Жыл бұрын
Hey hey! Yeah I did realise that (a little too late :P )
@AlexTsekot
@AlexTsekot Жыл бұрын
Hey Charlie, would using the UE material layers system be a bit simpler than this? It was used extensively for props in the UE5 matrix demo. Have you experimented with it? Would be great to get a vid on the advantages/disadvanages.
@PrismaticaDev
@PrismaticaDev Жыл бұрын
There are definitely upsides like the modularity, and downsides like the potential for extra performance impact, but at the end of the day both systems require a way to separate the sections of the material which is what the focus here is about (using UV's instead of an ID texture or vertex colours)
@stu32Grimson
@stu32Grimson 2 жыл бұрын
Any worry about the materials that get created/compiled when using static switches in an uber shader?
@R0w4nH0pk1ns
@R0w4nH0pk1ns Жыл бұрын
if the assign material doesn't work you should be able to shift select an object it did work on so that it becomes the active object and then hit ctrl + l and link materials.
@SHA3DOW_
@SHA3DOW_ 2 жыл бұрын
0:00 A disney princess lmao 🤣🤣🤣
@aukehuys2297
@aukehuys2297 2 жыл бұрын
As said before, you should really look into texture arrays - this would make this a lot less complex. Anyway - beside this, great information. I also use this technique for a city I am creating and it's really a lifesaver. I do use vertex colors, because it's easier to remap these values if necessary and I only need 1 channel - so it sufficient. Also I can blend material more easily :D
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
I've had a look in to them a few times - definitely a very useful tool, although I'll need to look in to how they're allocated in memory. For example, if only a few of the textures are being used, the entire array is still loaded in memory (probably not the biggest deal) but if a texture needed to be changed as a one-off, would creating another texture array allocate space for ALL of the duplicate textures? From what I've read the texture arrays are more performant because they have a fixed address or something that makes it easier to find and sample, my only concern is the flexibility of it. And also apparently mipping doesn't work with them (not a big issue for me, but could be for others)
@aukehuys2297
@aukehuys2297 2 жыл бұрын
@@PrismaticaDev Yes, the texture array is always in memory (as long it's used) and in my opinion really nice for objects that are static - but these are often a lot. For example the city I am working on. Yep, these buildings are static so there won't be any changes over time. Also these building are always present, so the texture were in memory nontheless. So an array is really suitable and for me - also pretty flexible. Before doing anything, it needs to have a plan what is needed, but when this step is done, it's easy to maintain (drag & drop array). In Blender I do have a script, that is converting the materials to vertex colors (every material does have an ID and this is applied to the vertex color) and you get also a nice visual representation. About mip mapping - in my experience this is a rumour that is wrong and maybe a thing when the arrays were new in Unreal. Yes, on default you don't have mips, but when you go down the options and search for the regular mip map settings, you can turn them on. Tested it, worked. EDIT: Oh, and one of the most important benefits of using texture arrays. My whole city is consuming just two texture sampler slots (four, if you want to blend).
@daveybrowne276
@daveybrowne276 12 күн бұрын
@@PrismaticaDev Does this mean with your method, if a material slot is not being used those textures won't be loaded into memory?
@daveybrowne276
@daveybrowne276 12 күн бұрын
@@aukehuys2297 I can't find the docs or information on texture arrays. Is this an array in the material or a data asset that can be set up and accessed by a material?
@gentlygiantllc2833
@gentlygiantllc2833 2 жыл бұрын
Any way to create a grid and not strips? Have you considered a way to possibly do this with a flipbook to remap UVs? I think it can be done. I'd like to create a 10x10 grid.
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Hey there! You can do strips in the X and Y axis and the multiply them together to create a grid. The only trouble with a flip book is that it is taking a pre-existing texture atlas and blowing each section up to full size, where as what we’re doing is completely modular
@gentlygiantllc2833
@gentlygiantllc2833 2 жыл бұрын
@@PrismaticaDev thanks! I just did the vertical strips. Too much trouble to worry about a grid
@tamplier1980es
@tamplier1980es Жыл бұрын
Tell me how you work with node Vertex Interpolator? My textures breaks and the shader only gets heavier.
@PrismaticaDev
@PrismaticaDev Жыл бұрын
Correct - the textures will be very "low resolution" because it's taking the colour of texture at that vertex point and using it to colour, so it's dependent on the density of the mesh. On the topic of the instruction count, the Vertex instructions are orders of magnitude cheaper. Imagine running those instructions for only 1,000 vertices vs potentially 100,000 pixels.
@dani3d_b
@dani3d_b 2 ай бұрын
Is it normal that every mesh that have the instance of this master material will load every texture that is in the master material? so i reduce the draw call to one but the size map of every actor is huge cause every texture is a hard reference (disabling the static switch parameters doesn't seem to do nothing about the hard references) Did I lost something? Thanks in advance
@mengli4165
@mengli4165 Жыл бұрын
Can someone tell me how to create the "Num of Segments" node in material editor? It's like a local variable but I don't know what the node is called.
@PrismaticaDev
@PrismaticaDev Жыл бұрын
Hello - press "1" and left click. It's a static scalar value
@marekbarski3708
@marekbarski3708 Жыл бұрын
why do not use separate uv layers for materials or udims?
@masgondi1
@masgondi1 2 жыл бұрын
wait, say i want to use this thing in my character system and i want to have hair, armor, pants, boots and so on, do i have to put them all in 1 blender file in order to organize their uv atlas map thing?
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
You could use a secondary UV channel, you could also use Vertex colour which you can assign on import which might be easier. But either way you'll need to have a system figured out beforehand :) Actually now that I think of it, you can edit UV's in Unreal 5 now so that might be worth looking in to!
@masgondi1
@masgondi1 2 жыл бұрын
@@PrismaticaDev thanks kanye, very cool
@masgondi1
@masgondi1 2 жыл бұрын
soo i have successfuly implemented an atlas for my character material & merged the mesh, it has dropped the draw call from 60ish (i kinda separated the mesh by quite a lot of parts) to about 5, so thank you so much for this video! it's still a bit weird tho how there's still 5, i thought having 1 mesh and 1 material means like 2 draw calls or is there something else i don't know?
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
@@masgondi1 awesome to hear!! I'm sure your GPU will thank you haha. The extra draws might be from the lighting pass or from cloth sim if you're using it
@vladislavkanivets6339
@vladislavkanivets6339 2 ай бұрын
I understand why i need it, and primely how to integrate it into MM, but. . . Is it possible to, to individually combine with (MF Map Adjustment) for every map in total, to have fully parametric material?
@vladislavkanivets6339
@vladislavkanivets6339 2 ай бұрын
2 Days later maybe it's working, i simplified it from 16 to 4 for reason's but it has nice parametric and group structure now it's testing time I need to remap tree in blender. . . PS: Thank you for your creativity.
@toneydeebo360
@toneydeebo360 2 жыл бұрын
There is a paper on Rendering Wounds in Left 4 Dead 2 by Alex Vlachos and it would be interesting to see your take on it.
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Sounds like an awesome read! I’ll have a look in to it :)
@semirukiya5308
@semirukiya5308 Жыл бұрын
This material looks quite complex. Is it performance heavy, especially when used with albedo textures? Other than that, great video! Cheers!
@PrismaticaDev
@PrismaticaDev Жыл бұрын
It's definitely more expensive than a regular shader, however compared to the cost of even just 1 extra draw call, it's miniscule. Check out my Devlog number 11 about my character material to see a comparison of 4 material slots compared to 1 (it's about a 300% gain)
@semirukiya5308
@semirukiya5308 Жыл бұрын
@@PrismaticaDev I see, I will definitely check that out!
@LovelyBigga
@LovelyBigga 2 жыл бұрын
Can you put the link for the blender add-ons in the description?
@madturtle84
@madturtle84 2 жыл бұрын
26:49 Can someone explain why he's using TexCoord[2] instead of default? Is there any special setup on channel 2 that I missed?
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Hey hey - TexCoord index 2 is being used for our "material mask" channel.
@BeLiedOnTV
@BeLiedOnTV 2 жыл бұрын
Niiiice!
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
You are!
@allashama
@allashama Жыл бұрын
having everything compacted into 1 Shader, isn't making that shader really heavy? to load and to generate? I mean, every frame, the GPU has to calculate this Heavy Shader. if we do a Shader Complexity, is it still green or become red or white? :O Thanks!
@PrismaticaDev
@PrismaticaDev Жыл бұрын
It’s heavier, but the cost of sending multiple draw calls is much much more costly :)
@allashama
@allashama Жыл бұрын
@@PrismaticaDev oh ok thanks :D didnt know it was much more costly to have multiple draw calls. Thanks dude, still learning! :P
@MorganSandbk
@MorganSandbk 2 жыл бұрын
Hey! you should look into texture arrays. would simplify this a lot.
@MonsterJuiced
@MonsterJuiced 11 ай бұрын
Can you elaborate on this more please? :)
@God0fTime
@God0fTime 9 ай бұрын
is there a way to do this with UDIM slots I imagine it would be way easier if there was a material node that can point to each udim slot then you would just put each UV piece in it's own slot 1001,1002, 1003 etc
@PrismaticaDev
@PrismaticaDev 9 ай бұрын
You can handle it that way, however this method is a little more flexible as you can have texture UVs that are outside of UV bounds. Although I'm not sure how UDIMs are handled in Unreal, so I might be wrong
@God0fTime
@God0fTime 9 ай бұрын
Thanks for the reply, still trying to understand the UDIM in unreal I don't see how to make it into a material atlas.. I have two questions Does This videos atlas method support tiling down for high pixel density? if you choose the same slot would it blend the texture on top of eachother? @@PrismaticaDev
@God0fTime
@God0fTime 9 ай бұрын
if it supports tiling then I think this videos method is better because virtual textures in unreal are more expensive
@PrismaticaDev
@PrismaticaDev 9 ай бұрын
@@God0fTime Yep, you can scale/offset the textures to any size within the material without breaking anything, since we're only fiddling with the primary UV channel, not the "key" UV channel
@God0fTime
@God0fTime 9 ай бұрын
so if lets say my material on section 1 was a 4k tiled cloth material, on the second section I could have a 4k hand drawn texture in a material and just offset and scale it to overlap the uv in the position I want right. if so that just makes udims pretty much pointless lol makes you wonder why this is not an engine feature.. I see they are adding uv tools to the engine so maybe we will get this built in.@@PrismaticaDev
@LookItsCollin
@LookItsCollin 2 жыл бұрын
Fucking legend this content is so useful wow
@fearguyQ
@fearguyQ 2 жыл бұрын
oof, Runescape nostalgia. I need to sit down for a minute.
@gelisob
@gelisob 2 жыл бұрын
I wonder, isn't this kind of mad material logic very CPU costly to run in a game? Or is that just to prep your assets that all go through baker later?
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
The shader calculation isn't that much unti you start layering 10's and 10's of materials, and even then it is still up to 10x faster than using separate material slots
@boraycobanoglu1372
@boraycobanoglu1372 9 ай бұрын
what if our assets use multiple *textures*? as i see it, all the pieces of these assets use just one texture (stone). this is just so we can overlay some color over one individual texture? it is still a hell of an improvement for sure. but i am trying to understand the limitations here. great work and thanks for sharing :) edit: oh it doesn't work like this. it does work with multiple textures! it is not just for overlaying colors then? so, if i have an huge asset with a lot of individual textures, this will work too? what about sampler limit?
@gamertech4589
@gamertech4589 10 ай бұрын
hi, Can make tutorial for atleast create master material tutorial for it. I don't find any tutorial on it. which can have atleast 3-5 texture with full control if you don't mind it. i need similar Master material solution did not found similar solution.
@PrismaticaDev
@PrismaticaDev 10 ай бұрын
Hello, this tutorial should suit your needs if you follow it :)
@PotatoHate
@PotatoHate 9 ай бұрын
This is great but only if you are going for same color driven stylized style, as this doesn't really explain how to deal with 16 samples max in a single material. Would be great to get a vid on this subject "Workaround for 16/16 samples". I tried to use UE5 Material Layering system but that has same limitation i can only have about 3 layers of materials and then i run out of 16 samples.
@PrismaticaDev
@PrismaticaDev 9 ай бұрын
If you set the Sampler type to "Shared: wrap" you can have 100+ samplers in the shader :)
@PotatoHate
@PotatoHate 9 ай бұрын
@@PrismaticaDev 👀oh
@namrog84
@namrog84 3 ай бұрын
With Nanite now bypassing draw calls completely. I wonder if its still useful to do material atlassing like this?
@PrismaticaDev
@PrismaticaDev 3 ай бұрын
I don't think Nanite bypasses drawcalls completely - from my understanding, it can "batch" together instances of the same material across different meshes since it essentially merges all meshes in to one GIGA-mesh. But it would be interesting to do some performance comparisons. This method greatly reduces draw time at the cost of shader complexity, so with Nanite it might be more performant (if using the same material across multiple meshes) to use smaller, simpler materials. Performance aside, this method is still extremely useful for ID-mapping and sectioning different parts of an object even when using Nanite
@namrog84
@namrog84 3 ай бұрын
@@PrismaticaDev I did some really basic tests using a mesh with 3 materials vs 1 mesh with 1 material (fancy uv setup). Even using the same more complex 'UV mapped material' for both nanite and non-nanite version. It seems the nanite one is more performant at first glance of stats. I know most people talk about nanite using 'high poly stuff' and LOD aspect of it but my game is low poly, so the performance of material pipeline in nanite isn't talked about as much. I'll continue to investigate but I think it might be more performant, or at least have no performance loss of having independent materials now. If I find anything interesting, I'll post to prismatica discord.
@PrismaticaDev
@PrismaticaDev 3 ай бұрын
@@namrog84 Would love to hear how it scales at the scene gets more complex and more different materials/meshes are added. Cheers!
@andrewwood2556
@andrewwood2556 Жыл бұрын
Hey Prisma, this is a great tut. I would like to know what all that extra gobbledeegook you quickly glazed over is and what it does? Also, does this support alphas? Lets say I wanted to incorporate my mesh decal trim sheets into the stack for example. Is that possible?
@thenerdsherpa540
@thenerdsherpa540 Жыл бұрын
what is the "1 - x" node? This is way cool! You've created an infinate texture atlas. I'm an artist, not a coder, but I was able to follow the concept of this and incorporate it in my Cell Shader that uses directonal light. But I got stuck on the "1 - x" node... never mind. I found it on your blueprintue link.... for anyone else that ran into this, the node is called "OneMinus"
@user-zc3wp1ri7w
@user-zc3wp1ri7w Жыл бұрын
Can't understand why when using the function my texture become bright.I tried to change contrast and so on but nothing resolve. 9:43 At least the way doing this method in the first step with creating new material works pretty well. Edit:Sorry just forgot to connect the multiply with at pin B on last add node that was adding 0 to my material lol
@ethanwasme4307
@ethanwasme4307 13 күн бұрын
welp, this might be the camel that broke the needle... time to learn houdini
@TheNetwork
@TheNetwork Ай бұрын
this is now broken in UE 5 any possibility to update?
@devlad
@devlad Жыл бұрын
Can't for the life of me get that MF to work. In UE5 I get `[SM5]: Cannot cast from smaller type float3 to larger type float4.` It seems to think the output of the MF is a Float3, and I assume the base color of my MM is expecting an Float4. Is there a step I'm missing?
@51773chase
@51773chase Жыл бұрын
Did you ever figure this out?
@SETHthegodofchaos
@SETHthegodofchaos 2 жыл бұрын
5:30 Breakfast
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Hahahaha I'm glad someone understood
@SETHthegodofchaos
@SETHthegodofchaos 2 жыл бұрын
@@PrismaticaDev :D
@kimosaber9937
@kimosaber9937 2 жыл бұрын
But, doesn't that greatly increase the complexity of the material which in turn reduces performance ?
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
It does increase the complexity slightly, but the benefit vastly outweighs the cost. Draw calls are the main bottleneck for rendering times, so this method can be up to 10x faster (not an exaggeration)
@ngongames5181
@ngongames5181 2 жыл бұрын
bro, quiero hacer una pregunta seria, y no dare mucho contexto (creo que deberia hacerlo, pero debo hacerlo). ¿Crees que yo pueda ser cientifico e incluso estudiar teniendo en cuenta que mis inicios fueron no tan alegres y tampoco fui tan bueno como persona y que aun no considero que lo sea? (debo añadir que tengo algunos problemas psicologicos, conductuales, y casi desviacion (atraccion menor), por decir poco). pregunto para serciorarme de si es que estudio sere mejor persona de lo que soy y que cuando haya aprendid (lo cual seguira toda la vida) pueda estar seguro de que no hare una estupides o algo malo con esos conocimientos. sabes que no necesitas que te alabe porque ya has logrado tu propio exito personal. Saludos y gracias, tanto si respondes como si no. Un Abrazo cabros.
@abdelhaksaouli8802
@abdelhaksaouli8802 2 жыл бұрын
wait ? each material slot is a draw call ???
@coffeediction
@coffeediction Жыл бұрын
yeah, but this way you have 1 drawcall each mesh, which you can further reduce by merging and whatsnot. In theory its possible to have 1 drawcall for entire level (in theory and depends on level and lots of prepwork, probably not worth it)
Omega Boy Past 3 #funny #viral #comedy
00:22
CRAZY GREAPA
Рет қаралды 16 МЛН
Don't eat centipede 🪱😂
00:19
Nadir Sailov
Рет қаралды 23 МЛН
Trágico final :(
01:00
Juan De Dios Pantoja
Рет қаралды 32 МЛН
Omega Boy Past 3 #funny #viral #comedy
00:22
CRAZY GREAPA
Рет қаралды 16 МЛН