Adding Realistic Shadows to my 3D Python Game

Поделиться
HTML-код
  • Опубликовано: 5 июн 2024
  • Check out brilliant.org/DaFluffyPotato/ to start your free 30 day trial of Brilliant and receive 20% off a premium subscription.
    The most important feature in Minecraft shaders are the dynamic shadows. While I was working on a game engine for a future project of mine, I decided to take a quick stop to create Minecraft along with some fancy shadowmapping shaders using Python, Pygame, and ModernGL.
    Wishlist Yawnoc:
    store.steampowered.com/app/28...
    Learning resources for shadowmapping:
    learnopengl.com/Advanced-Ligh...
    My Discord:
    / discord
    Support Me (and get source code for the project in this video):
    / dafluffypotato
    / @dafluffypotato
    My Website (links to games):
    dafluffypotato.com
    Special thanks to my Potato Tier Patrons:
    Agent Effe
    Damion
    Eivind Teig
    f0ursqu4r3
    Levi Jeske
    Rethanon
    Sam Cork
    Szabolcs Dombi
    tbf135
    Timestamps:
    0:00 - shadows are key
    0:50 - why
    1:08 - world generation
    1:42 - a simple concept
    2:19 - what's a shader?
    3:52 - depth buffers
    4:12 - implementation
    6:05 - polishing the shadows
    7:03 - final thoughts
    #gamedev #pygame #python
  • НаукаНаука

