How I Implemented Shadows in my Game Engine

  Рет қаралды 92,500

ThinMatrix

ThinMatrix

Жыл бұрын

Devlog video about "Homegrown", a casual farming game I'm creating using my own engine.
Support the channel on Patreon and get access to the code for this game, the city-builder, and Equilinox:
/ thinmatrix
My previous game "Equilinox":
store.steampowered.com/app/85...
You can follow the progress of the game on my social media:
Twitter: / thinmatrix
Instagram: / thinmatrix
Facebook: / thinmatrix
Trello: trello.com/b/W3zkIJTM/farm
Email: thinmatrix@gmail.com
Background music by Jamal Green:
open.spotify.com/artist/50jTM...
#devlog #Homegrown

Пікірлер: 305
@CodingDragon04
@CodingDragon04 Жыл бұрын
I have actually missed this more technical content a bit. Concise yet excellent explanation!
@pivotal-ai
@pivotal-ai Жыл бұрын
Yes these are wonderful and I learn so much. They're the most inspiring for me to work on games of my own. Since it feels much more tangible. Love to see more!
@landru27
@landru27 Жыл бұрын
I, for one, feel that this video was much more than just "a little bit interesting"! I gain a lot from you diving in on the technical details. It's particularly interesting when you cover how your approach to a certain graphical problem has become more sophisticated over the course of time and your projects. ... Don't get me wrong, though : it's also always great to see the dishes you cook, your balcony garden, and the landscape around where you live, like in a regular dev log! 🙂
@mr.norris3840
@mr.norris3840 Жыл бұрын
I agree
@UserUser-sh6wi
@UserUser-sh6wi Жыл бұрын
Agree on the first half, but must disagree on the second. I find devlogs to be much more enjoyable when the irrelevant parts are cut out and all the focus is on the project.
@ceyhunuysal9509
@ceyhunuysal9509 Жыл бұрын
Im literally watching for the cooking!
@Danuxsy
@Danuxsy Жыл бұрын
With path tracing you don't have to deal with trying to fake all of this, it just works.
@mr.norris3840
@mr.norris3840 Жыл бұрын
@@Danuxsy But it still isn’t 100% accurate, and a lot of restricting assumptions have to be made
@MattieBW
@MattieBW Жыл бұрын
"technical and boring" sounds good to me :)
@jdh
@jdh Жыл бұрын
Another fix you could try for the shadow shimmering on movement is to add a small offset to the projection matrix for the shadow map that ensures that all world coordinates will always “snap” to the same shadow map texels, IIRC done by taking a fixed world space point (the origin) and transforming it into shadow space and then finding its offset from the center of a texel in shadow map space (where the texture sample round to) and using that, transformed back into shadow projection from shadow texture space, to offset the projection matrix. maybe a little complicated though when you already have a good enough solution :) the graphics are looking great!
@jessex8535
@jessex8535 Жыл бұрын
I love your content so much
@Assassin_Droid
@Assassin_Droid Жыл бұрын
Helo there
@ThinMatrix
@ThinMatrix Жыл бұрын
Thanks for the idea, that makes a lot of sense! I'll have to give that a go next time when I work on the shadows :)
@Dannnneh
@Dannnneh Жыл бұрын
Always nice to see your insightful comments.
@cineblazer
@cineblazer Жыл бұрын
I really really love technical content like this. Maybe it's not the most popular amongst other subscribers but I'll always watch it! Super fascinating to someone like me who doesn't have any graphics programming experience but wants to learn.
@Krahfty
@Krahfty Жыл бұрын
From my experience, a lot of this kind of stuff is just the trial and error from normal development, get your hands on an engine and just start making something, you'll soon encounter these kinds of problems and you'll learn directly from trying to fix those types of problems 1st hand
@AjAce19
@AjAce19 Жыл бұрын
I really enjoy this kind of video! I know you can't always do technical stuff but its really interesting and cool to see stuff more in depth!
@massimogalliano8337
@massimogalliano8337 Жыл бұрын
Seeing your project and this game take shape is heart-whelming!
@oamioxmocliox8082
@oamioxmocliox8082 Жыл бұрын
;)
@erikbrendel3217
@erikbrendel3217 Жыл бұрын
Have you heard of "Variance Shadow Mapping"? This is a simple mathematical way of achieving very smooth shadows without the need of introducing many samples, and it also solves the shadow-acne problem. Maybe this would be worth exploring for the game... :)
@MrAchterbahnfahrer
@MrAchterbahnfahrer Жыл бұрын
Just an additional note to anyone reading the comment above: If you're considering variance shadow mapping, you should also take a look at moment shadow mapping. While variance shadow mapping only takes the first two moments of the distribution of depth values (i.e. their mean and variance) into consideration when calculating the shadow density, moment shadow mapping uses the first four moments, thus reducing the issues of light leaking caused by variance shadow mapping.
@SomeNussi
@SomeNussi Жыл бұрын
Here's what i can recommend for moving/resizing the shadowmap: keep it a bit bigger than the view area AND re-calculate it every frame (if the camera didnt move, you keep the current "target") instead of fully applying the "new" dimensions immediately, interpolate between the old and the new one in a ratio of about 85 to 15 with the new one being 85% responsible for the new image. This way you're getting rid of the sudden shifting and you're able to keep the shadow maps size much smaller than previously, improving the shadows quality
@ThinMatrix
@ThinMatrix Жыл бұрын
Thanks for the idea, I'll give that a try!
@cribalik
@cribalik Жыл бұрын
I recommend 'jdh's answer instead, it's the fastest and arguably simpler than any other method. The idea is: only move the shadowmap in increments of its pixel size (in world space) docs.microsoft.com/en-us/windows/win32/dxtecharts/common-techniques-to-improve-shadow-depth-maps?redirectedfrom=MSDN Something like: bounds = CalcShadowMapBox(); // in worldspace float texel_size_in_world_space = bounds.width / shadowmap_resolution; // assuming shadowmap is square // snap to grid bounds.x0 = floor(bounds.x0 / texel_size_in_world_space) * texel_size_in_world_space; bounds.y0 = floor(bounds.y0 / texel_size_in_world_space) * texel_size_in_world_space; bounds.x1 = bounds.x0 + texel_size_in_world_space * shadowmap_resolution; bounds.y1 = bounds.y0 + texel_size_in_world_space * shadowmap_resolution; projection = ortho(bounds.x0, bounds.x1, bounds.y1, bounds.y0, bounds.z0, bounds.z1);
@enotirab
@enotirab Жыл бұрын
Loving the series. For what it is worth some of us love "technical and boring."
@bejoscha
@bejoscha Жыл бұрын
Always interesting to see the technical details. Thanks.
@kamathonxander1
@kamathonxander1 Жыл бұрын
This was super interesting, thank you. Please do more of these technical in-depth videos in the future! 😊
@martinx9027
@martinx9027 Жыл бұрын
YEAH! Love this kind of insights of more technical stuff of the game, looking really good so far, Keep it up!!
@George-si6iv
@George-si6iv Жыл бұрын
So happy that you are doing consistent uploads now! Been watching since you were developing Equilinox and watching your dev logs has never gotten boring!
@GamesBySaul
@GamesBySaul Жыл бұрын
This was super interesting honestly! Seeing how you go about tackling issues, to me is very cool, it's nice to see your train of thought with it all!
@sydryan9589
@sydryan9589 Жыл бұрын
This is so fascinating, love your videos my man.
@ryanwood9288
@ryanwood9288 Жыл бұрын
Dude thank you for everything. Seeing your videos pop on to my timeline really brightens my day.
@zeztro
@zeztro Жыл бұрын
I really enjoy these little updates. The content is laid back and I always look forward to seeing how the game is coming on.
@StephenLebed
@StephenLebed Жыл бұрын
This was a really great video. I always enjoy your vids and would like to see more technical discussions as you go forward.
@DarkFazy
@DarkFazy Жыл бұрын
This video was great, thanks so much. Both relaxing and also explained some ideas behind implementing shadows quite well.
@falcowinkler2429
@falcowinkler2429 Жыл бұрын
super interesting video. I love the deep dives into technical topics. so informative and very well explained!
@MichiGombocz
@MichiGombocz Жыл бұрын
This might be the best video by far done by yourself. Thank you for all the effort you put it every time, it pays off for the viewer and hopefully yourself as well!
@Mystixor
@Mystixor Жыл бұрын
Been using the basics of your old Shadow mapping tutorial in my own engine ever since. Some of these ideas you shared today are definitely worth looking into!
@Zyhorn
@Zyhorn Жыл бұрын
Very fun and interesting. I love the technical explanation and wouldnt mind ever more 😀 thank you
@bertrodgers2420
@bertrodgers2420 Жыл бұрын
really enjoy the more technical videos as well as your normal ones. Would love to see more about what frameworks/libs you've used too
@kylemason01
@kylemason01 Жыл бұрын
Each step you make, the game just gets better and better. Keep it up!
@AxisCoords
@AxisCoords Жыл бұрын
Love your devlogs so much
@JackTraynor14
@JackTraynor14 Жыл бұрын
Great video. I hope you can do more technical devlogs like this in the future.
@DEPHi3
@DEPHi3 Жыл бұрын
I really like this kind of more technical videos. Good work.
@Skeffles
@Skeffles Жыл бұрын
Fascinating to see how you approach shadows!
@Joern290
@Joern290 Жыл бұрын
Great video! Love the art style and the shadows! 😊
@georgeaggelopoulos7791
@georgeaggelopoulos7791 Жыл бұрын
Excellent work as always. Thanks.
@NeilRoy
@NeilRoy Жыл бұрын
Fascinating insights on how to do shadows. This was a good, general description of the problem, I like it.
@guillaumequittet9418
@guillaumequittet9418 Жыл бұрын
Awesome job as usual! 💪 And crystal clear explanations 👌
@GingerBeker
@GingerBeker Жыл бұрын
Amazing. Really few people can really know how difficult this stuff are. You rock!
@Dannnneh
@Dannnneh Жыл бұрын
I very much appreciate the technical insight.
@Seff2
@Seff2 Жыл бұрын
Wow I never have seen such a high level explanation on how shadows work in 3d games. Thanks for this vid!
@nhuvunguyen4525
@nhuvunguyen4525 Жыл бұрын
The only bad thing about watching your dev logs is that they inspire me to drop everything and make my own game engine
@thehambone1454
@thehambone1454 Жыл бұрын
Great video, glad you made one on this topic, I am going to to do some similar techniques for shadows after watching this! I like the art style a lot btw!
@ludi_64
@ludi_64 Жыл бұрын
Great video! really well explained in an interesting way. I feel like I learnt a lot about how shadows work in video games
@Xbookdetemprano
@Xbookdetemprano Жыл бұрын
Seeeee, me encantó! Sos un genio. amo aunque sea estos videos cortitos que son muy interesantes para aprender y motivarse! Muchísimas Gracias por el esfuerzo y la buena onda!
@_v53
@_v53 Жыл бұрын
Shadowing is so tricky but so satisfying. It was arround here I reached the end of my efforts to develop my own engine (i'll return to it - when time permits!). You've got a great workable solution here.
@cnoah1705
@cnoah1705 Жыл бұрын
Amazing dev log as always
@asherhaun
@asherhaun Жыл бұрын
This is the kind of devlog I subscribed for in the past. :D
@MrA6060
@MrA6060 Жыл бұрын
it was looking great with the last graphics but now? holy smokey this is amazing. keep it up
@0.lennart
@0.lennart Жыл бұрын
I always enjoyed watching your tutorial videos a few years ago. It's impressive how you improved. I would love to see a few new tutorials when you have some time. Keep up the great work :)
@igz
@igz Жыл бұрын
Fascinating, and the game is looking great!
@elingranath
@elingranath Жыл бұрын
As someone working on my own engine, videos like these are super interesting and I even prefer them a lot over the regular game dev videos since I already have a lot of experience with game programming. I'm just about to get started with shadows myself so this was a nice surprise to see in my recommendations!
@marcelbricman
@marcelbricman Жыл бұрын
i love this technical material! even though i have an engine to do shadows for me, it it lovely to see these nice tricks ❤
@ownhaus
@ownhaus Жыл бұрын
Very interesting. I loved your tutorials and wish you had time to continue them.
@eboatwright_
@eboatwright_ Жыл бұрын
Very interesting! Never even tried to write my own 3d renderer, kudos to you for adding this!
@Zharkan16
@Zharkan16 Жыл бұрын
Thats awesome, I just drag in a directional light in Unity and call it a day 😄
@ThinMatrix
@ThinMatrix Жыл бұрын
I'm kind of jealous XD
@AjAce19
@AjAce19 Жыл бұрын
Ahh mines a bit different, I just drag a directional light in Unreal and call it a day 😂
@ieller71791
@ieller71791 Жыл бұрын
@@ThinMatrix I'd love to see and hear you talk about the tools you've created to help your game development along. Did you set up your engine with a GUI to manage things in a way like Unreal/Unity, or did you make separate tools to handle things like level design?
@zachj1196
@zachj1196 Жыл бұрын
The shadows look so good! Even if it was a more technical devlog I love to see the progress on the game!
@kiki-drawer2669
@kiki-drawer2669 Жыл бұрын
I don't code or create games at all but the way you talk about your work and explain simply means your videos are never boring no matter what element you focus on! I enjoyed this video just as much as all your others! Ty for working so hard!
@CodeParticles
@CodeParticles Жыл бұрын
I remember getting into shadow mapping, and then later omnidirectional shadow mapping! I've been avoiding those concepts lately but it's only a matter of time before it's needed again, thank you for reminding me!! 👍👍
@mischa7823
@mischa7823 Жыл бұрын
I do like the devlogs that go into technical detail a lot more.
@williamist
@williamist Жыл бұрын
love the technical videos :D
@bigmistqke
@bigmistqke Жыл бұрын
Waw the steps u made in the last videos really added a lot of life to the scene!
@LifeOfMohammed
@LifeOfMohammed Жыл бұрын
Awesome work! Love the shadows!
@SpikeStudio
@SpikeStudio Жыл бұрын
The solutions you come up with are always incredible
@recyclebinladen5903
@recyclebinladen5903 Жыл бұрын
Lol what? What do you think AAA games are made of then, and since decades?
@davidberry8275
@davidberry8275 Жыл бұрын
thanks very much for taking the time to do this. Love the insight of 3D graphics. While I'm a decent programmer this is outside my normal area of business applications. Its amazing how much processing can take place in every frame using GPU, while our business app processing seem very slow in comparison.
@MrOmega-cz9yo
@MrOmega-cz9yo Жыл бұрын
As others have mentioned, I too like these types of videos! Thanks!
@Sopiro
@Sopiro Жыл бұрын
This video makes me nostalgic when I was watching the opengl tutorial series you made! Awesome devlog :)
@KamranWali
@KamranWali Жыл бұрын
Awesome video! The shadow rendering already looks awesome. Really like how you go in detail to explain how each of the problem was tackled. Learnt something new today :) Looking forward to your next devlog. Keep it up! :)
@ThinMatrix
@ThinMatrix Жыл бұрын
Thanks, glad you liked it :)
@FloWritesCode
@FloWritesCode Жыл бұрын
Great video! Shaders in general have always been my weakness, so this was very interesting to watch :)
@otoS97
@otoS97 Жыл бұрын
Game looks amazing, I'm so happy after the graphical upgrade
@GeryTeague
@GeryTeague Жыл бұрын
Love your videos man!
@Arkogelul
@Arkogelul Жыл бұрын
Even if this one not the regular format, I really enjoyed that video. Thanks!!
@OriginalJetForMe
@OriginalJetForMe Жыл бұрын
I love the technical content!
@marco6ocram
@marco6ocram Жыл бұрын
It looks freaking amazing!
@chadzulu4328
@chadzulu4328 Жыл бұрын
This was very interesting and educational too! Thanks
@felixstrau7880
@felixstrau7880 Жыл бұрын
As a hobby game dev, I really enjoy this type of content. You don't have to go more into detail. But the overview of your thought process when implementing this features is really helpful.
@VetorDigital
@VetorDigital Жыл бұрын
This is beginning to look nice, you are on the right track.
@madao7865
@madao7865 Жыл бұрын
Looking good. Also, the technical side is quite interesting.
@simon-wt
@simon-wt Жыл бұрын
I haven't commented yet but this time I really want to just show you my gratitude for your work. This video is actually one of the most interesting videos I have seen yet! In graduate school I studied a lot of computer graphics theory and I really appreciate watching you implement these techniques and algorithms into your game. I Especially love the commentary you give and it's really nice to have the direct feedback on the game. Thank you Karl for taking us with you on this journey ❤ PS: I only watch around 2-5 videos a month but I won't ever miss on watching any of yours!
@dennismakesgames
@dennismakesgames Жыл бұрын
Lovely, I do feel like shadows that are softer would really fit the art style, like Tunic, and the clouds that casts shadows would also be lovely :) Great work as always.
@pedro_mg
@pedro_mg Жыл бұрын
very interesting, I enjoy these more technical ones a lot
@lucidmoses
@lucidmoses Жыл бұрын
Now that you've done that, shadows from clouds should be pretty easy to add. Not sure it would be all that useful if it's not tied to groth or something but may make it look a bit more realistic (If that's what your after).
@AntonioNoack
@AntonioNoack Жыл бұрын
They add a new issue: clouds are typically transparent/translucent, so he best should do them in a separate pass, and then blend them with the normal shadows. Given that clouds may be procedural, and you probably can't see the sky anyway, you could completely do them in a shader function, and save the cloud shadow map.
@FICHEKK
@FICHEKK Жыл бұрын
This was super interesting, please more of these! :)
@VegetableJuiceFTW
@VegetableJuiceFTW Жыл бұрын
I have always wondered how shadows are done. Neat!
@Achelon
@Achelon Жыл бұрын
This is extremely interesting man!
@Simon-ik1kb
@Simon-ik1kb Жыл бұрын
loved this one. Really like those a little more technical videos. I understand basically... nothing. But still very interesting.
@tunAliUTube
@tunAliUTube Жыл бұрын
Nice approach
@SwordFishTheFish
@SwordFishTheFish Жыл бұрын
Love this kind of video!
@KarimHamdallah-gc2el
@KarimHamdallah-gc2el 9 күн бұрын
Amazing video, so informative
@leoingson
@leoingson Жыл бұрын
One of your best videos of late! Tech content rules :)
@_miyu
@_miyu Жыл бұрын
I really like your work on the shadows, especially reducing the calculations with an over sized box. I have a suggestion about how watering the crops gets rendered. Instead of the full square turning dark immediately, think of how rain, or the watering can would drop random droplets until it all gets filled in. It could be a quick animation that just darkens randomly sized circles until its all watered. Hope that helps, thanks for the great dev videos.
@ThinMatrix
@ThinMatrix Жыл бұрын
Thanks for the suggestion, that does sound nice!
@realbrickbread
@realbrickbread Жыл бұрын
You got a really nice workplace!
@NunoLopes99
@NunoLopes99 Жыл бұрын
Very good explanation ❤
@weinsim3856
@weinsim3856 Жыл бұрын
Wow, the graphics are starting to look really good
@Stevenpwalsh
@Stevenpwalsh Жыл бұрын
I like this quick little video
@LandBeyond
@LandBeyond Жыл бұрын
I would love to see more like these, missed the technical videos you use to do.
@wyattrichardson6609
@wyattrichardson6609 Жыл бұрын
Very cool video, indeed interesting and helpful.
@VictorGordan
@VictorGordan Жыл бұрын
Great idea with the bigger area of the shadow map! Also, didn't know about the only rendering back faces trick, always just used an offset :)
@Draconicrose
@Draconicrose Жыл бұрын
They look pretty good and I learned something more about development from this video.
@peterhickman386
@peterhickman386 Жыл бұрын
Along with the graphical upgrade it is looking much better now. Also nice technical content even if it is on a small detail
@Phvli
@Phvli Жыл бұрын
Good, concise explanations for the basic concepts! You'll probably want to look into Cascaded Shadow Mapping if your single map resolution is not enough.
@samuilxd
@samuilxd Жыл бұрын
Hello. First of all, you are making your video in a great and instructive way, I wish you success in your new game (I wish I could solve the logic) :)
@OCPyrit
@OCPyrit Жыл бұрын
The game looks great, I like the style.
@0VexRoblox
@0VexRoblox Жыл бұрын
I love the progress. I think textures would be a good addition though, the idea you scrapped in the previous episode.
SHADOWS! // Hazel Engine Dev Log
26:09
The Cherno
Рет қаралды 64 М.
Uhhhhh... Hmmmmmm...
8:09
Phoenix SC
Рет қаралды 509 М.
Каха с волосами
01:00
К-Media
Рет қаралды 6 МЛН
I MADE A CARDBOARD SWING!#asmr
00:40
HAYATAKU はやたく
Рет қаралды 30 МЛН
Programming Particle Effects in my Game Engine
13:00
ThinMatrix
Рет қаралды 77 М.
Starting Work on my New Farming Game!
12:49
ThinMatrix
Рет қаралды 263 М.
When Your Game Is Bad But Your Optimisation Is Genius
8:52
Vercidium
Рет қаралды 1,3 МЛН
How a Playtest Changed my Game Forever
9:39
Bobsi
Рет қаралды 9 М.
Real-time 2D shadows | HUGE improvements!
9:32
Barney Codes
Рет қаралды 32 М.
How Ray Tracing (Modern CGI) Works And How To Do It 600x Faster
32:06
Josh's Channel
Рет қаралды 538 М.
Overhauling the Graphics in my Game Engine
15:37
ThinMatrix
Рет қаралды 148 М.
Lights and Shadows in Graphics - Computerphile
8:49
Computerphile
Рет қаралды 160 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 670 М.
All OpenGL Effects!
30:21
Low Level Game Dev
Рет қаралды 53 М.
Villager SAVES The Noob From Zombie Apocalypse! 🧟
0:59
MineSauce
Рет қаралды 3,3 МЛН
Who Is The Most Suitable To Be The Owner Of The Dog Zoonomaly
0:41
Mischief time
Рет қаралды 9 МЛН
Which one will take more 😉
0:27
Polar
Рет қаралды 80 МЛН
Самый СТРАННЫЙ ЧИТЕР | CLEX #shorts
0:54
CLEX
Рет қаралды 2,7 МЛН