Remaking LOOP HERO's CRT Effect

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ก.ค. 2024
  • In this shader case study we analyze and recreate the CRT effect from Loop Hero. CRT Shaders are an effective way to add a nostalgic feel to your pixel art and should be part of any technical artist's visual library.
    Support me on Patreon!
    / acerola_t
    Twitter: / acerola_t
    Twitch: / acerola_t
    Code: github.com/GarrettGunnell/CRT...
    Join My Discord Server! / discord
    Music:
    Empty Ocean - Loop Hero OST
    During The Test - Persona 3 OST
    Afternoon Break - Persona 3 OST
    Thanks for watching!
    This video is dedicated to my friend, Alotryx.
    #acerola #gamedev #graphics #unity #unity3d #madewithunity #indiedev #unity2d #tutorial #shader
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @DanIel-fl1vc
    @DanIel-fl1vc ปีที่แล้ว +68

    I do not understand why seemingly every single adult programmer I've ever encountered on the internet has a picture of a tiny toddler anime girl as an avatar or randomly pop into their youtube tutorials. 6:42 The pattern is too common, there's some connection. Maybe when they were kids they were obsessed with pokemon and naruto and the anime girls on screen were their first love and that love never went away as they grew older or something. Because it freaks me out every time I see it, it's like someone pulling their pants down for a split second in the video revealing their darkest desire and I'm like woah what the hell. Besides that, the programming is interesting.

    • @Acerola_t
      @Acerola_t  ปีที่แล้ว +230

      I think you're the weird one here actually

    • @DanIel-fl1vc
      @DanIel-fl1vc ปีที่แล้ว +13

      @@Acerola_t Maybe on programming discord channels and inside of FF14 it's considered normal. But trust me, you walk down the street in the real world, enter a construction site with a bag full of toddler pictures, they'll look at you weird.
      And if they're pictures of cartoon children, they'll be even more confused. Don't you like Frank Frazetta, Tolkien, you know adult stuff. There's something about hardcore programmers, and I'm not only referring to you. Most of you seem to be running the same software.
      Maybe if we force feed young males squeaky anime toddler girl entertainment for breakfast they'll grow up to become capable programmers.

    • @Acerola_t
      @Acerola_t  ปีที่แล้ว +143

      @@DanIel-fl1vc no no I still think you're the weird one here

    • @DanIel-fl1vc
      @DanIel-fl1vc ปีที่แล้ว +7

      @@Acerola_t Yeah maybe I'm weird "here". Clearly most wanna be game developers are into my little pony tier toddler entertainment.
      I think it's just a generation of sheltered boys that got stuck in middle school. When all the other kids were out going through rites of passage they sat at home with cartoony video games and movies.
      These things later fueled their interest in programming and still does. It's their standard of the greatest art imaginable. Which is why they're blind when it comes to how others perceive their interest of what's CLEARLY cartoons of children.
      Flashing a picture of Disney's Tarzan would still be weird but at least it's a badass guy fighting leopards, music's alright too. But a three year old child...
      Hopefully you'll slowly ease off of it, I can't imagine it's healthy to have such proclivities. Especially when you grow older into your 50s and beyond.

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

      ahah xD what a load of bs.. "..Disney's Tarzan.." nice, so Tony the tiger is fine.. wont be surprised if his son has a 3k$ cartoon dog suit. hilarious xD

  • @chrisminnoy3637
    @chrisminnoy3637 ปีที่แล้ว +50

    The most important CRT effect was not the curvature or the metal grid, but the glow and blend effect of the phosphor layer. A single pixel would not be sharp as with LCD, but start as a round dot on the left side and have a smear on the right side due to the falling voltage of the electronbeam. This effect makes that near pixels blend into each other, making a smooth look. Pixel artists used this effect to show gradient effects of many colours, while in reality the colour palette was very limited on those early machines. One had to take into account the beam direction (always from left to right) and the horizontal frequency into account to reproduce that effect on an LCD/OLED screen Not sure what the math would look like, but it can't be that hard to figure out.

    • @Sibula
      @Sibula 4 หลายเดือนก่อน +5

      Yeah, especially for a pixel art game with low resolution and small color palette the smoothing effect was incredibly important. If you play any old game like that on a modern display it looks like crap.

    • @T0K0R1.N
      @T0K0R1.N หลายเดือนก่อน

      The game Fight n rage I think actually does this round smearing effect on it's CRT effects shader and it looks amazing, would love to see @Acerola take a look at that game.

  • @ethanbelton9522
    @ethanbelton9522 ปีที่แล้ว +51

    I like this type of video. I want to see more of it. Maybe you can show more of the coding side so us dummies who just started learning C++ can get a better grasp on how the math correlates.

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

      There is zero c++ involved. I suggest reading the Book of Shaders articles online, this effect is super simple once you understand the basics of fragment shaders.

  • @cheesycoke
    @cheesycoke ปีที่แล้ว +68

    I personally wish more CRT shaders for games would emulate the color blending of old analog video signals, though I do kinda get why they don't between the way it may mess with certain visuals, the difficulties, and how much it might hurt performance.

    • @Roxor128
      @Roxor128 ปีที่แล้ว +20

      I actually wrote a shader that reproduced the artefacts of the PAL TV system. It basically implemented the whole system on a small snippet for each pixel. Encoded the input, optionally added noise, then decoded it again. I have no illusions about it being fast, but it worked. Turning on the noise was just awful for performance.

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

      I was literally just going to write a comment about that

    • @Sibula
      @Sibula 4 หลายเดือนก่อน +1

      @@Roxor128 At least if you just want to make old games look right again, performance isn't really much of a concern, unless your shader takes more time per frame than the game did back in the day. If you want to recreate the effect in a modern game with modern standards for frame rate and resolution, then it might be something to consider.

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

    honestly such a good video, i could say a lot but i'll keep it brief: i want to see more!

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

      Thanks Grochlin ;; need to stop by and see your progress on your racing game soon

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

    Nice one 👍 Thanks for supplying the source code

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

      No problem! I try to supply the source code for all my vids, even if it isn't written for general use.

  • @Matojeje
    @Matojeje ปีที่แล้ว +121

    Nice recreation! That being said, I still don't understand why one wouldn't want to warp the scanlines, is it to prevent some funky moire patterns or something?

    • @Acerola_t
      @Acerola_t  ปีที่แล้ว +58

      Probably something like that yeah, I didn't actually try to see what warping the scanlines would look like.

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

      🤔

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

      I converted this effect into Shadertoy just to experiment around with it a little and I think the reason they didn't warp the scanlines is because the scanlines warp the 'wrong' way with this effect. The middle parts of the lines warp towards the middle of the screen instead of away from it as they would with an actual CRT. The effect is pretty subtle at low amounts of warp anyway, but I suppose straight across means they're closer to how they should be for a CRT than if they were slightly warped the wrong direction.

    • @terryriley6410
      @terryriley6410 11 หลายเดือนก่อน +4

      ​@@dranythYou could implement a different warp. Scanlines make more sense when they are warped too and they look better as well.

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

    You deserve way more subscribers ! Looking forward for more content :D

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

    Very cool video. I was seeing how far I could follow along with just the video but then got stumped why my image wasn't warped but just kind of scaled down. Then I looked at your code link and saw that to calculate the offset you swap the X and Y components of the UV before dividing ( uv.yx / _Curvature;) which I didn't realize from 2:02 . I was then able to adapt this to Godot. Thanks!

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

    Very good. The effect has a good vibe.

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

    Really good work, man. I'm impressed :)

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

    Just found your channel, holy shit your content is so nice. It's the right mix of math, funny jokes and explanation.

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

    I've been enjoying these videos

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

    incredibly underrated channel, inspiring work as well. you make it all seem doable unlike most game making related content

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

    good video! keep up the good work!

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

    this is exactly the info i needed

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

    I really like your videos, you explain all this display math so well!

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

    Very interesting!

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

    This is brilliant

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

    Awesome video

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

    I like these types of case study videos. I have let you know. - in an acerola voice cadence.

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

    i like this kind of case style video, so i am letting you know

  • @wide-awake
    @wide-awake ปีที่แล้ว +4

    very cool. i've heard that some CRT shaders (notably crt-royale) go much further into actually emulating the physics of a CRT when generating their image. that could make for a cool video!

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

    Super! please make more

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

    I'm gonna call it here. I've been recommended quite a few of your videos and in the past few days have seen your subscriber count grow from 5k to 7.5k. I believe you have been blessed by the TH-cam algorithm gods. We will watch your career with great interest.gif

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

      It's been pretty crazy yeah, thanks for watching!

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

      @@Acerola_t dude, thanks for the amazing content!

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

    yay "new" acerola video

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

    Love it when you suddenly stumble upon one of those "creator who makes great content and cares about it" channels

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

    i m not understading anything about sin ad shit but i m still watching this, it's interesting :D

  • @__Rizzler__
    @__Rizzler__ 7 หลายเดือนก่อน

    i love case study. gimme all of it

  • @Caiiiiiiiiii
    @Caiiiiiiiiii 9 หลายเดือนก่อน

    Damn, how did he know I’m watching this in the future

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

    Thank you very much for your sharing!
    I want to get a closer understanding of "cubic function" (I have searched this but still don't understand why the value can be calculated by uv+offset*uv*uv as in the example code).
    Is there any link or article about this?

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

    I'm sure it was asked before but are those title-cards inspired by the Monogatari series? I've been binging your videos at I felt similar so I had to ask. Also thanks for the video :)

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

      Yeah it's my favorite show

  • @graph-gear500
    @graph-gear500 9 หลายเดือนก่อน +1

    Hey Acerola, have you played Signalis? I think it's worth looking into as it has a lot of cool shaders and effects that might interest you. It also has a CRT effect.

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

    I think it'd be super interesting if you did this same thing with the trippy background patterns in Balatro

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

    muito bom o vídeo valeu

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

    more video as this one pls.

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

      If you have any game effects you'd like to see recreated let me know!

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

    Finally, someone who knows what this game is

  • @Kestrel_
    @Kestrel_ 5 หลายเดือนก่อน

    hey! thank you for this video! this is exactly what i would like to use for my upcoming game! however, i have a question i was hoping you could answer. in my case, im looking for a more pronounced effect, however im worried about the distortion making it hard to click buttons closer the the corners. do you know how to map the mouses position to the rounded crt effect?

  • @niekjonker
    @niekjonker 10 หลายเดือนก่อน

    Hey Acerola,
    I'm using your shader and inverting the effect on the X axis to create kind of a helmet curvature. How do I ensure the mouse position for all elements in my straight UI properly maps to the new projection?
    I exposed the two values in uv + uv * offset * offset. I'm getting good visual results by doing UV * UV * 0.6 * 0.5. Is this causing my problems with rayvasting?

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

    Omg Alpha Centauri spotted

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

    please study more cases. k thx

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

    Just... How did you realize that they were using cos with sin here 6:22 ?
    (awesome channel, i'm watching all your videos lol)

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

      cause they oscillate in opposite directions
      thanks for watching!

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

      @@Acerola_t Oh, nice nice thx

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

    Texture samplers have a parameter that tells them how to sample the texture outside the [0,1]² range, so having a branch to return black when you're outside that range is unnecessarily expensive, as long as you can set that parameter.
    Sadly I'm using a lisp library to do this kinda stuff, so I don't know how you'd do it in C#, but I think looking for something like CLAMP_TO_BORDER should give you relevant results.

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

      Maybe can use like this to avoid the branch:
      ```
      half isBlack = uv.x = 1.0f || uv.y = 1.0f;
      color = color * (1 - isBlack); // if (isBlack) color = 0;
      ```

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

      I honestly have a lot of questions about that, but I wonder if it really has any practical effects. We don’t have branch prediction, and assuming that jumping to sampler instead of jumping over one instruction is quicker; disregarding the fact that seemingly for the sampler to actually have the same check is the only possible way it works, sounds quite controversial to me. I have a feeling that branching avoidance became a cargo cult. Though the comment above has a good idea anyway.

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

    This is definitely a tiny nitpick but I feel if you're gonna do a CRT effect, the aspect ratio shouldn't be 16:9.
    Either way, great video, if you do a follow up, definitely add that high-frequency hum that you can feel in the back of your skull!

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

      lol the shader will work the same regardless of aspect ratio so no need to worry

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

      @@Acerola_t, yeah, fair

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

    Has anyone got this to work in URP?

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

    Honestly, the grayscale every six lines looks better, imo

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

    I use a pancake recipe from the same website that the chocolate chip cookies recipe. funny

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

    What about the filters and effects options in Blasphemous?

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

      I can check that out yeah

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

      @@Acerola_t sweet! Thanks!

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

    any chance a ctr effect like that would be able for obs?
    i can't make it my self but asking won't hurt =w=

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

      yeah you can write obs plugins that apply shaders to the output, maybe someday I'll do it but at least you know it's possible!

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

      @@Acerola_t hehe glad to hear that~
      And if ya someday would do it I'll be sure to be the first to jump ya~

  • @copycatlyn
    @copycatlyn 9 หลายเดือนก่อน

    so now how do this photoshop?

    • @Acerola_t
      @Acerola_t  9 หลายเดือนก่อน

      the best way to do it in photoshop would be to follow the same steps just with photoshop tooling to warp the edges and there's probably a crt filter for photoshop somewhere.

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

    Is the background track from Breath of Fire 3?

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

      Nope it's probably the one from Loop Hero

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

      @@Acerola_t wrong! the first song thats played is loop hero, but Im 99.99% sure the song looping afterwards is from breath of fire 3.
      btw I hate writing shaders but love your videos, perfect mix of comedy and information

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

      @@caelrowley8001 I can assure you it's not breath of fire 3, all the music used is listed in the description.
      Also thanks!

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

      @@Acerola_t I stand corrected, the song that was confusing me was During the Test

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

    any chance you could translate this into shader graph?

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

      no I only write shader code I am not proficient in shader graph, sorry!

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

    sin and cos for a 3-pixel pattern? Why not just use a 1x3 pixel texture?

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

      because sampling a texture would be more expensive than computing a wave.

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

    I was hoping for a Critical Race Theory effect! Still an awesome video

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

    n n no you can't just understand everything like that 😟

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

    How the FUCK did you just casually go "oh that must be a sinewave" and other things like that‽

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

      trig functions are oscillators so when values are going back and forth it's probably a trig function

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

      @@Acerola_t Thank you, that sounds so obvious said aloud

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

    When adjusting the frequency of the sin wave, did I miss where we multiply by pi? (sin(uv.y * screenHeight * 2 * pi/3)) It would make sense to gloss over IMO, but I want to check theres no extra magic going on! love your videos

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

      I didn't multiply by pi

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

      @@Acerola_t oh ok, now I am confused! I'll have to look closer at the video. Since Sin(x) is periodic over 2pi, I would except the horizontal lines to "drift" and maybe lose definition every 30 pixels. Perhaps it's too small of an effect to notice, or just blends in nicely

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

      Remember the part of the video where he discovers that the pattern seems to repeat once every 6 lines and "fixes" it by increasing the frequency by a factor of 2 to get a period of 3?
      Obviously, he is applying the common technique of shader programming that is to ignore the math and do measurements by eye, and by those rules, you clearly get pi=3 and therefore any multiplication by pi becomes unnecessary.

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

      @@kappascopezz5122 truth!! in the end it doesn't matter if you can't notice it even upon close inspection.