How To Write Fast Shaders

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ก.ค. 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 ปีที่แล้ว +54

    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 ปีที่แล้ว +115

    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!

  • @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 👍

  • @therealsemechki
    @therealsemechki 2 ปีที่แล้ว +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!

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

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

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

    Great explanation and visualization. Keep going!

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

    Excellent video! Definitely a really good description of everything.

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

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

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

    Your videos never cease to amaze me!

  • @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.

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

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

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

    Very well explained. Keep it up!

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

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

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

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

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

    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

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

    That was clear and brilliant many thanks.

  • @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.

  • @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.

  • @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

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

    im only here for sanic O_O

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

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

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

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

  • @t.a2851
    @t.a2851 2 ปีที่แล้ว +1

    Subtitles would be very helpful.😀

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

    gpu hungry need more ops

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

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

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

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

  • @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 ปีที่แล้ว +3

      @@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 :)