Shaders 101 - Intro to Shaders

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ต.ค. 2024

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

  • @Oxtorayk
    @Oxtorayk 5 ปีที่แล้ว +113

    1:30 boy, that escalated quickly.

  • @SheepUndefined
    @SheepUndefined 7 ปีที่แล้ว +6

    Last night I found your animation videos, and it helped solve a problem I was having.
    I decided to watch the rest of your vids, since it was high quality and easy to understand.
    While I didn't really pay much attention to the code aspect as I wasn't interested in making them, I ended up with a good knowledge of how they worked, including the little bit about Directional lighting's true workings.
    Now, I've seen in your later videos, what kind of amazing stuff can be done with custom shaders, and I'm rewatching so that I can learn the code, and it's really simple to understand. Your stuff is, imo, better than most of the other unity youtubertorials, and way better than like, the entire official Unity channel.

  • @tonyrigatoni766
    @tonyrigatoni766 6 ปีที่แล้ว +38

    "Shaders are a bottomless pit. There's always going to be more to learn."
    Thanks :)

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

    Hey, I watched this when it came out and didn't really understand it. Then I got to a point in my project where I realized I needed some custom shaders. I went through some tutorials online and got to the point where I could try a dozen things out and wait for one of them to compile to get a sense of what's going on, but I still didn't understand what I was doing. So I went back and watched this and it all makes sense now. All the other online tutorials kind of miss telling you basic stuff, like the fact that v2f is a standard struct that the shader is expecting. I greatly appreciate this video.

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

      Awesome! Glad to hear this video helped. I eventually plan on doing a video that should be even more gentle of an introduction and ramp a little bit slower. Sounds like you're ahead of the curve!
      As for v2f, keep in mind that you can change that struct to better suit your needs and keep your code more legible. I'll often rename that struct to "FragIn" now a days. As well, this video totally doesn't explain things like how many interpolators you can have and what the acceptable semantics are for DX shaders. Those are the sorts of details I wish I had covered better at the time and will revisit in a later series (hopefully).
      Until then, keep on makin' those video games!

  • @shieldgenerator7
    @shieldgenerator7 7 ปีที่แล้ว +28

    Thanks man! I didn't understand a thing in the official Unity tutorials, but this video made so much sense it helped me break into actually making shaders. Thanks for the great tutorial!

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

    I love that you give us small exercises to actually text what we learn. Thanks!

  • @IareZeke
    @IareZeke 8 ปีที่แล้ว +14

    this is one of the best tutorials I've ever watched

  • @LucasSantos-wp7ji
    @LucasSantos-wp7ji 8 ปีที่แล้ว +11

    Thank you for this awesome class! Im totally noob with shaders, but i'm keeping up with this video, it requires stopping, reading documentation, praticingm but in the end i'm learning a lot! Just wanted to give you the feedback, thanks again and please keep doing amazing content like this!

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

      Hey man, it's been 5 years. How's your shaders progress going now?

  • @koberko
    @koberko 8 ปีที่แล้ว +18

    dude! your videos are amazing! keep them coming, because Unity community needs more quality tutorials!

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

    I can't believe it's taken this long for me to finally see a short basic intro that makes sense. Great job!

  • @Giant_Swing
    @Giant_Swing 6 ปีที่แล้ว

    We want shaders 104 please! You're no joke the best person on the internet explaining shaders to noobs, you've made us love you so now you have a responsibility!

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

    So happy to have found this channel. Its brilliant. Excellent job and please keep the videos coming!

  • @iulianradu1869
    @iulianradu1869 4 ปีที่แล้ว

    Awesome short but rich and enlightening explanation. Also thank you Vaguely British fragment guy !

  • @BOLL7708
    @BOLL7708 5 ปีที่แล้ว

    I know this is old now, and I hardly understand anything still, but watching this a few times and picking apart your sample code I could actually make the specific shader I needed. It was harder than I imagined before I started, but easier than I imagined after looking into it 😅 Thanks for this anyway, and code samples are gold because typing what is seen in a YT video can be prone to errors, especially as visual studio doesn't do any kind of code completion or validation for shaders it seems.

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

    GREAT video!!! That's how you make interesting tutorials. Could watch this for hours without getting bored. I would gladly pay for tutorials with this level of quality.

  • @AlbinoGrimby
    @AlbinoGrimby 8 ปีที่แล้ว

    Great explanation on shaders. Most of my knowledge (and this is how dated I am) is fixed function pipeline. I've done a little work in shaders, but watching this tutorial at least gives me a base to start experimenting with on my own.

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

    You asked for comment, here's one: This is good 👍 instructional video.
    Only improvement I can suggest: The ending "homework" part can be delivered slower, and somehow "delineated" with more text. Kind of like when one was given a homework. That would be great!

  • @psinjo
    @psinjo 7 ปีที่แล้ว +4

    i realize i'm late to this series, but i was learning about shaders in class and my teacher recommended i check this series out. I think there's a lot of great info here and look forward to watching the whole series... like 20 times, lol.
    for my 2 cents. i appreciate if people don't swear constantly in instructional videoes. Not because i'm butthurt and feel offended, but i just find it unnecessary and makes the video feel very unprofessional. and you don't get in trouble at school for your computer randomly spouting obsceneties.
    thanks a lot for all of this information!

  • @callmedeno
    @callmedeno 7 ปีที่แล้ว +48

    man your videos are so high quality, best of luck with the channel. do you have any tips for mobile? Like are shaders slower than normal sprite rendering for example? I know there may not be a definitive answer

    • @DanMoranGameDev
      @DanMoranGameDev  7 ปีที่แล้ว +13

      There sort of is a definitive answer: profile everything. You can try to reduce instructions, texture reads and fill rate all you want, but at the end of the day the only real way to determine if your shader code is mobile-optimized is to run it on mobile.
      The iOS tools in XCode are very powerful, giving you gpu times down to the nanosecond for each draw call. This will allow you to see when a particle system or an expensive post processing effect is chewing up precious milliseconds of frame time.

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

      thanks for the reply! Well for example, i was thinking about using the tint shader you mention here and use it on sprites so i can make seperate colored objects with from just one image texture. I wonder if you know on a real simple basis, like would rendering the tinted texture through a simple shader be slower than having a spriterenderer with the images already seperately colored from photoshop. theoretically would you say one is a better way to do it on mobile? like for some reason i have this idea in my head that shaders are 'expensive' and especially new to mobile.

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

      dont worry i am gonna take ur advice and just see if something is slow through profiling, but i just wanted to get a clearer understanding of shaders relating to performance

    • @DanMoranGameDev
      @DanMoranGameDev  7 ปีที่แล้ว +18

      This is actually a great example of what a lot of optimizations boil down to: taking up more gpu time or taking up more memory. Obviously having a bunch of pre-tinted textures would take more memory than having a single grayscale texture, but tinting the grayscale texture dynamically means more frame time!
      Every project's requirements will differ, some teams will opt for higher memory/faster gpu because they have room in ram and are targeting 60fps, others will go the opposite route because memory is the bottleneck.
      Your mileage will vary. Best of luck!

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

      thanks so much

  • @auggodoggo1331
    @auggodoggo1331 7 ปีที่แล้ว

    Hey, I wanted to say thanks for making these tutorials and case studies, each time I watch one i'm like, yea yea, I know about this stuff already, and then you end up unloading a ton of stuff I didn't already know. It's great. I was hoping at some point you'd do a series on lighting in unity, I feel like a lot of people could learn a lot about making appealing lighting including myself.

  •  4 ปีที่แล้ว

    F***! thank you!! this is the most friendly explanation of how shaders works and actually makes you want to know more about it

  • @AlexTuduran
    @AlexTuduran 6 ปีที่แล้ว

    Although I know the topic in-depth, I watched the whole thing just for the presentation style. Nicely done.

  • @DAToft
    @DAToft 7 ปีที่แล้ว

    This video was really great! Nothing too advanced with the theory, but still enough to kind of see what's going on with the code. And you also encourage creativity with the interactive breaks, which I loved! Keep it up :)

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

    OMG ! Thanks man at last some good stuff to learn deep things through this video , i know it's old but quite accurate.

  • @Bemmu
    @Bemmu 7 ปีที่แล้ว +4

    How did you know I was wearing a top hat and a monocle while watching this?

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

    this is exactly what I needed to see and learn. like the basic shit like wtf is all this template code is and why it's here. I'm so relieved. fucking finally

  • @BaronessStrange
    @BaronessStrange 5 ปีที่แล้ว

    you added my favourite study/focus music as background

  • @FistFlameful
    @FistFlameful 4 ปีที่แล้ว

    This is still great tutorial for starting with shaders! I followed along with the exercises and it was really great for learning!

  • @HadynLander
    @HadynLander 7 ปีที่แล้ว

    I stumbled upon this whilst doing some research. I was thinking of putting together a very similar video series - now I don't have to!

  • @AldoV
    @AldoV 7 ปีที่แล้ว

    8 Exercises at end is very helpful ! Thanks!

  • @Rubberglass
    @Rubberglass 5 ปีที่แล้ว

    Yes! Just getting into writing my own shaders! This is perfect.

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

    Somehow everytime you say "v2f", it reminds me of "d2f" from Silicon Valley series.

  • @jbach
    @jbach 7 ปีที่แล้ว +4

    Dan, just brilliant. You should charge for these!

    • @DanMoranGameDev
      @DanMoranGameDev  7 ปีที่แล้ว +16

      Those who wish to support can do so via Patreon but otherwise my stuff will remain entirely free! :D

  • @ashcatchem7206
    @ashcatchem7206 5 ปีที่แล้ว

    my God , now this is a role model of tutorial.. anyway if i may , i recommend you to also add the start scene ( 0:29) so we can try what you code right away. but nonetheless this is already great

  • @ahnmichael1484
    @ahnmichael1484 4 ปีที่แล้ว

    This is an incredibly to the point but accessible but thorough presentation .. how did you manage all of that at onceeee (thank you!)

  • @aFewBitsShort
    @aFewBitsShort 8 ปีที่แล้ว +5

    This is a REALLY helpful video!

  • @kukuriosbrewreviewportal7504
    @kukuriosbrewreviewportal7504 8 ปีที่แล้ว

    I'm just starting to get into coding / unity ... but watched this anyways.
    I'd have to say, you did a great job man.

  • @BingusBongusMan
    @BingusBongusMan 7 ปีที่แล้ว

    Just wanted to say that your video is fantastic!

  • @jacobwilson935
    @jacobwilson935 7 ปีที่แล้ว

    Spend far too long trying to get the tint to work, only to find out that I had transparency set to 0... haha Great tutorial, I hope you still plan on making more!

  • @DuuAlan
    @DuuAlan 7 ปีที่แล้ว

    What a great tutorial, very clear. Thank you man, you are the best.

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

    Amazing Video with simple and begginer friendly tutorial
    🤗

  • @igorpozdeev4352
    @igorpozdeev4352 7 ปีที่แล้ว

    Thnaks for explaining how blend does work!

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

    Amazing work! "Homework" at the end is great idea! :)

  • @behrampatel3563
    @behrampatel3563 8 ปีที่แล้ว

    Quick and clean.Thanks.
    For those who want to understand how the blend equation works google for the Porter & Duff blend mode.
    Give me a shout if it still doesn't make sense.

    • @behrampatel3563
      @behrampatel3563 8 ปีที่แล้ว

      A visual is worth many words:
      page 111 of Google book :Digital compositing for Film & Video.

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

    this explanation is amazing

  • @eeeee2448
    @eeeee2448 7 ปีที่แล้ว

    I would pay for your tutorials , you are a talented teacher should consider it (:

  • @HyperManu
    @HyperManu 7 ปีที่แล้ว +4

    I wanna be a graphics programmer but I dont really know where to start. What should I start reading about, shaders? Opengl? Webgl? Or just start with unity shaders since the ui and stuff can help me understand things better...

    • @DanMoranGameDev
      @DanMoranGameDev  7 ปีที่แล้ว +9

      Unity is an easy place to start and a bit faster than writing your own OpenGL app for working with shaders. There are also things like Shadertoy and Shadron for just getting started experimenting with shaders.
      I haven't got any good book recommendations at the moment, I still need to do more reading myself first. If you've got GDC vault access, there are many great talks on the subject in there worth watching.

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

      Check out the website thebookofshaders. It teaches how to use GLSL shaders from drawing shapes to simulations with interactive code examples.

  • @emrysqwl
    @emrysqwl 6 ปีที่แล้ว

    thx a lot!!!! a good start video to learn about shaders! really make me feel interested in shader!!!!

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

    2021 and fucking invaluable. THANK YOU

  • @harshmudhar96
    @harshmudhar96 4 ปีที่แล้ว

    Hey, just a suggestion. You should try to have some helper text on the screen, especially during code-related sections.

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

    I get an error for the unexpected token "}" even though everything is correct
    EDIT: This is when I tried to make the change for the 'rainbow' look

  • @Hirungolwe
    @Hirungolwe 4 ปีที่แล้ว

    My sprite gets squished for some reason, do you know why?

  • @flashdef
    @flashdef 6 ปีที่แล้ว

    Hi! Awesome tutorial, but I didn't understand couple of things.
    What is UV in this basic shader? I know that UV is a coordinates for 2d texture but i'm interesting in uv.xyzw/uv.rgba. For 1st quad there is no any texture attached. So what are values stored in uv.xyzw/uv.rgba ? Where did they come from? I can't understand how you got gradient for 1st quad, because it means in UV stored some sort of texture where every pixel has different values for r, g and b.

  • @DigitalRoots
    @DigitalRoots 7 ปีที่แล้ว

    In experimenting, I got an error that's confusing me. With the Colored UV Shader, if I enter the following at the end:
    return float4(i.uv.x, i.uv.y, i.uv.z, 1);
    or
    return float4(i.uv.r, i.uv.g, i.uv.b, 1);
    Unity gives me the error "invalid subscript" for the b/z values. If I try putting r, g, x, or y in that spot, it takes that just fine. Why am I not able to use blue or z in this place?

    • @DanMoranGameDev
      @DanMoranGameDev  7 ปีที่แล้ว

      Because uv is defined as a float2. You have to define it as at least a float3 to access the z or b (the third) component.

  • @romanfuhrer8821
    @romanfuhrer8821 8 ปีที่แล้ว

    Nice video! A bit much for one video maybe but still a very cool entry point. What I would need is a shader that adds the tint color to the sprite, so it gets lighter not darker. Is that difficult to achieve? It almost seams as if the last example you mention does something like that.

  • @davidzap
    @davidzap 5 ปีที่แล้ว

    Love this shader tutorials

  • @maksonmuki
    @maksonmuki 7 ปีที่แล้ว

    The 2nd shader won't work unless the sprite (on the sprite renderer) is the same as the Texture on the shader. If not it will just be white. Why?

  • @Spacebar721
    @Spacebar721 8 ปีที่แล้ว

    Is it possible to add outlines/borders on mesh using shaders? Great tutorial btw, looking forward to more of these!

  • @Kelewann
    @Kelewann 6 ปีที่แล้ว

    Thanks a lot, that was very interesting. I have one question, when doing the second shader whit color grading the quad. You say unity interpolate the color of each little fragment between the vertex. But how many fragment does unity generate? Is there a maximum? Can I control the number of fragment? For a practical case, I have a low res input texture that I do not want pixelated, so I would like to slowly interpolate fragment values between each pixel of the input texture. My texture is a planet map intended to fit on a sphere as large as I can (thus my question, is there a maximum).

  • @楊漢軒-x2o
    @楊漢軒-x2o 8 ปีที่แล้ว

    omg what a nice and simple video! keep going man! thanks!

  • @LumpySpoon
    @LumpySpoon 8 ปีที่แล้ว

    Wow dude, you're really good at teaching! You should advertise yourself on unity subreddit, i think you could get a lot of viewers from there.

  • @あれくす
    @あれくす 5 ปีที่แล้ว

    Hello, can you explain how to create a shimmer effect? Such as in bejeweled games or candy crush? I can't find an explanation on how to do this in unity anywhere online. I need it for my dropped items that can be picked up in game as a visual que to the player that you can pick this item up. I'm working with 2D sprites. So it would be for a sprite image. Thank you!

  • @gustavodort5812
    @gustavodort5812 7 ปีที่แล้ว

    That was incredibly helpful!
    I love you

  • @JB-hb1iv
    @JB-hb1iv 6 ปีที่แล้ว

    We need more!

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

    Im new at this, but I thought UV was the texture coordinate space? How come you were able to get color from it (I assume that's rgb values) at 4:24?

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

      They're just numbers! So the uv coordinates range from 0 to 1 for x and y, but we can interpret that as 0 to 1 for red and green instead. Also note colors in shader are expressed as decimals ranging 0 to 1 and not integers from 0 to 255.

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

      I see. I was just confused since I thought UV was (x,y,z,a) and I thought that's all you can get from the uv variable you passed in.
      But apparently it has r,g,b as well (4:22)? I guess I have to experiment myself and see what values are inside these structures.

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

      I figured it out, this is what made me confused, in this video you have:
      float color = float4(i.uv.r, i.uv.g, 0,1);
      but in shaders 102 it's changed to:
      float color = float4(i.uv.x, i.uv.y, 0,1);

    • @DanMoranGameDev
      @DanMoranGameDev  8 ปีที่แล้ว +5

      Yeah I mentioned that in a comment elsewhere. They are called "Swizzles". rgba and xyzw are interchangeable. You usually just use the color swizzles when talking about a color, and the coordinates when talking about a coordinate.

    • @yelgabs
      @yelgabs 8 ปีที่แล้ว +4

      Finally a term I could google. Thanks so much!

  • @leonardsolen8144
    @leonardsolen8144 6 ปีที่แล้ว

    Awesome video, but i have one question. I'm trying to use this in my game, but i do not want it to glow through walls. Is it possible to change so that they do not glow through walls?

  • @thorham1346
    @thorham1346 7 ปีที่แล้ว

    How to explain things in a simple way. Great 8^)

  • @Huguillon
    @Huguillon 5 ปีที่แล้ว

    It's my first video I see on your channel and I'm trying to understand why you needed to curse in your previous TUTORIAL videos. :P haha

  • @starogre
    @starogre 7 ปีที่แล้ว

    does this shader code translate to webgl shaders? for browser games

  • @kogi04
    @kogi04 7 ปีที่แล้ว

    These vidoes are great! Well done.

  • @DHREAVER
    @DHREAVER 8 ปีที่แล้ว

    I'm getting a problem I can't seem to fix, following the video just fine until the texture shader section. Now my material preview shows me a pusheen with all of the weird lines around it, as expected. but when I apply it to a square sprite (just a sprite of a white square) in the scene it stays white and doesn't apply the pusheen texture like yours in the video. I've gone back and copied your exact shader code from Simple Texture to rule out typos, and it's still doing it.
    I've just tested something else, if I change the initial square to a different colour it is staying white while the material is attached. So something isn't being read correctly and it's defaulting to the white texture specified in the shader properties? Any idea why this might be?

    • @DHREAVER
      @DHREAVER 8 ปีที่แล้ว

      No wait, it's not that either. I just changed the properties line to _MainTex("Texture", 2D) = "red" {}
      and it's still showing as white when I apply it.
      So I have a red sprite, with a material on it that previews as red (by default) or pusheen using exactly your shader code and it's displaying white...

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

      Alright nevermind, it's because I was using a sprite instead of a quad. Applied to a quad this works fine. Phew.

  • @scottcabot2803
    @scottcabot2803 8 ปีที่แล้ว

    I had an error when setting up the Texture in Unity 5.2.2 I had to use the line:
    _MainTex ("Texture", 2D) = "white" {}
    Note the additional of the curly braces at the end. Not sure why but other shader examples I looked at had this and it fixed my parsing error.

  • @Seanmcfarlane115
    @Seanmcfarlane115 7 ปีที่แล้ว

    Can someone explain to me what the colons do? And what language these shaders are written/where I can learn the syntax? Thanks.

    • @Seanmcfarlane115
      @Seanmcfarlane115 7 ปีที่แล้ว

      Never mind, I found what I was looking for in the second link of the description.

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

    return float4(i.uv.r, i.uv.g, 1, 1);
    its also giving same "blue pink" result!

  • @cayetanoordonez2072
    @cayetanoordonez2072 8 ปีที่แล้ว

    Awesome, thank you for sharing this.

  • @V1TOCHIN
    @V1TOCHIN 7 ปีที่แล้ว

    amazing. I guess it couldnt hurt to ask if you could handle something like a system which has one sprite overlapping another, where one is the colors which you can change, and the other one is the lines and shade. (like a multiply layer effect). (skullgirls uses a system like this with another layer for lines)

  • @EvilRobin1
    @EvilRobin1 7 ปีที่แล้ว

    Wow! Love this channel!

  • @brainbigbig2282
    @brainbigbig2282 7 ปีที่แล้ว

    excellent teacher ever!

  • @plasmatch8
    @plasmatch8 6 ปีที่แล้ว

    I am using Unity 2018.2pre and it seems that if we name of the texture parameter as _MainTex, the rendered texture ON CUBES looks like a fine mist of particles - This was solved by changing its name to _FirstTex, and it works fine on all objects.

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

    Don't know if you still read these, but how do you interpolate between two textures using a slider? I don't feel like this video gave me the information I needed to figure it out honestly, as a complete beginner

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

      Nevermind, I did some outside research and I learned that you simply lerp between the two textures, literally. I thought there would be more to it than that. My fragment function ended up looking like this if anyone else is stuck
      fixed4 frag (v2f i) : SV_Target
      {
      float4 tex1 = tex2D(_MainTex, i.uv);
      float4 tex2 = tex2D(_SecondTex, i.uv);
      float4 lerpedTex = lerp(tex1, tex2, _Tween);
      return lerpedTex;
      }

    • @DanMoranGameDev
      @DanMoranGameDev  7 ปีที่แล้ว

      Well done! Yeha I haven't hear that this video isn't quite "101" enough. One day I may revisit the intro to shaders video and expand on some basics even more. Working out solutions on your own like you've done though, is an awesome way to learn!

    • @morganlak4337
      @morganlak4337 7 ปีที่แล้ว

      I don't know if I'd commit to saying this video isn't 101 enough it's just that this stuff is hard and learning is hard lol. This is a great resource and your channel as a whole is fantastic

    • @Kramlets
      @Kramlets 6 ปีที่แล้ว

      I know this is an old comment, though I managed it without lerp, so it's definitely possible.
      float4 frag(v2f i) : SV_Target
      {
      float4 color1 = tex2D(_MainTex, i.uv);
      float4 color2 = tex2D(_SecondTex, i.uv);
      color1 *= (1, 1, 1, 1 - _Tween);
      color2 *= (1, 1, 1, _Tween);
      float4 color = color1 + color2;
      return color;
      }

  • @halvedbagel5827
    @halvedbagel5827 7 ปีที่แล้ว

    omg I'm learning so much!
    thank you for making these videos!
    just a general question,
    where are some common usage of grayscale sprites in games?
    I can only think of character death.

  • @antonkalinin7399
    @antonkalinin7399 5 ปีที่แล้ว

    Thx, bro! Please, return with new videos!!!

  • @connorforce01
    @connorforce01 7 ปีที่แล้ว

    So how do I make it look like System Shock 2?

  • @Arkogelul
    @Arkogelul 7 ปีที่แล้ว

    Thanks a ton for that video and the examples ! :)

  • @ninjachimpstudios
    @ninjachimpstudios 7 ปีที่แล้ว

    I still don't really understand shaders, but at least I'm slightly less afraid of them now. Thanks!

  • @stormcaster6322
    @stormcaster6322 5 ปีที่แล้ว

    where to see your video on particles 101?

  • @RsDonuts
    @RsDonuts 8 ปีที่แล้ว

    So cool!

  • @tl3119
    @tl3119 4 ปีที่แล้ว

    Thx for this great tutorial!

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

    THANK YOU!!!!! Subbed, shared, and faved.

  • @phanduyloc206
    @phanduyloc206 7 ปีที่แล้ว

    Greet, good man, I love you

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

    You explain very well. Where did you go to school?

  • @AmNothi
    @AmNothi 4 ปีที่แล้ว

    really great

  • @fille.imgnry
    @fille.imgnry 8 ปีที่แล้ว

    Great stuff

  • @callmedeno
    @callmedeno 7 ปีที่แล้ว

    did you do this on a flat quad and not a sprite? Im tryin it on a sprite and it aint comin out right

    • @DanMoranGameDev
      @DanMoranGameDev  7 ปีที่แล้ว

      This was all on a quad (a MeshRenderer). A SpriteRenderer may be a more complex shaped mesh depending on import settings. It also will automatically use a Sprite Shader. This video was more about showing how you might make sprites if you didn't have the SpriteRenderer class as a way of teaching some intro stuff.

    • @callmedeno
      @callmedeno 7 ปีที่แล้ว

      okay. i did manage to get it working for sprite renderer too. i use this to get the texture coordinate and fill it with a specified color:
      float4 color = (tex2D(_MainTex, i.uv) * float4(0,0,0,1)) + _Color;
      does that look wierd? it works but if the alpha of _Color is 1, it makes a mess. but when its zero (adding no alpha in the color) it works.

  • @benmiller5551
    @benmiller5551 7 ปีที่แล้ว

    hey thanks for the tutorial. When I run your code multiplying the UV's by 2 to create the tiled effect I am having problems with the alpha. It is using the alpha from the original image so the 4 tiles are created but only visible in the areas not alpha'd in the original image. Any suggestions?

    • @DanMoranGameDev
      @DanMoranGameDev  7 ปีที่แล้ว

      Are you explicitly sampling the texture twice? That's really the only way I can think of that would produce that effect. If you mean you are just seeing a single image in the top bottom left, it may be that your texture is set to "Clamp" in its import settings as opposed to "Repeat". Feel free to share a hastebin link to the relevant section of your shader code!

    • @benmiller5551
      @benmiller5551 7 ปีที่แล้ว

      I found the fix, I had my texture type set to "Tight" rather then "Full Rect". This fixed the problem. Thanks again for the videos

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

      Ahh I see. That means you are working with the Sprite Renderer instead of a Mesh Renderer and quad (that's what I used in the video if I remember correctly)!
      That option would produce visuals as if the alpha was from the un-tiled sprite, but it is actually a different mesh entirely! If you press the "Shaded" button in the top left corner of the scene view, you can toggle it to Wireframe and see the difference that option makes to the underlying mesh.
      Glad you were able to figure out the solution. I will remember this for future FAQs, thanks!

  • @glitchdilemma4200
    @glitchdilemma4200 7 ปีที่แล้ว

    you are the best sir !!!!

  • @Siausalas
    @Siausalas 8 ปีที่แล้ว

    Dude, You're awesome!

  • @TheRationalOpinion
    @TheRationalOpinion 8 ปีที่แล้ว

    How does (v2f i) affect frag on line 32? What does i actually mean?
    Same goes for (appdata v) on line 23.

    • @DanMoranGameDev
      @DanMoranGameDev  8 ปีที่แล้ว

      It's just the parameter of the function, and they are the structs defined above that determine what info we receive from the mesh, and what we pass along from the vert to the frag. See: docs.unity3d.com/Manual/SL-VertexProgramInputs.html for more information on the types of data that can be in those structs.

    • @TheRationalOpinion
      @TheRationalOpinion 8 ปีที่แล้ว

      Makin' Stuff Look Good Thanks for the quick response! I found your Hearthstone case study last night and started binge watching your videos. You're a phenomenal teacher, and you can really notice how much effort you're putting into these videos!

  • @DHREAVER
    @DHREAVER 8 ปีที่แล้ว

    On the third exercise, with the linear interpolation I get the strange lines appearing around my 2 sprites, like so: postimg.org/image/a4i11n6if/
    any fix for this?

    • @DanMoranGameDev
      @DanMoranGameDev  8 ปีที่แล้ว

      That's just what it looks like. You are interpolating the sprites color values, the color values at the edges of the sprite extend to the edges of the texture. All the areas of the texture where the alpha value is zero happen to have color values that make those lines.

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

    Great explanation ☺