Adding Realistic Shadows to my 3D Python Game

Поділитися
Вставка
  • Опубліковано 7 чер 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  Місяць тому +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 29 днів тому +75

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

    • @DaFluffyPotato
      @DaFluffyPotato  29 днів тому +15

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

    • @BentoSushi1
      @BentoSushi1 29 днів тому +10

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

    • @zellenny1784
      @zellenny1784 29 днів тому +5

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

    • @nmflash8
      @nmflash8 29 днів тому +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  29 днів тому +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 Місяць тому +74

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

    • @mizokalabizo418
      @mizokalabizo418 29 днів тому +1

      same, but I cant resist

    • @Robin270
      @Robin270 28 днів тому +1

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

  • @plvr_strg
    @plvr_strg 29 днів тому +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  29 днів тому +3

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

  • @therealbfg123
    @therealbfg123 Місяць тому +37

    AYOOOOO, YOU GOT A FUCKING SPONSOR!! LETS GOOOOOOOOOOOOOO

  • @theattic0098
    @theattic0098 Місяць тому +7

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

  • @theyummydogo
    @theyummydogo 29 днів тому +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.

  • @Trojan073
    @Trojan073 Місяць тому +2

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

  • @stoppls1709
    @stoppls1709 29 днів тому +1

    Congrats on the brilliant sponsor, love the tutorials

  • @costelinha1867
    @costelinha1867 27 днів тому +1

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

  • @mkdoz
    @mkdoz Місяць тому +3

    this was very fun to watch :)

  • @LoggyDev
    @LoggyDev 20 днів тому

    Bro, i love your worth ethic so much.

  • @aecl4287
    @aecl4287 29 днів тому

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

  • @The_Pabloburrito
    @The_Pabloburrito 29 днів тому

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

  • @cinnamon3556
    @cinnamon3556 29 днів тому +1

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

  • @3ler4never
    @3ler4never 29 днів тому +1

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

  • @gracechan3039
    @gracechan3039 29 днів тому

    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.

  • @Skeffles
    @Skeffles 22 дні тому

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

    • @DaFluffyPotato
      @DaFluffyPotato  22 дні тому +1

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

  • @ceopotato5712
    @ceopotato5712 29 днів тому +3

    bros brain is bigger than my head

  • @Overlycomplicatedswede
    @Overlycomplicatedswede 25 днів тому

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

  • @codecaine
    @codecaine 29 днів тому +1

    Nice work

  • @sizzlet01
    @sizzlet01 Місяць тому +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.

  • @noTmeDev
    @noTmeDev 29 днів тому +3

    Bro is cooking as always

  • @Pythonista24x7
    @Pythonista24x7 28 днів тому

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

  • @surgeonofdeath01
    @surgeonofdeath01 Місяць тому +3

    bro you are so good !!!!!

  • @xzippyzachx
    @xzippyzachx 28 днів тому +1

    Shaders go brrrrrrrrrrrrrrrrrr

  • @protosevn
    @protosevn 29 днів тому +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 28 днів тому +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 28 днів тому

      @@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 17 днів тому

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

  • @cosmicdive
    @cosmicdive 29 днів тому

    Damn you're a wizard!

  • @HA11EYS_COM3T
    @HA11EYS_COM3T 29 днів тому

    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

  • @IvanPopelyshev
    @IvanPopelyshev 28 днів тому

    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  28 днів тому +1

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

  • @lolhahalaughlaugh8033
    @lolhahalaughlaugh8033 14 днів тому

    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 11 днів тому

    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.

  • @user-oe5nv8rf9r
    @user-oe5nv8rf9r 12 днів тому

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

    • @DaFluffyPotato
      @DaFluffyPotato  12 днів тому +1

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

  • @Generic_Games
    @Generic_Games 29 днів тому

    Good vid

  • @official-phuh
    @official-phuh 29 днів тому

    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  29 днів тому +1

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

  • @zeperoxx
    @zeperoxx 29 днів тому

    You're insane

  • @StepTheGlow
    @StepTheGlow 29 днів тому

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

  • @S0ggyW3tW4t4r
    @S0ggyW3tW4t4r 29 днів тому

    Ok soo thats what a shader is

  • @gabrielward7289
    @gabrielward7289 29 днів тому +2

    i love you your the best

  • @Inkety
    @Inkety Місяць тому +1

    The background music is
    Blue Dream by Cheel

    • @DaFluffyPotato
      @DaFluffyPotato  29 днів тому +1

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

    • @Inkety
      @Inkety 29 днів тому

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

  • @Merserissugoi
    @Merserissugoi 29 днів тому +1

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

  • @Lighter7900music
    @Lighter7900music 22 дні тому

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

  • @brockdaniel8845
    @brockdaniel8845 29 днів тому +1

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

    • @judef
      @judef 19 днів тому

      Minecraft mods aren’t in python

  • @DuoDevs-Studios
    @DuoDevs-Studios Місяць тому +1

    hay how was your day?

    • @DaFluffyPotato
      @DaFluffyPotato  29 днів тому +1

      busy

    • @DuoDevs-Studios
      @DuoDevs-Studios 28 днів тому

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

  • @jeremynaumann3055
    @jeremynaumann3055 29 днів тому

    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 28 днів тому

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

  • @dlanodspot
    @dlanodspot Місяць тому +2

    First... I guess😂

  • @senex_0372
    @senex_0372 29 днів тому

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

  • @totoshampoin
    @totoshampoin 29 днів тому

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

  • @professorsheep7598
    @professorsheep7598 Місяць тому +3

    9 views in 1 minute bro fell off