Комментарии • 77

  • @DaFluffyPotato
    @DaFluffyPotato  28 дней назад +22

    To be clear, I meant that the concept behind shadowmapping is easy to understand, but coding it is more difficult (which is why I said "the implementation takes more thought").
    If you're interested in implementing shadowmapping yourself, LearnOpenGL.com has a good tutorial:
    learnopengl.com/Advanced-Lighting/Shadows/Shadow-Mapping
    Also, wishlist Yawnoc: store.steampowered.com/app/2824730/Yawnoc :)

  • @BentoSushi1
    @BentoSushi1 28 дней назад +75

    DaFluffyPotato: Ahh yes its pretty easy anyone can understand
    Proceeds to pull up the code to the matrix

    • @DaFluffyPotato
      @DaFluffyPotato  28 дней назад +15

      The code for this one is quite complex, but the shadowmapping concept itself is rather simple.

    • @BentoSushi1
      @BentoSushi1 28 дней назад +10

      @@DaFluffyPotato ahhh yes shadowmapping mhm
      ----
      *Frantically grabs dictionary*

    • @zellenny1784
      @zellenny1784 28 дней назад +5

      ​@@BentoSushi1 LMAO imagine not knowing that haha
      panics cus cant find definition for 'depth buffer'

    • @nmflash8
      @nmflash8 27 дней назад +3

      someone who doesn't have a good grasp on coding will tell you what they are learning is complex and difficult, I often find the smarted developers will say what they are doing is simple and easy, you just have to learn the right languages and tools.

    • @DaFluffyPotato
      @DaFluffyPotato  27 дней назад +5

      When I say the concept, I specifically mean the idea of comparing what the player sees to what the light sees. At the top level, it's very simple. It just gets more complicated as you break it down (depth buffers, transformation matrices, framebuffers, etc.).

  • @thatChipmunk02
    @thatChipmunk02 28 дней назад +73

    I'm supposed to be doing homework, stop making good videos!

    • @mizokalabizo418
      @mizokalabizo418 28 дней назад +1

      same, but I cant resist

    • @Robin270
      @Robin270 26 дней назад +1

      I need to get distracted from my problems, continue making good videos 😂

  • @plvr_strg
    @plvr_strg 28 дней назад +8

    Man, I think you've become so experienced dev you got "the curse of knowledge" cognitive bias, cause this is not easy.

    • @DaFluffyPotato
      @DaFluffyPotato  28 дней назад +3

      The code isn't, but the concept is. I was referring to the concept.

  • @therealbfg123
    @therealbfg123 28 дней назад +37

    AYOOOOO, YOU GOT A FUCKING SPONSOR!! LETS GOOOOOOOOOOOOOO

  • @theattic0098
    @theattic0098 28 дней назад +7

    I can't believe I caught this so fast. I love graphics programming.

  • @theyummydogo
    @theyummydogo 27 дней назад +1

    Voxel engines with teeny tiny voxels that have a color rather than a texture and use high definition scans of real world places must the coolest applications of voxel rendering.

  • @costelinha1867
    @costelinha1867 25 дней назад +1

    FluffyPotato showcasing his projects while also desperately trying not to come across as just flexing.

  • @Trojan073
    @Trojan073 28 дней назад +2

    Any video that aims to make a Minecraft style game is a banger tbh

  • @stoppls1709
    @stoppls1709 28 дней назад +1

    Congrats on the brilliant sponsor, love the tutorials

  • @ceopotato5712
    @ceopotato5712 28 дней назад +3

    bros brain is bigger than my head

  • @noTmeDev
    @noTmeDev 28 дней назад +3

    Bro is cooking as always

  • @Overlycomplicatedswede
    @Overlycomplicatedswede 23 дня назад

    My dude finally getting sponsors and pulling in the big money 🗣️ congrats

  • @mkdoz
    @mkdoz 28 дней назад +3

    this was very fun to watch :)

  • @3ler4never
    @3ler4never 28 дней назад +1

    You should do a tutorial series, and show off everything you can make. This stuff is cool

  • @LoggyDev
    @LoggyDev 18 дней назад

    Bro, i love your worth ethic so much.

  • @cinnamon3556
    @cinnamon3556 28 дней назад +1

    i cant begin to understand how youre doing this in python, its amazing, great job

  • @protosevn
    @protosevn 27 дней назад +1

    Next time someone says you can only make games with C/C++ or that interpreted languages are too slow I'll just link them this, excellent job!

    • @atiedebee1020
      @atiedebee1020 26 дней назад +1

      The problem starts when you start doing things that are even slightly more CPU dependent. Just like you wouldnt decode audio using python, its a lot slower to do things like chunk generation with it.
      Although i am sure most languages that are at least compiled will get adequate performance for these use cases, not just C/C++.

    • @protosevn
      @protosevn 26 дней назад

      @@atiedebee1020 yeah you’re right, just tired of people thinking C/C++ is the only way, I use C++ just because that’s the golden standard but it’s not the only fast language around the block anymore.

    • @TheSugarCherryDev
      @TheSugarCherryDev 15 дней назад

      ​@@protosevnThats why I started use love2D and lua, and I got a lot of things to work on this, like an Engine and a programming language. sometimes I need C if I want low level control but most of the time, I use pure lua

  • @surgeonofdeath01
    @surgeonofdeath01 28 дней назад +3

    bro you are so good !!!!!

  • @codecaine
    @codecaine 28 дней назад +1

    Nice work

  • @The_Pabloburrito
    @The_Pabloburrito 28 дней назад

    I love your videos, youre such a huge inspiration for me! As always, great video!

  • @xzippyzachx
    @xzippyzachx 26 дней назад +1

    Shaders go brrrrrrrrrrrrrrrrrr

  • @sizzlet01
    @sizzlet01 28 дней назад +2

    Do you ever plan to release your planet generator like the rest of your games? I'd love to take a peek into how something like that is even done.

  • @gracechan3039
    @gracechan3039 28 дней назад

    I’m not at a level to understand a lot of what you’re talking about but I like hearing you break down the concepts.
    Also, if this was the first video of yours I saw I could easily say, easy for him. He’s a genius.
    Maybe you are a genius but also, from your videos it’s clearly a lot of hard work for over ten years building on top of itself. It feels like a really candid view of how a talented normie becomes S tier.

  • @aecl4287
    @aecl4287 28 дней назад

    Even though I don’t use python nor do I plan on doing so, I just can’t get enough of your videos man. Keep up the amazing work! ❤🎉

  • @Skeffles
    @Skeffles 20 дней назад

    This looks fantastic, although sounds like a huge project. How long are you expecting to work on this?

    • @DaFluffyPotato
      @DaFluffyPotato  20 дней назад +1

      Just a little on the side here and there. I don't have a specific end point in mind.

  • @Pythonista24x7
    @Pythonista24x7 27 дней назад

    What are you using for networking? Websockets or custom stuff?

  • @HA11EYS_COM3T
    @HA11EYS_COM3T 28 дней назад

    Hey just saying it would be better to use fractal perlin noise as that would generate more natural and good-looking landscapes and is what Minecraft itself uses iirc

  • @cosmicdive
    @cosmicdive 28 дней назад

    Damn you're a wizard!

  • @lolhahalaughlaugh8033
    @lolhahalaughlaugh8033 12 дней назад

    i would reccomend getting mojo installed, its python and even backwards compatible but alot faster, im 99% sure ur using vs code and that even has its own mojo sdk!

  • @lamanqo834
    @lamanqo834 9 дней назад

    Making a minecraft clone in python with moderngl is very frustrating and challenging, i suggest switching to c++ while you still can, it is much harder but offers so many more features.

  • @StepTheGlow
    @StepTheGlow 27 дней назад

    bro u literally teach us better than 1 month of teacher lol

  • @IvanPopelyshev
    @IvanPopelyshev 27 дней назад

    Is your point of origin fixed?
    In infinite world you have to shift shadow matrix correctly, otherwise there's unstability of shadows when the sun goes down

    • @DaFluffyPotato
      @DaFluffyPotato  27 дней назад +1

      It doesn't move in this demo, but it will in the project I'm working on next.

  • @official-phuh
    @official-phuh 27 дней назад

    I wonder if the GLSL and python coding could be combined into a usable shading module that could be pip installed for the less... "DaFluffyPotato" of us

    • @DaFluffyPotato
      @DaFluffyPotato  27 дней назад +1

      ModernGL is very easy to use. I have a tutorial for it.

  • @zeperoxx
    @zeperoxx 27 дней назад

    You're insane

  • @user-oe5nv8rf9r
    @user-oe5nv8rf9r 10 дней назад

    how often do you use higher level math in basic game development?

    • @DaFluffyPotato
      @DaFluffyPotato  10 дней назад +1

      once every other month for what I do. almost never for "basic" stuff.

  • @S0ggyW3tW4t4r
    @S0ggyW3tW4t4r 28 дней назад

    Ok soo thats what a shader is

  • @Generic_Games
    @Generic_Games 28 дней назад

    Good vid

  • @gabrielward7289
    @gabrielward7289 28 дней назад +2

    i love you your the best

  • @Inkety
    @Inkety 28 дней назад +1

    The background music is
    Blue Dream by Cheel

    • @DaFluffyPotato
      @DaFluffyPotato  28 дней назад +1

      That's not the original. It's Blue Dream by Cheel.

    • @Inkety
      @Inkety 27 дней назад

      @@DaFluffyPotato oh, okay. that's where I found it first.

  • @Merserissugoi
    @Merserissugoi 28 дней назад +1

    pls make a minecraft mmo.. i would hand over all my money

  • @brockdaniel8845
    @brockdaniel8845 27 дней назад +1

    Python, now I know why my pc burns with these mods 😮

    • @judef
      @judef 17 дней назад

      Minecraft mods aren’t in python

  • @Lighter7900music
    @Lighter7900music 20 дней назад

    Haven't watched the video yet but I see no python but C#

  • @DuoDevs-Studios
    @DuoDevs-Studios 28 дней назад +1

    hay how was your day?

    • @DaFluffyPotato
      @DaFluffyPotato  28 дней назад +1

      busy

    • @DuoDevs-Studios
      @DuoDevs-Studios 27 дней назад

      @@DaFluffyPotato i know that feeling lol just rember to take time to youself :)

  • @jeremynaumann3055
    @jeremynaumann3055 28 дней назад

    shadowmapping now seems to be less complex but plz try ray-tracing because it needs less buffers for some cool effects like reflections,transperency,shadows and portals.. you can stylize raytracing too that it looks like minecraft. or add it as a option. a compute raytracer isn't too hard to implement if you use ChatGPT

  • @obinho71
    @obinho71 27 дней назад

    I don't think you could say this is "just Python"... But it is remarkable anyway.

  • @dlanodspot
    @dlanodspot 28 дней назад +2

    First... I guess😂

  • @totoshampoin
    @totoshampoin 28 дней назад

    When you said "actually just python", I expected you to replace glsl with python.
    Disappointed.

  • @senex_0372
    @senex_0372 28 дней назад

    Bro stop it!! You are way too far.
    I’m feeling stupid

  • @professorsheep7598
    @professorsheep7598 28 дней назад +3

    9 views in 1 minute bro fell off