How To Write Fast Shaders

Поділитися
Вставка
  • Опубліковано 25 чер 2024
  • Shaders performance test:
    docs.google.com/document/d/1-...
    Data Oriented Desing:
    gameprogrammingpatterns.com/d...
    • CppCon 2014: Mike Acto...
    RDR 2 graphics study by Hüseyin:
    imgeself.github.io/posts/2020...
    Sharper Mipmapping using Shader Based Supersampling by Ben Golus:
    / sharper-mipmapping-usi...
    Music:
    Wehrmut by Godmode
    Divider by Chris Zabriskie is licensed under a Creative Commons Attribution 4.0 license. creativecommons.org/licenses/...
    Artist: chriszabriskie.com/
    camerashake_background_music_pt2 by Igor Vaiman
    / igor_vaiman
    Beyond by Patrick Patrikios
    0:00 Intro
    0:56 Data Locality
    02:01 Latency Hiding
    03:02 Context Switch
    03:42 Practical Tips
    04:44 Texture Format
    05:36 MIP-mapping
    06:40 Channel Packing
    07:12 Compute and Shared Memory
    08:42 Blur Example
    10:03 Outro
    #shaders #unity #optimization #programming
  • Наука та технологія

КОМЕНТАРІ • 55

  • @JumpTrajectory
    @JumpTrajectory  2 роки тому +52

    Turns out I completely misused the term cache coherency. Pretend that every time I say "coherency" it's actually "locality". Sorry about that.

    • @xanderlinhares
      @xanderlinhares 2 роки тому +3

      You're certainly not the only one. I've been to many GDC talks where the speaker makes the same mistake which is probably why a lot of us do too.

  • @SebastianLague
    @SebastianLague 2 роки тому +113

    Really nicely done! Would love to see more videos on this topic :)

  • @VictorGordan
    @VictorGordan 2 роки тому +14

    Really impressive production quality! Looking forward to more videos from you :)

  • @nielsbishere
    @nielsbishere 2 роки тому +7

    A few things to add; shared memory is slow on mobile, so be careful when caching texture fetches there, as it might actually cost you. However this is really good on desktop when you have a lot of or big textures in resolution or bpp. Another important thing is that the most efficient group thread count may vary depending on your shader and gpu, so be sure to test on your target device(s) and pick the optimal version (some might want 16x16, some 32x32 for example). Aside from this, be sure that the group size (W*H*L) is dividable by 32 or you lose some perf because of how threads are scheduled.

  • @filipathtc
    @filipathtc 2 роки тому +19

    Insanely well made video! Thank you so much for this! :)

  • @TwistedPresence
    @TwistedPresence 2 роки тому +3

    Excellent video! I've implemented and modified your previous projects (FFT Ocean & Aero Surfaces) in my current project. Your explanations are invaluable! Great stuff!

  • @mastermati773
    @mastermati773 2 роки тому +2

    I haven't seen such quality of a video for a while.

  • @igorvaiman5633
    @igorvaiman5633 2 роки тому +3

    great introduction to the topic with very cool visualization! thanks

  • @ralofpatel470
    @ralofpatel470 2 роки тому +1

    Very informative. Hard to get a video on such a critical topic. Thank you 👍

  • @nikitablack1568
    @nikitablack1568 2 роки тому +1

    Great explanation and visualization. Keep going!

  • @therealsemechki
    @therealsemechki Рік тому +1

    Wow, this was really helpful! I just finished my first compute shader project (marching cubes) and realized there's a way I can save on performance by reducing memory costs! Thanks so much!

  • @ittaimann4580
    @ittaimann4580 2 роки тому

    Excellent video! Definitely a really good description of everything.

  • @DeadlockCode
    @DeadlockCode 2 роки тому

    Your videos never cease to amaze me!

  • @tarck333333rrrr
    @tarck333333rrrr 2 роки тому +1

    Fantastic video! Now waiting for a sequel about subgroup intrinsics and register allocation!

  • @hallowedbythyframe
    @hallowedbythyframe 2 роки тому

    Very good video, subscribed. Would love to see more videos like this.

  • @elden2814
    @elden2814 2 роки тому +2

    Excellent Video! It is so hard to find good resources on shader optomization so it usually boils down to either a.)repeated benchmarking and/or b.)guesswork.

  • @curiouspers
    @curiouspers 2 роки тому

    That's a great video! Thank you, keep up the good work!

  • @robinbosch2931
    @robinbosch2931 Рік тому

    Very nice Video, didnt expect some generall GPU video to be so helpfull.

  • @redsteph
    @redsteph 2 роки тому

    Very well explained. Keep it up!

  • @skippythemagnificent8103
    @skippythemagnificent8103 Рік тому

    That was clear and brilliant many thanks.

  • @in2fractalout
    @in2fractalout Рік тому

    great job. thk u a lot. mostly I loos all the details, but I get the main idea. supercool visualisation makes a sense. great empact! I`will look it some more) that`s what I was lookin 4

  • @kodos_
    @kodos_ 2 роки тому

    Потрясающее видео во всём: от интересности и практичности до качества как визуального, так и "образовательного" с точки зрения подачи информации. Спасибо!

  • @KaletheQuick
    @KaletheQuick 2 роки тому

    I learned a lot, thank you!

  • @bilek993
    @bilek993 2 роки тому

    Amazing video!

  • @GuilherminoBr
    @GuilherminoBr 2 роки тому

    Your channel is underrated

  • @aerialresearchdevelopmenta7871
    @aerialresearchdevelopmenta7871 8 місяців тому

    Would love a more detailed video on your ocean system

  • @Fapret
    @Fapret 2 роки тому

    great video!!

  • @pilogun1454
    @pilogun1454 2 роки тому +1

    Have you thought about doing some more plane stuff?

  • @mxn5132
    @mxn5132 Рік тому

    Would be awesome if you made a version of your IFFT ocean for UE4.27 since it would still work for UE5 with a little tweak but it would support devs with existing projects that are difficult to migrate to a newer engine version.
    A video about quad trees on the Unreal Engine would be highly valued as well.

  • @quinquow
    @quinquow 2 роки тому +1

    Very nice video that helped me understand some things better. Can you elaborate how you misinterpreted the unity manual/how it actually works? And for another question, the resizeable BAR feature newer gpus do, do you know how that can be used for more performance in practice? Is it just better to use certain texture sizes for it?

    • @JumpTrajectory
      @JumpTrajectory  2 роки тому +1

      Desktop GPUs do all floating-point calculations in 32-bit float format, while some mobile or older hardware can do half precision (16-bit) or fixed calculations. Unity manual says just that (however, on very recent GPUs native 16-bit float calcualtions are possible again). This doesn't say anything about textures though, they can have various formats. For some time I thought that they are also converted to 32-bits and all other fancy formats are for mobile. And was wrong!

    • @FredDufresne
      @FredDufresne 2 роки тому

      @@JumpTrajectory So textures are stored in various formats on the GPU but calculations are done in 32bit float right? (ignoring 16bit/int of old hardware)

    • @JumpTrajectory
      @JumpTrajectory  2 роки тому +1

      @@FredDufresne Basically yes! On desktop in HLSL half is just an alias for float. Though I think there is also native int calculations support. Also 16-bit is not only for old hardware, but also for mobile and for newer desktop hardware.

  • @azgan123
    @azgan123 2 роки тому

    Do you ever do game jams? I like your style and would like to join up with you :)

    • @JumpTrajectory
      @JumpTrajectory  2 роки тому

      Occasionally! Took part in all the GMTK ones

  • @jasonzil
    @jasonzil 2 роки тому

    Could you talk about how to dispatch in a group as you show at @9:19? Would you decide the threads to be (8,1,1)?

    • @JumpTrajectory
      @JumpTrajectory  2 роки тому

      Yeah, you could do something like numthreads(im_width, 1, 1), and comuteShader.Dispatch(...., 1, im_height, 1)

  • @5589e5
    @5589e5 2 роки тому

    You've been working on the new water in WoW, haven't you? I'm probably wrong.

  • @icedwater9763
    @icedwater9763 2 роки тому +2

    im only here for sanic O_O

  • @ra1yms0up
    @ra1yms0up 11 місяців тому +1

    Чувак, ты в порядке?

  • @irongarden8415
    @irongarden8415 3 місяці тому

    Привет! Как можно с тобой связаться? Я Tech Artist, и мне интересно ты все ещё разрабатываешь игры? На ИТч ио у тебя много проектов)

    • @JumpTrajectory
      @JumpTrajectory  3 місяці тому

      можно в твиттер написать twitter.com/pensionerov

  • @antonioconte3315
    @antonioconte3315 8 місяців тому

    Почему ты перестал выпускать видео ?

  • @t.a2851
    @t.a2851 2 роки тому

    Subtitles would be very helpful.😀

  • @Kavukamari
    @Kavukamari 9 місяців тому

    gpu hungry need more ops

  • @Maufdiot
    @Maufdiot 2 роки тому

    I need stocks for your channel

  • @iDROIDchannel
    @iDROIDchannel 2 роки тому +1

    Узнаю акцент

    • @milanstevic8424
      @milanstevic8424 2 роки тому

      and? where's the accent from?

    • @JumpTrajectory
      @JumpTrajectory  2 роки тому +1

      @@milanstevic8424 Россия-матушка

    • @milanstevic8424
      @milanstevic8424 2 роки тому

      @@JumpTrajectory for some reason I thought you were Dutch, I don't know why, but yes I can hear it now.
      greetings from Serbia, very nice video.

    • @JumpTrajectory
      @JumpTrajectory  2 роки тому +2

      @@milanstevic8424 Fun fact, youtube auto generated Dutch subtitles for this video, so you are not alone

    • @milanstevic8424
      @milanstevic8424 2 роки тому

      @@JumpTrajectory haha, so that's why I made that assumption. well it managed to completely derail me :)