This guy deserve nobel prize... or MegaGrant at least. Such a MVP among other similar channels
@clairearan505 Жыл бұрын
I learn something new every time I end up on your channel. Thank you.
@RenaudGaland213 жыл бұрын
Ben! As a long time fellow "polycounter" and someone who has been following your work since that era, I just wanted to drop in and thank you for this INCREDIBLE KZbin initiative. I started to dive into shader creation in Unreal for the first time a couple of months ago, and this channel has been THE. BEST. resource I could have ever dreamed of. Your way of approaching various topics based on concrete and production oriented examples (like the one above), coupled with your awesome teaching skills is such a luxury to have available for free (I would pay without hesitation for that kind of teaching). Anyways, looking forward to the next videos and hoping to see a lot more interesting topics like this one. As an idea, I think it could be super useful to cover some classic materials like cloth (with custom brdf), skin, etc. Thanks again!
@artemaung52743 жыл бұрын
Yep! Ben's tutorials are massively superior to paid course for ue4 I took a while back. I feel incredibly lucky that I stumbled upon his channel. Gone are the days when I spend countless hours searching reddit, google and youtube for answers. I just watch Ben's tutorials and I'm pretty much set for shaders! Now if only there was someone like Ben for Zbrush... That would be the dream..
@muralist12 жыл бұрын
Thanks! For two days I've been trying to set up a shader for some models and when i saw your screen of lerp blending nodes I thought, "that looks like how I'm doing it," and then you said "this is the example of how not to do it." Haha. Excellent tutorial, this is exactly what I needed.
@aukehuys3 жыл бұрын
As thought, my way of doing things were not the best one. Actually I never heard of texture arrays before - so this video is very welcome. That being said, thanks again for your great teaching :)
@jasonbrunner38262 жыл бұрын
THANK YOU! Besides the optimization of texture arrays, this reveals a technique I've been trying to figure out. Multiple grayscale masks in one texture channel goes back to when I used to color comics in Photoshop where artists would save all the mask for an entire page in one "flats" alpha channel. Now my mind is going over all the possibilities 🙂
@aass-kr6ll3 жыл бұрын
Thanks for your selfless sharing. Your channel has really helped me a lot on learning Shader.
@Neki2K12 жыл бұрын
Master of graphic computer
@Killhubi3 жыл бұрын
Ahh, nice, I got to this same conclusion several weeks ago. Texture arrays are handy in several occasions. For example wanting several tileable materials - usually that is done using an atlas texture and you have to cut the geometry and UVs to fit the atlas texture. But using texture arrays you can at least save up on geometry data while barely adding extra complexity to the shader by adding an ID map. But recently I figured out that Texture Arrays, at least in Unity, are unable to use the advantage of Texture Streaming (loading only specific mipmaps instead of loading the entire texture with all its mipmaps, to save up on GPU memory). So, be a bit warry about using texture arrays everywhere. Unity is sadly currently not actively working on a solution for this. Though it's on their long to-do list. -> However, for detail mapping, it's perfectly fine since they are only needed in close-ups, thus you only load them in when the camera is close enough to the object. Ergo, LODs.
@BenCloward3 жыл бұрын
Thanks for your great insights! Regarding streaming, the use case that I'm suggesting is to make one array of low-res textures that would then be applied to all of the characters. So it could stay in memory all the time without too much issue. Streaming would make the feature more flexible overall for sure, but not required for the use case I'm suggesting.
@myunrealenginebuilds Жыл бұрын
thank you for this video and the triplanar one, solved a problem I was having with textures using the voxel plugin for UE4
@diomiziofattorelli66093 жыл бұрын
Amazing Lesson!!! Finally a clear and useful application of 2d Array. I have a question. Isn't it risky to use the Round node? Wouldn't be better to use the Floor node in this case?
@BenCloward3 жыл бұрын
Oh yeah, that’s a good point. Floor would probably work better.
@coolboygfx9 ай бұрын
Thanks!
@BenCloward9 ай бұрын
Wow, I really appreciate the support. I’ll put this toward some new computer hardware. Thanks!
@craigd81773 жыл бұрын
All your videos are excellent. I've learned so much.
@etiennevanier8 ай бұрын
Good tutorial!
@roadtoenviromentartist3 жыл бұрын
Very Clever!!!. Congratulations.
@antoniosuarez7881 Жыл бұрын
thanks, really usefull & grate tutorial
@fernandourquijo95062 жыл бұрын
Amazing video! very scalable technique for managing multiple detail normal maps (or anything similar). I think the only constrain is if you are targeting below Shader Model 5, the Texture2DArray type, sampling etc could not be supported
@thp19729 ай бұрын
Hi, great tutoria (as usual). Just a quick note: please, could you post a link to the assets you created? (also in the previous video there weren't). I think this could be an amazing add. Thanks.
@Mireneye Жыл бұрын
I'm trying really hard to understand why there are fewer texture lookups. Any idea as to what Unreal might be doing there to optimize that?
@jeanpaulsoftware Жыл бұрын
Thanks for the video- been trying to find something, ANYTHING online about texture arrays in Unreal and this is one of the only things talking about them- the UE5 docs have exactly zero information beyond the C++ class definition. On that subject- do you have any info about their limits, or recommended limits? For example, what's the max number of textures you can have in one, and what's the recommended number? I'm trying to keep it to 8 or below at the minute but that's a totally arbitrary figure. Cheers!
@BenCloward Жыл бұрын
I've never tried to push an array to its limit, but I don't think that's a very healthy question. You should try to keep it as small as you can. The array is using texture memory just the same as all of the other textures, so the bigger you make it, the more memory you're using and the lower amount that's available for everything else. So I guess the answer is, make it as big as you need without any waste, and if you run out of memory and you're seeing a lot of texture swapping going on, look for ways of reducing things overall. I've seen animations stored in an array where every frame is an array slice and these can get up into the hundreds of frames - so the limit, if there is one other than memory, is pretty high.
@jeanpaulsoftware Жыл бұрын
@@BenCloward thanks for that- yeah I'm not intending on putting thousands in, it'd just be nice to know how well they scale.
@tylergorzney84992 жыл бұрын
Can you use Vertex Colors to control index for Texture Arrays? And can you use each color channel in vertex color to control 3 different texture arrays? Trying to make a landscape prop material where the modeler can vertex paint the prop to control what textures are used. Red would determine the composite texture used for edge map, curve map and cavity map, green channel would set the base material, an blue channel would set the texure for moss, snow etc. Thank you so much for your work, your videos have been priceless, and thankfully free since I dont make any money but just like do this stuff as a hobby. It i so great how you go into optimization, why you optimize it that way etc. Fantastic stuff!
@FrostbiteCinematics2 жыл бұрын
Hey, Ben! Great video :) I think this is a great application of Texture Arrays, however I was wondering whether you have an easy way of setting up UV tiling per-texture? In this setup, if you tile the texture array it will tile every slice by that amount. In your video example, everything is tiled by 4. But there might be scenarios where I want to tile my leather by 5, cloth by 10, grainy plastic by 3, etc. This is used in Star Wars Battlefront 2 (2017) and I was hoping to be able to recreate the method in Unreal Engine rather than just using the same tiling value for every TA element. I did (*sort of*) manage to set this up myself in Unreal Engine, however, it only works specifically with texture arrays with only 3 slices. It doesn't really work with any more than that since the method involves using an IF node. Since 1 is in the middle of 0 and 2, we can then set separate tiling values for A>B, A=B and A
@BenCloward2 жыл бұрын
I left this detail out on purpose because my previous attempt at doing this on Anthem wasn't as clean as I wanted and I think I had decided that I just wanted to try to make all of them match a uniform size and just give a global tiling rate next time I did it. You can encode the texture tiling rate as a grayscale value in one of the channels of the mask texture. Red channel for which slice of the array to use, green channel for how many times to tile it for example. You just pick a maximum tiling value and then convert your tiling rate into the 0-1 range and store it in the texture. Then in the shader, you unpack the sample again using the maximum value and use it to tile the array texture. This works ok, but can give weird results along the borders of the material types, especially with texture compression and at low mip levels. Your method works fine too, but as you say, you're limited to a fixed number of unique materials. On Anthem we let the Artists use up to 16 different material types per mask and our array had 16 slices. Our cloth detail textures in the array were only 64x64 though.
@KRGraphicsCG2 жыл бұрын
In Unity for my personal project, this is exactly what I did, but I used a RGB texture, where black is unblended. And I use Amplify Shader Editor, where each colour in the mask (no gradients, only solid colours) represent a detail material AND I have access to how many times it tiles, how strong the normal map is, and what kind of material I want. I also extended this detail normal map to detailed Albedo, AO, and Roughness to give me an unprecedented level of detail. The limit here was to keep the MicroTexture at least 512x512 MAXIMUM but author it at 4k in Substance Designer (just did a test in Unity at 128 and the microtexture was very muddy though at a certain distance, you would never notice).
@bigolbearthejammydodger65272 жыл бұрын
Hi ben - this has to be the first of your tutorial series i found a flaw in. I cant speak for unity - but for unreal the way the render process works behind the scenes is that it actually prefers more material slots, with less individually complex materials. This means that when making a character (lets use your example - denim jeans, leather coat and boots, skin and linnen shirt.) Each material should be assigned its own material slot and handled individually - more materials but less complex ones. This IS a change from older engines and the method used here would be correct on older engines. Further more this enables easy reuse of materials across multiple assets and the render takes advantage of the same material being on multiple assets. Texture arrays are of course still important and useful - but i felt i should pass this on. Information according to Unreal documentation by Epic. FYI - Im a coder, not much of an artist - so im commenting from a pure code efficiency perspective, based on what I have read about how the engine works in comparison to older engines. So much of your work has been so helpful, so i hope you take this comment in the cooperative nature it is intended.
@BenCloward2 жыл бұрын
Thanks a lot for taking the time to help me learn! My understanding is based on reducing the total number of draw calls. More unique materials means more unique draw calls, which means more cost on the CPU. Does Unreal have a way around that? Can you point me to more information? I'd like to understand this better.
@bigolbearthejammydodger65272 жыл бұрын
@@BenCloward What I understand to be happening is as follows: Using multiple simpler materials is as you say more draw calls, but if those materials are simpler then the call is quicker, potentially a LOT quicker. Lets take your leather jacket as an example - rather than using a high res texture, unreal engine prefers it to be given just a simple colour - in this case a dark grey. coupled with a UV map for macro detail and a UV for micro detail. Unreal also has a way of reusing materials that are 'close enough' (I THINK this works by finding material instances of the same type that are at a similar enough angle and distance to cam coupled with light map matching - sounds like sorcery to me ;) ) I have also read that in comparison to other engines Unreal prefers higher poly count, but simpler materials as well. My source for all this information was the official UE4 documentation by Epic. docs.unrealengine.com/4.27/en-US/ and their associated video tutorials. I sat through all of the materials and blueprints stuff and this is one of the more interesting takeaways from that. I believe these matters were discussed in the video tutorials on materials released by Epic. Its all about the move from material modeling with textures to the shiney new 'physical material model' as I understand it. Hope that helps clarify - keep up the great work chap, your vids are awesome.
@andyjgough3 жыл бұрын
Texture array. Who knew. Thanks.
@YASIR.K3 жыл бұрын
Thank You
@masgondi110 ай бұрын
Hi, great tutorial, i was wondering, is there a way we could somehow do material operation on all of those elements inside the texture array? For example like maybe adding every single texture inside the array into 1 mixed texture.
@TristanDelGiudice9 ай бұрын
Hey Ben! Great video. I constantly find myself coming back to this for reference. Have you ever encountered your detail maps breaking your normal maps? I'm currently using a packed map that is packed as follows for my baked and tiling maps alike: R - Normal DXX , G - Normal DXY , B - Roughness . I'm appending my red and green channels and feeding them through a constant bias node followed by a derive z. I'm using a blend angle corrected normal node to blend the two together. I'm attempting to use 6 different materials for my character. I had a set up at my last job that worked well but unfortunately don't have access to those files anymore. Would you be able to provide any insight into this? Thanks!
@toddeburch3 жыл бұрын
Hey Ben, great tip, thanks! Since each pixel in an 8-bit grayscale image has a single byte value (which is essentially an integer) between 0 and 255, is there a way to sample a texture in Unreal and have it return the raw byte value of the pixel instead of a float value between 0.0 and 1.0? Not only would the texture sample itself probably be quicker, but this would allow you to avoid the "Multiply" and "Round" nodes and avoid having to figure out the proper values for the equal divisions of the 0-255 gradient, because the raw pixel value is itself the index into the array. But perhaps shader language and graphics cards are optimized to only work with floats, so there's no way to get the raw byte value of the pixel?
@BenCloward3 жыл бұрын
This is really good thinking, Todd. Unfortunately, it's as you say - samplers are set up to return floating point values, and as far as I know, there's no way to get a sampler to give you integers other than converting the float values to ints - which is basically what we're doing.
@javisartdesign Жыл бұрын
Is it important to set MipMaps instead None? For performance reasons? What is the difference with UDIMs? Thanks for the video
@fabianportero35633 жыл бұрын
Excellent videos about normal maps! While watching the video I had a question, is there any way to make the different normal maps have a smooth transition between them? That is, at the edges that divide each different value of the mask, maybe with another method? Thanks Ben!
@BenCloward3 жыл бұрын
You could do that if you used the method I described as "how not to do it" at the beginning of the video. If you wanted to pay the extra cost of doing all of the texture samples, you can do smooth blending between them. But the technique I'm describing - for use on characters - doesn't need that.
@fabianportero35633 жыл бұрын
@@BenCloward I see! I think I have an idea of how to do it with the "how not to do it" method haha, thanks. Looking forward to the next video!
@Devorkan3 ай бұрын
Since you took the middle point of 4 segments on a 0-1 range, shouldn't you multiply by 4 to get 0.5, 1.5, 2.5, 3.5 (if Unreal rounds down) ?
@mobingandomabadi86583 жыл бұрын
Wooow Amazing technique !!! thanks you so much Ben ;) but I'm confused about something here !!! we applied four different detail normal maps on our subject with just one multiplier for control tiling of all of them uniformly. . . but I want to know there is a way that we can control the tiling of each detail normal individually with this technique ??? Thanks soooo much ;)
@JieDu-yj2vd6 ай бұрын
Hi, how can textureArray make the edges of your mask transition naturally instead of 0 or 255, such as the middle value of the mask, and use the black and white gradient transition naturally like lerp
@KRGraphicsCG2 жыл бұрын
Man, this is awesome and very detailed way of setting up detail normal maps. I do have a question in regards to using an RGB texture to set up a localised mask. I use Amplify for my shader work, and decided to try and recreate this shader with Shader Graph, and while I get a nearly identical setup, I am at a hurdle where I want to use the red channel of my RGB mask for cloth detail (my tiling textures are not an array, but a small 256x256 microtexture and there is no "Layered Blend" node in SG). How would you go about setting that up? Thank you for the tutorial EDIT: I noticed that while each detail showed up, you couldn't tile them individually.
@w0nnafight Жыл бұрын
Sorry for late comment, I was just wondering, why dont we add the detail normal map when we are texturing the asset? If we are texturing in substance painter for example, we can just overlay a normal texture and sample it 16 times, why create a custom shader?
@BenCloward Жыл бұрын
You can always overlay a detail normal on top of another normal map in Substance, but you'll be limited by the resolution of the base normal map. So for example, if I have a base normal map that's 2048x2048 and a detail normal map that's 1024x1024, if I tile the detail map 16 times, I will still only get a resolution of 2048 when I export the texture. But if I do the same thing in the engine, my tiled 1024 texture would give me an effective resolution of 16,384. Hope that makes sense.
@w0nnafight Жыл бұрын
@@BenCloward that makes a lot of sense, thank you!
@TheBugB3 жыл бұрын
Rock rock rock rock rock!
@adamplechaty3 жыл бұрын
Huh, texture arrays kinda look (and function) like good ol' trimsheets typically used by enviro artists right?
@BenCloward3 жыл бұрын
Could be - although with a trim sheet you use the UVs to select the portion of the texture you want to apply. With this, you're painting a mask to select which slice of the array to use.
@IbtesamSadiq18 күн бұрын
It's only useful if I have a hard mask. It doesn't work with gradient-based values, so there isn't any way to get soft transitions.
@DizpozalDizzАй бұрын
Instead of dividing the shades for the mask based on how many textures we have in the array, why shouldn't we just paint say... the first element 0, second element with the value 0.1 and so on? Now instead of multiplying and rounding, we only multiply it by 10 to get the integer value we need for the index. Forgot to add a glossy button on the cloth? No need to recolor the whole mask, just paint with the (darkest value yet + 0.1) for the button and add the button normal map to the texture array. Is it because compression would mess up the values? Creating gradients that are almost invisible? If that is so, can't we just get around it with rounding?
@BenClowardАй бұрын
That’s a fine alternative method and you’re welcome to do it that way. That method leaves space open for future expansion if you need it. The method I’m showing uses as much precision as possible in the texture and spaces the masks evenly to prevent “leaking” between masks, but doesn’t leave room for expanding. So both methods have good points and bad.
@Musical_Live_Singer2 жыл бұрын
Unreal crashes whenever I try this..
@Wicked_3D Жыл бұрын
Had same issue. On the texture sample of the mask grayscale, don't use RGB, but instead use R or G or B (1vector instead of 3vector). For some reason 3vector going out from Round (I even tried Floor) nodes, into append goes crazy and crashes the editor. I hope this solution helps!
@lenxie45012 жыл бұрын
MR. Shable
@MarkRiverbank3 жыл бұрын
As a Unity developer, this is a great series, but I really wish you’d flip your process to Unity first. You already have so much great Unreal-centric content on your channel.
@BenCloward3 жыл бұрын
Thank you for the feedback! My intent is to teach core principles of shader creation that can be used in ANY game engine. The reason that I show things in both Unity and Unreal is to prove that these are cross-engine principles. You will be significantly more powerful and valuable as a creator if you learn core principles rather than only learning a specific tool. It's my desire to raise the ability of everyone in the community, not just those that use one tool or another.
@dimoronen2 жыл бұрын
@MarkRiverbank Very late reply but I still feel like I have to say this: that's a really selfish reason. Furthermore there is a lot more video content for unity out there than unreal. He also have unity first in some videos which makes this a even worse argument.
@MarkRiverbank2 жыл бұрын
@@dimoronen EVERY video Ben produced prior to this series was on Unreal, and at this point in this series it had drifted to be more Unreal-focused again. Suggesting that a new series which promised to show how the principles could apply to another engine should put the focus on that other engine is not “selfish.” Seriously, as you suggested, it’s a late comment which seems to have no point except throwing personal insults. Go do something nice for your mom, maybe there’s still a chance to not be a complete sadist when you grow up.
@dimoronen2 жыл бұрын
@@MarkRiverbank There is no insult just reflection on conduct. You as a unity dev asks for unity content to be prioritized when there is a ton more resources for unity already out there and you do not see how that is seen as selfish? It is not a big deal in the end because the graphs are basically the same in both engines but annoying nonetheless. And before you say anything, I work (professionally) with both engines (currently unity) so I do not have much of a horse in the race.