Understanding Texture Maps - Shader Graph Basics - Episode 5

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ส.ค. 2024
  • In this beginner tutorial, we go over texture mapping. I walk you through the high level workflow for creating textures and getting them into the engine. I also go over the factors that control the size of textures in memory and how to control the amount of memory to get the right balance between quality and memory usage in both Unreal 5 and Unity.
    Here are the links to the 2 earler videos that I recommended you watch:
    Basics of PBR Rendering:
    • Basics of PBR - UE4 Ma...
    Texture Compression:
    • Texture Compression an...
    Here's a video that goes over the sRGB setting and what it means to apply gamma correction to a texture:
    • Linear and sRGB Color ...
    Here's last week's video - Basic Shader Math:
    • Basic Shader Math - Sh...
    And here's the playlist for the whole series:
    • Shader Graph Basics
    Learn more!
    • Unreal Engine 4 Tutori...
    • Unreal Engine 4 Beginn...
    Web Resources
    docs.unrealengine.com/en-US/E...
    docs.unrealengine.com/en-US/E...
    en.wikipedia.org/wiki/Texture...
    en.wikipedia.org/wiki/S3_Text...
    wiki.polycount.com/wiki/DXT
    joostdevblog.blogspot.com/2015...
    coronarenderer.freshdesk.com/...
    stackoverflow.com/questions/1...
    Shader Book Recommendations
    www.bencloward.com/resources_...
    ------------------------------
    Theme Music
    Peace in the Circuitry - Glitch Hop
    teknoaxe.com/Link_Code_3.php?q...
    Background Music
    Sappheiros & Almaa - Dreams
    • Sappheiros & Almaa - D...
    #UnrealEngine #Unity #Textures

