Adding Realistic Shadows to my 3D Python Game

Sdílet
Vložit
  • čas přidán 1. 06. 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
  • Věda a technologie

Komentáře • 77

  • @DaFluffyPotato
    @DaFluffyPotato  Před 24 dny +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 Před 24 dny +75

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

    • @DaFluffyPotato
      @DaFluffyPotato  Před 24 dny +15

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

    • @BentoSushi1
      @BentoSushi1 Před 24 dny +10

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

    • @zellenny1784
      @zellenny1784 Před 23 dny +5

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

    • @nmflash8
      @nmflash8 Před 23 dny +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  Před 23 dny +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 Před 24 dny +73

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

    • @mizokalabizo418
      @mizokalabizo418 Před 23 dny +1

      same, but I cant resist

    • @Robin270
      @Robin270 Před 22 dny +1

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

  • @plvr_strg
    @plvr_strg Před 23 dny +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  Před 23 dny +3

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

  • @therealbfg123
    @therealbfg123 Před 24 dny +36

    AYOOOOO, YOU GOT A FUCKING SPONSOR!! LETS GOOOOOOOOOOOOOO

  • @theattic0098
    @theattic0098 Před 24 dny +7

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

  • @costelinha1867
    @costelinha1867 Před 21 dnem +1

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

  • @Trojan073
    @Trojan073 Před 24 dny +2

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

  • @theyummydogo
    @theyummydogo Před 23 dny +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.

  • @ceopotato5712
    @ceopotato5712 Před 23 dny +3

    bros brain is bigger than my head

  • @LoggyDev
    @LoggyDev Před 14 dny

    Bro, i love your worth ethic so much.

  • @stoppls1709
    @stoppls1709 Před 23 dny +1

    Congrats on the brilliant sponsor, love the tutorials

  • @Overlycomplicatedswede

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

  • @The_Pabloburrito
    @The_Pabloburrito Před 23 dny

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

  • @Skeffles
    @Skeffles Před 16 dny

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

    • @DaFluffyPotato
      @DaFluffyPotato  Před 16 dny +1

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

  • @noTmeDev
    @noTmeDev Před 24 dny +3

    Bro is cooking as always

  • @gracechan3039
    @gracechan3039 Před 23 dny

    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.

  • @cinnamon3556
    @cinnamon3556 Před 24 dny +1

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

  • @protosevn
    @protosevn Před 23 dny +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 Před 22 dny +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 Před 22 dny

      @@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 Před 11 dny

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

  • @mkdoz
    @mkdoz Před 24 dny +3

    this was very fun to watch :)

  • @aecl4287
    @aecl4287 Před 24 dny

    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! ❤🎉

  • @3ler4never
    @3ler4never Před 24 dny +1

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

  • @surgeonofdeath01
    @surgeonofdeath01 Před 24 dny +3

    bro you are so good !!!!!

  • @sizzlet01
    @sizzlet01 Před 24 dny +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.

  • @Pythonista24x7
    @Pythonista24x7 Před 22 dny

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

  • @lolhahalaughlaugh8033

    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!

  • @xzippyzachx
    @xzippyzachx Před 22 dny +1

    Shaders go brrrrrrrrrrrrrrrrrr

  • @IvanPopelyshev
    @IvanPopelyshev Před 22 dny

    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  Před 22 dny +1

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

  • @codecaine
    @codecaine Před 24 dny +1

    Nice work

  • @lamanqo834
    @lamanqo834 Před 5 dny

    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.

  • @HA11EYS_COM3T
    @HA11EYS_COM3T Před 23 dny

    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

  • @StepTheGlow
    @StepTheGlow Před 23 dny

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

  • @user-oe5nv8rf9r
    @user-oe5nv8rf9r Před 6 dny

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

    • @DaFluffyPotato
      @DaFluffyPotato  Před 6 dny +1

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

  • @S0ggyW3tW4t4r
    @S0ggyW3tW4t4r Před 23 dny

    Ok soo thats what a shader is

  • @cosmicdive
    @cosmicdive Před 23 dny

    Damn you're a wizard!

  • @official-phuh
    @official-phuh Před 23 dny

    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  Před 23 dny +1

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

  • @gabrielward7289
    @gabrielward7289 Před 24 dny +2

    i love you your the best

  • @Generic_Games
    @Generic_Games Před 23 dny

    Good vid

  • @zeperoxx
    @zeperoxx Před 23 dny

    You're insane

  • @Merserissugoi
    @Merserissugoi Před 23 dny +1

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

  • @Lighter7900music
    @Lighter7900music Před 16 dny

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

  • @DuoDevs-Studios
    @DuoDevs-Studios Před 24 dny +1

    hay how was your day?

  • @jeremynaumann3055
    @jeremynaumann3055 Před 23 dny

    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

  • @Inkety
    @Inkety Před 24 dny +1

    The background music is
    Blue Dream by Cheel

    • @DaFluffyPotato
      @DaFluffyPotato  Před 24 dny +1

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

    • @Inkety
      @Inkety Před 23 dny

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

  • @brockdaniel8845
    @brockdaniel8845 Před 23 dny +1

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

    • @judef
      @judef Před 13 dny

      Minecraft mods aren’t in python

  • @dlanodspot
    @dlanodspot Před 24 dny +2

    First... I guess😂

  • @obinho71
    @obinho71 Před 22 dny

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

  • @senex_0372
    @senex_0372 Před 23 dny

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

  • @totoshampoin
    @totoshampoin Před 23 dny

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

  • @professorsheep7598
    @professorsheep7598 Před 24 dny +3

    9 views in 1 minute bro fell off