ความคิดเห็น • 81

  • @artemaung5274
    @artemaung5274 3 ปีที่แล้ว +48

    Ben you are a hidden gem of TH-cam learning! I've learned so much about shaders, thanks to you!
    The difference between quality of content and number of views just doesn't compute at all. In retrospect I was just incredibly lucky to have found your channel half a year ago. Nothing else out there teaches as well about shaders as you do.

    • @binyaminbass
      @binyaminbass 2 ปีที่แล้ว +1

      Yeah, I only found it because some other totally unknown channel recommended it to me. What a discovery!

    • @sergeyfilinsky5398
      @sergeyfilinsky5398 ปีที่แล้ว

      There is also Freya Holmer who is doing great job explaining this, but more from a math point of view

    • @BenCloward
      @BenCloward  ปีที่แล้ว +1

      I love Freya’s work! She does a great job of illustrating complex math concepts visually so i can understand them better.

  • @hassambinhassan4446
    @hassambinhassan4446 ปีที่แล้ว +3

    After spending lot of time searching on TH-cam for learning shaders, I have found your channel. TH-cam is so unfair, always recommended me low quality channels, this channel must be on top while searching about shader and game dev. Thanks to you Ben.

    • @BenCloward
      @BenCloward  ปีที่แล้ว +1

      Glad I could help! I don’t spend a lot of time doing self-promotion or asking people to “like” and “subscribe.” I work under the assumption that if I make the videos useful enough, people will share them. I hope it’s true.

  • @FrankTank7777
    @FrankTank7777 ปีที่แล้ว +3

    Hi Ben, just recently discovered your channel. Amazing, is all I can say. I have always wondered how shaders worked, and your easy-to-understand explanations are just so good. It is always exciting to take a peek behind the curtain, so to speak. And the fact that you have so much experience is refreshing. I am also no spring chicken myslef anymore, and to learn from someone that has probably learned the hard way (before TH-cam days) brings this extra level of understanding that is missing from a lot of the TH-cam training today. It also seems that this training will help tremendously in creating materials in C4d/Maya etc, especially since I use Redshift which also allows for node-based setup. This is definitely Udemy/Varsity level training, I am honored sir. Also thank you for doing this training on both Unity and Unreal. I would love to switch to Unreal, but I am a C# developer of many years, so to learn C++ seems to go backwards a bit. But now I feel if I am ready to make the switch, at least some of the elements in Unreal will be familiar to me, thanks to you.

  • @DesertStormXQ
    @DesertStormXQ 2 ปีที่แล้ว +1

    Unreal Engine is a good software, and now I have met a good teacher, thanks you Ben

    • @SmithRose-tq4hl
      @SmithRose-tq4hl 2 ปีที่แล้ว +2

      I exactly feel the same way!! :D Ben is absolutely a good teacher!

  • @floki6481
    @floki6481 3 ปีที่แล้ว +4

    You have some of the most interesting and well explained tutorials. Creating a interactive mud with a ground deformation would be really cool to see.

  • @AImagery4444
    @AImagery4444 2 ปีที่แล้ว +2

    This is what I'm looking for to explain Texture compressing in *Engine* clearly!

  • @guscodie1633
    @guscodie1633 3 ปีที่แล้ว +4

    Sir Shader Ben,
    Thank you so much for taking the time to create all these brilliant tutorials and share with us your knowledge. I was looking for a great teacher and I've found one. I can't wait for the next one!
    Cheers!

  • @alborznazari
    @alborznazari 3 ปีที่แล้ว +1

    How eloquent those tutorials are!
    Really enjoying.

  • @maximemouret2657
    @maximemouret2657 2 ปีที่แล้ว

    That was really the perfect place to explain why people should or shouldn't tick the "Power of two" box ;)

  • @JacobPernell
    @JacobPernell ปีที่แล้ว +2

    This whole series has been so insanely helpful. Thank you so much for making these videos and explaining things in such an easy to understand way!

  • @pxelguyplays
    @pxelguyplays 3 ปีที่แล้ว +7

    Lovely! This is gold.

  • @tiagoballin5827
    @tiagoballin5827 3 ปีที่แล้ว +5

    Amazing content, been learning so much from you, please keep up with this kind of content, thank you!

  • @behrampatel3563
    @behrampatel3563 3 ปีที่แล้ว +2

    wow ! learned a great deal about optimizing textures in UE . Thank you Ben

  • @byrontribs7539
    @byrontribs7539 2 ปีที่แล้ว +1

    Amazing ben! Thank you

  • @juanmilanese
    @juanmilanese 3 ปีที่แล้ว +1

    thanks again Ben, this one has invaluable info!

  • @FerdiFerdi
    @FerdiFerdi 3 ปีที่แล้ว +1

    I am loving this series, as a Unity user is great to see how things translate in Unreal! I was ye I know PBR and texture and still you surprised me and I learnt something new about compression!

    • @BenCloward
      @BenCloward  3 ปีที่แล้ว +1

      Really glad I could help you learn something! Thanks for letting me know.

  • @somni4516
    @somni4516 2 ปีที่แล้ว +1

    Thanks for the video!

  • @foxen19
    @foxen19 3 ปีที่แล้ว +2

    I'm studying game art atm, aspiring to be a lighting/tech artist, and this video just saved my day. Had a squirrely little texture that UE compressed too much for my liking, but now it’s behaving thanks to you! :)
    Some future topics an aspiring tech artist would love to know about:
    - How to do performance checks and find out the relative cost of different things in the game (some things I just know *are* costly, but I have no clue of *how* much comparatively)
    - More advanced vector math for shaders. I’ve come across a few shaders that use dot products and cross products and whatnot (to calculate falloff, I think it was??) but I find it hard to visualize what it actually is/does. And more importantly, when and how to use it?
    - Deciding on performance budget
    - Shaders that are dependant on the camera angle (thinking specifically of the glittery sand in Journey)
    Thanks again 😊

    • @BenCloward
      @BenCloward  3 ปีที่แล้ว +2

      These are really good suggestions, Sophie. Thank you!

  • @psy237
    @psy237 2 ปีที่แล้ว

    all my doubts and questions about what to use when have been eliminated. those doubts etc also came from wrongly created marketplace assets, so be careful ;) rather do it yourself I guess!! Thanks so much for clarifying and explaining everything. I knew I should go through all your episodes not just the triplanar one which is how I found you actually

  • @antoniosuarez7881
    @antoniosuarez7881 ปีที่แล้ว +1

    thanks, grate tutorial

  • @rafaelskiarteportfolio1098
    @rafaelskiarteportfolio1098 10 หลายเดือนก่อน +1

    thank you

  • @levitycreations
    @levitycreations 3 ปีที่แล้ว +1

    Thank you!

  • @KineticQuasar
    @KineticQuasar ปีที่แล้ว

    Harika bir anlatım olmuş. Çok şey öğrendim. Eğitim seriniz için teşekkürler.

    • @BenCloward
      @BenCloward  ปีที่แล้ว

      Rica ederim! Yardım edebildiğime sevindim!

  • @kalubandali2241
    @kalubandali2241 2 ปีที่แล้ว +1

    thank you sir

  • @anubhav3d
    @anubhav3d ปีที่แล้ว

    Thankyou

  • @user-qw9ch7yo4g
    @user-qw9ch7yo4g 3 หลายเดือนก่อน

    ありがとうございます!

    • @BenCloward
      @BenCloward  3 หลายเดือนก่อน

      お役に立てて嬉しいです。 サポートしてくれてありがとう!

  • @YASIR.K
    @YASIR.K 3 ปีที่แล้ว +1

    Thaaaaaaak You Ben,🍻

  • @atgunsforhire9643
    @atgunsforhire9643 ปีที่แล้ว

    Thanks Ben ! I love all your tutorials, they helped me a lot :) I have 2 questions:
    1. if I have an asmr map, how can I display it in a single channel (RGBA) like you did in Unreal?
    2. What nodes should I link it to on the master stack in unity? unity seems not have nodes called roughness or specular. I did not find answers in the unity documentation, either. sorry for my poor English.

  • @mariamshoshiashvili3213
    @mariamshoshiashvili3213 2 ปีที่แล้ว

    I’m a huge fan of your content Ben. One thing I don’t get is why single channel textures are that expensive in comparison to others that have more channels.

    • @BenCloward
      @BenCloward  2 ปีที่แล้ว

      Each texture sample has a high performance cost. If you can do a single texture sample and get multiple types of data from it, the overall cost is lower than if you were to sample several single-channel textures individually. So if you pack four single-channel textures together into one texture, you only have to do one sample and get the data from all 4 of them. Whereas if you sample them separately, you end up with the same data - but you had to do 4 samples to get it - so the result is the same data but at 4 times the cost.

  • @MarkRiverbank
    @MarkRiverbank 3 ปีที่แล้ว

    These videos are extremely informative. For the single-channel textures, should you select the "Single Channel" Texture Type, instead of the "Default" type shown? It changes the compression type, but doesn't seem to impact the compressed size.

  • @adamplechaty
    @adamplechaty 3 ปีที่แล้ว

    Is it always desirable to have uniform square textures? For example when making a long road for a racing game, is it better to use 8192x1042 to make the tiling less apparent?

  • @marosis99
    @marosis99 ปีที่แล้ว

    hi ben. i'm thinking about if it's good idea to add height map into alpha channel, bcs it looks like, that alpha channel is actually almost uncompressed. from that i could make normal map wich can save alot of VRAM and use it for other types of materials, but also it will increase increase computation power. the problem is, that i can only use DXT1, 2 and 5 compression and i'm really limited by VRAM. also i'm thinking about that having more smaller textures is better than one big

  • @w0mblemania
    @w0mblemania 11 หลายเดือนก่อน

    You showed how you can set texture size and quality attributes per platform in Unity.
    Does Unreal have this ability?
    Thanks.

  • @binyaminbass
    @binyaminbass 2 ปีที่แล้ว

    This is amazing content! I have two questions: 1) If I have a texture using all four channels for asmr, do I have to do anything special before I drop it into a material slot, or does the game engine (I use unreal) know to use the coorect channel? 2) If I am making cinematics and film, is it ok or even advisable to just ignore compression althogether?

    • @mpbMKE
      @mpbMKE 2 ปีที่แล้ว +1

      In the shader graph, you would just pipe the individual RGBA channel to the appropriate socket. So if your Roughness was in the G channel, you'd pipe G from the texture node to the Roughness socket.

  • @fahimjaowad8717
    @fahimjaowad8717 2 หลายเดือนก่อน

    ShaderGod

  • @DmitryGubkinGhostStudio
    @DmitryGubkinGhostStudio 3 ปีที่แล้ว +1

    thanks, what are "normal" budgets(PC,Consoles) for triangle count and draw calls per frame in modern games (FPS, third person RPG) ?

    • @BenCloward
      @BenCloward  3 ปีที่แล้ว +4

      There isn't one single answer for that question. It depends on a lot of different things. Different game engines have different costs for draw calls and triangles, and different games have different frame rate targets, and of course the different consoles and graphics cards all have their own abilities. In my experience, triangle counts can be between 2-4 million and draw calls can be from 800 - 3000 depending on engine architecture, but your results might be very different. It's best to make a test at the beginning of your project to see how much your engine can push.

    • @DmitryGubkinGhostStudio
      @DmitryGubkinGhostStudio 3 ปีที่แล้ว

      @@BenCloward thank you

  • @adamplechaty
    @adamplechaty 3 ปีที่แล้ว +1

    Thanks for the video! I have two questions: 1. What is the difference between DXT5 and BC7? They are the same size according to the table. 2. Could you set the packed texture either as "masks" or "grayscale" compression and what would that entail.

    • @BenCloward
      @BenCloward  3 ปีที่แล้ว +5

      BC7 is a newer compression format that has less-visible compression artifacts. It supports both 3 and 4 channel textures. It takes longer to compress textures using this format because the compression is more complex to calculate. Masks is a good choice for packed textures.

    • @aukehuys2297
      @aukehuys2297 3 ปีที่แล้ว

      @@BenCloward thanks for making it more clear :)

  • @yingbowang3068
    @yingbowang3068 2 ปีที่แล้ว

    seems UE4 doesn't have the option to change texture size, in texture settings?...

  • @keenanrvndr
    @keenanrvndr 3 ปีที่แล้ว

    Hi mr Ben. In your video about landscape textures, you explained about CR and NOH channrl packing. there you say, untick sRGB for NOH and use BCH7. Well my question is, should i do it also for the CR? Wait a sec, im using TIFF format when saving my CR and NOH. Should i untick or tick the sRGB color profiles?

    • @BenCloward
      @BenCloward  3 ปีที่แล้ว

      sRGB is for color, so it should be on for CR and off for NOH.

    • @keenanrvndr
      @keenanrvndr 3 ปีที่แล้ว +1

      @@BenCloward roger that

  • @calcal472
    @calcal472 3 ปีที่แล้ว

    Hi. Thanks for the tutorials. Is it imported or max in-game size that decides the overall size of the finished game?

    • @aukehuys2297
      @aukehuys2297 3 ปีที่แล้ว +1

      Max In-Game size is relevant for packing games.

    • @calcal472
      @calcal472 3 ปีที่แล้ว

      @@aukehuys2297 Thanks

  • @jenpen3249
    @jenpen3249 3 ปีที่แล้ว

    Would really love an episode on texture sampling. I have no clue whether sampling the same texture twice with different UVs increases the cost or not.

    • @BenCloward
      @BenCloward  3 ปีที่แล้ว

      Thanks for the great question! There are two costs involved here - the amount of texture memory being used, and the amount of time it takes for the graphics hardware to perform the calculations. Sampling a texture twice will increase the amount of time that it takes for the graphics hardware to perform those samples - because it has to do the work of figuring out which pixel on the texture to use two times.
      But it will not increase the amount of texture memory being used because it only has the texture loaded into memory once for all of the time it's used. So it's good to share textures and apply the same texture to lots of different objects - because once that texture is in memory, applying it to many objects in the scene will not increase the memory use.

    • @keenanrvndr
      @keenanrvndr 3 ปีที่แล้ว

      @@BenCloward like triplanar mapping i think? Because it will calculate the different uv from 3 different axes for same texture? Am i wrong?

    • @BenCloward
      @BenCloward  3 ปีที่แล้ว

      Triplanar mapping will sample the texture three times - so it’s a bit more expensive than just normal texturing. But the texture memory used is the same as regular texturing. You’re only storing one texture in memory.

  • @abhinavvarma9882
    @abhinavvarma9882 3 ปีที่แล้ว +2

    Please put some light on mip map settings and texture filtering

    • @BenCloward
      @BenCloward  3 ปีที่แล้ว +1

      Great suggestion, thank you!

  • @ShaderGhost
    @ShaderGhost 2 ปีที่แล้ว

    I have 2 questions:
    1. For the channel-packed texture, why did you use the default (DXT1/5) compression setting instead of Masks (no sRGB)? I thought you'd use masks since they seem like masks. I feel like I've been doing things all wrong this whole time, I've been using the masks compression setting for channel-packed textures. 😱
    2. I remember you once using the blue channel of a normal map as a mask and you also mentioned it in your previous video. What texture compression do you use for this? If the compression is other than Normal Map, Do I need to manually put the texture in -1 to 1 range (i.e. Multiply by 2, Subtract 1) or does UE5 does this for us via the material?

    • @BenCloward
      @BenCloward  2 ปีที่แล้ว

      You're not wrong. Masks is a great setting for that texture. However, if I'm looking at the Format field in the details panel, when I switch the Compression Setting back and forth between Default and Masks, the Format is still DXT5 regardless of which of those I choose. I think Masks may just be a preset that automatically turns off sRGB. It's also possible that, under the hood, it's using a different weighting method for DXT5 so it compresses channel packed masks better, but I don't know that for sure. So yeah, you should use Masks - and I should have mentioned that. Good call.

    • @BenCloward
      @BenCloward  2 ปีที่แล้ว +1

      And yes, if you store other data together with your normal map, you can't use the Normalmap setting. You should use BC7 in that case and then manually adjust the range as you said.

  • @w0mblemania
    @w0mblemania 11 หลายเดือนก่อน

    Question: why does having an alpha channel double the cost in memory?
    Wouldn't it be a 33% increase in memory, over RGB?
    Thanks.

    • @BenCloward
      @BenCloward  11 หลายเดือนก่อน +1

      Storing a 4 channel texture uses a different type of texture compression than storing a 3 channel texture. A 3 channel textures uses dxt1 which has an 8 to 1 compression ratio. But a 4 channel texture uses dxt5, which only has a 4 to 1 ratio. The dxt5 format is basically storing the first three channels as dxt1, and then tacking on the fourth channel as its own thing - and it takes the same amount of space as the first three. So it’s not intuitive - but that’s how it works because of the formats.
      On GPUs, there are two main limitations - texture memory, and render speed. IMO, tender speed is the one that’s more important to address. The game engine can manage the texture memory limitations by swapping things in and out, but with rendering performance, there’s no easy solution. That’s why I recommend packing textures together and using that 4th channel. It does increase memory, but it reduces the overall number of texture samples that are needed, and so it improves rendering performance.

    • @w0mblemania
      @w0mblemania 11 หลายเดือนก่อน

      @@BenCloward Cheers.

  • @Alyson7924
    @Alyson7924 7 หลายเดือนก่อน +1

    Notice game engines won't use compressed textures at runtime. They need them decompressed

  • @nfrancisj2122
    @nfrancisj2122 3 ปีที่แล้ว

    I didn't realize alpha cost so much. Now I'll pack my alphas in a DXT1 and get 3 for the price of 1.

    • @BenCloward
      @BenCloward  3 ปีที่แล้ว +5

      Nice, I'm glad I was able to help you learn something new! When packing textures, there are several considerations. One is texture memory, and another is the total number of textures that you're sampling in the shader. Because each texture you sample is a cost on the GPU as well. So sometimes you have to choose between packing everything into 2 textures with 4 channels, or 3 textures with 3 channels. The 2 textures with four channels uses ~25% more memory, but it's also sampling one less texture. I tend to lean toward sampling fewer textures and using slightly more memory. The nice thing about using the alpha channel is that it receives very little compression artifacts, so if you have a texture that needs to be higher quality - like roughness or height, you can put it there.

    • @nxgentech
      @nxgentech 3 ปีที่แล้ว

      You can alleviate the cost of texture sampling by setting the Sampler Source for the Texture Sample nodes to "Shared: Wrap". It's supported by all major platforms (eg. PC and modern consoles), there are practically no downsides in doing this, so if it works for your use-case you can always use that option by default. It will also allow you to bypass the number of texture samples limit when making complex shaders, for example those that require blending multiple textures, like terrains. AFAIK, the only reason it's not the default setting is to avoid breaking existing materials, but I wouldn't be surprised if that changes in a future UE version, as I've had zero issues doing this so far in my projects. If you are writing custom HLSL code, you can use View.MaterialTextureBilinearWrapedSampler.

    • @BenCloward
      @BenCloward  3 ปีที่แล้ว +1

      @@nxgentech This is somewhat correct but not completely. It depends on what you mean by cost. Turning this setting on does not change the amount of time it takes the graphics hardware to sample a texture. But it does tell the game engine that it is allowed to share and recycle texture samplers. Without this setting on, there is a hardware limit of something like 16 texture samplers that a shader can use and if you hit that limit, the shader just won't compile. But with the setting on, the engine re-uses them and so it's able to do more than 16 samples in a single shader. You're still paying a performance cost for those samples though, so it's always best to figure out how to reduce the overall number of textures you can sample if you can.

  • @nfrancisj2122
    @nfrancisj2122 3 ปีที่แล้ว +3

    ahh....you forgot mips!

    • @BenCloward
      @BenCloward  3 ปีที่แล้ว +2

      You're right - I didn't cover that. Thanks for the reminder. I'll need to touch on that next week. This week's video was already ~30 minutes so I had to leave a couple of things out.

    • @nfrancisj2122
      @nfrancisj2122 3 ปีที่แล้ว +2

      Ben Cloward Can you also talk about Texture Tiling abit in the next one, please? (with a focus on memory and performance) The question is if I have a 256 texture with single brick tiled to make a brick wall, vs a 2K non tiled brick wall texture. Does Tiling increase the cost? Also, what about texture instancing? If I have the same texture used in multiple materials, does Unreal/Unity point to that one texture in memory for all the materials, or does it load a new instance? (I know the answer, but it took me a long time to figure it out. 😂 Since you're making an archive, might something cool to talk about) Thanks Again!

  • @jaddeeb510
    @jaddeeb510 3 ปีที่แล้ว +1

    Godot devs with the 2 dislikes