Incredible voxel mesh optimisations! (Daydream pt. 7)

  Рет қаралды 9,134

Daniel P H Fox

Daniel P H Fox

Күн бұрын

Let's pick up the pace with our meshing code, and unclog our rendering bottleneck with some incredibly smart algorithms that generate better meshes in less time for the most important voxels only.
Technical Fluff article on greedy meshing: fluff.blog/2023/04/24/greedy-...
-- chapters --
0:00 - Intro
0:08 - Game name proposal!
0:45 - Overview
1:19 - What to optimise?
1:49 - Separation of concerns
2:49 - Overview of greedy meshing
4:22 - Overview of binary meshing
6:42 - Binary meshing for voxel stacks
7:30 - Binary meshing for consecutive rows
9:12 - Congratulations!
9:45 - Time to get rejected
10:16 - Empty chunk rejection
10:44 - Empty mesh rejection
11:00 - Occlusion culling discussion
11:35 - Calculating visibility through chunks
12:12 - Fast visibility checks
12:51 - Caching & chunk visitation
13:28 - Performance notes
14:23 - Grid-based visibility algorithm
18:37 - Outro
-- links --
Mastodon: elttob.uk/go/masto/
Everything else: elttob.uk/

Пікірлер: 55
@dphfox
@dphfox Ай бұрын
As I mentioned in the video, I'm thinking of calling this game/engine/project "Daydream"! I've been trying to come up with a short, concise, meaningful but not-cheesy name for years at this point. I kind of got really hung up on "Blox" as a name and I wanted something with a similar 'tongue-feel' but obviously not running afoul of trademarks and perhaps a little less overly 'voxel-game-named'. So I thought back upon all of my game design notes and how I was composing the music for this game. The music isn't themed after the presentation of the game, or the specific features it has, but instead is being themed based on the *emotion* or *vibe* that the player should be experiencing as a result of the game mechanics and game design, so why not use that philosophy for the name too? Since the game design I've set out so far aims to turn the game into a zen-like experience with tight core loops, calm unwinding activities, all set in an infinite world you can imagine and create anything inside of with full dominion and no other characters to think of, it gave me the vibe that the game felt like a kind of lucid dream. Indeed, the music already leans into this with repeating melodies, pedals and ostinati, all played with light touches. It all feels quite floaty and dreamlike, so that's the direction I wanted to lean into. This lines up with other aspects of the game too, like the cute abstracted details on the block textures (as opposed to Minecraft's more gritty style), the more casual, cursive font, and features of the worlds that I plan to generate (such as whimsical, physically impossible cliffs for the purposes of more interesting building opportunities). So I think framing the game like a 'daydream' makes total sense, and it encapsulates all of those vibes into one single word that rolls off the tongue and isn't a cheesy voxel game name at all. Of course, before settling on the name for sure, I did do a quick search for other games. Apart from some tiny visual novels, there's nobody just using "Daydream" as a standalone name, though of course Google did try and use it as the name of their underwhelming discontinued phone VR platform. I'm generally happy enough with the availability to go for it. So what do you guys think? Great name or great mistake?
@camanance
@camanance Ай бұрын
I actually like the name Daydream. Dream aesthetic is really cool and nice that you are going for it. I can think of other options that could be cool. Oneiric, Oneirisme, déjà rêvé and anemoia are other words related to dreams.
@sinus4784
@sinus4784 Ай бұрын
I think the name itself is cool, but not very unique therefore I don't think it'd be a good name
@TannerJ07
@TannerJ07 Ай бұрын
I think it's a great name! Simple and easy to remember, and like you said few to no games have used it.
@znotfireman
@znotfireman Ай бұрын
daydreams a great name, though if youre going for something "lucid dream"-y, maybe lucid itself could be great?
@robertwaremusic
@robertwaremusic Ай бұрын
I started building this same binary greedy mesher a couple weeks ago and I've been stuck figuring out how to get the swizzling part right. I like forcing myself to figure stuff out the hard way, so I haven't really looked at any references for help, but I've been stuck for several days now. This helped remotivate me, and realize I should probably understand how swizzling works beyond a surface level lol.
@robertwaremusic
@robertwaremusic Ай бұрын
Update: I figured it out. Wasn't too far off, with some slight tweaks to my code I got it working! 😁
@idedary
@idedary Ай бұрын
This reminds me strongly of Tantan's latest video about optimizing greedy mesher for his Bevy voxel renderer. Now I know what he did is called binary meshing.
@friz64_
@friz64_ Ай бұрын
this is giving me flashbacks to the latest Tantan video
@otistically
@otistically Ай бұрын
I'm actually glad that more devs are using the binary approach ever since Tantan made a video about it. And also, Daydream fits so well with the overall game's concept
@triducal
@triducal Ай бұрын
daydream has a nice sound to it
@GabeRundlett
@GabeRundlett Ай бұрын
Awesome work! For voxel scenes that are very dynamic, I have always thought that meshing would never work because its just too slow (I want high voxel densities) but last couple weeks I've been playing around with a GPU-driven voxel meshing algorithm and its pretty good so far. I don't greedy mesh or anything, since I think that would be slower. I essentially only mesh the visible voxels due to GPU-driven occlusion culling, and I do nanite-like compute rasterization for the small triangles.
@dphfox
@dphfox Ай бұрын
I just stumbled across your channel last night! Love what you're doing over there, and this GPU-side meshing sounds very cool too :) I'm going for less dense voxels here (50cm) since I'm building more of a Minecraft-like game with limited dynamic content, so I figure it's still in the realm where CPU-side meshing makes some sense. Ideally I'd ray march the whole thing but I have some reservations about how that'd scale to lower end devices. But who knows, maybe one day!
@GabeRundlett
@GabeRundlett Ай бұрын
@@dphfox Thanks, yeah I think your approach makes a lot of sense for a minecraft-like voxel density. I really enjoyed the video, surprised I was engaged all the way throughout, though I would like to have seen more images in-engine, for example visualizing the culling.
@dphfox
@dphfox Ай бұрын
@@GabeRundlett thanks! I'll make sure to include more footage next time :)
@Lespati-wy9dy
@Lespati-wy9dy Ай бұрын
wow... I loved this video soo much! Thank you
@tristan6052
@tristan6052 Ай бұрын
awesome vid!
@autisticbluesloth5244
@autisticbluesloth5244 Ай бұрын
eventually i want to be on this level of programming
@exa211
@exa211 Ай бұрын
Currently developing my own Voxel (Blocky) Engine in Vulkan and this is a goldmine lol I very much know all of this already but thats a very nice summary for me.
@duckdoom5
@duckdoom5 Ай бұрын
Oh, wow! I had the exact same thoughts about the visibility culling problem. I also tried some stuff, but I also found most solutions only worked in 2D.. Awesome to know there might be a solution. Looking forward to your attempt, sounds very interesting! Might look at it myself if I find the time
@KyleBaran90
@KyleBaran90 Ай бұрын
That article at the end looks more or less like a problem I wanted to solve in a 2D game, haha
@howto-xd6tq
@howto-xd6tq Ай бұрын
keep it going
@TBmax203
@TBmax203 Ай бұрын
I already saw binary greedy meshing in a presentation video named: Greedy Meshing Voxels Fast - Optimism in Design Handmade Seattle 2022 by Davis Morley
@blaitehere
@blaitehere Ай бұрын
There's also Tantan's latest video where he implements binary greedy meshing in his voxel engine in rust
@dphfox
@dphfox Ай бұрын
that's my inspiration!
@blaitehere
@blaitehere Ай бұрын
@@dphfox ooo that's cool
@darkenblade986
@darkenblade986 Ай бұрын
very cool
@k_lemek
@k_lemek Ай бұрын
I thought this was made by a much bigger channel until I saw the view count. Good stuff Daniel
@tenebrae711
@tenebrae711 Ай бұрын
Wow, that's a really great video! What colour theme are you using?
@dphfox
@dphfox Ай бұрын
I'm using Github Dark Default!
@Quandinis
@Quandinis Ай бұрын
what makes something performant is relative to the issue at hand, sometimes there are general things like having less data in memory, other times its itterating over alots of the same things to prevent cache misses, it is relatively speaking... relative to the problem at hand.
@dphfox
@dphfox Ай бұрын
For sure! The main problem here is a CPU side bottleneck where the rendering system didn't have enough meshing throughput, so that's what I solved here, but there's also some nice future benefits in the form of reduced overdraw, better utilisation of early z, and reducing the number of non-cobtributing fragment shader calls, which should set us up nicely for translucency and lighting down the line too! I definitely don't think about performance in overly simplistic terms - it's a bit of a fuller picture than I present in the video because it's be a bit too technical for some.
@beanieteamie7435
@beanieteamie7435 Ай бұрын
Daydream just sounds like a generative AI service xd
@TannerJ07
@TannerJ07 Ай бұрын
I'm also thinking of making a game in rust (just a small one for the experience of it) how did you get it to display things?
@dphfox
@dphfox Ай бұрын
I use winit and wgpu - check out this tutorial track: sotrh.github.io/learn-wgpu/
@geodebreaker
@geodebreaker Ай бұрын
You can use it for shadows
@Fikzy_
@Fikzy_ Ай бұрын
Nice video! Just a heads up, the sound being out of sync with the audio is a bit unpleasant
@dphfox
@dphfox Ай бұрын
Thanks for the heads up! I'll recalibrate my setup so it'll hopefully be a little bit better next time.
@_Mighty-9999
@_Mighty-9999 Ай бұрын
"Somnium" could be a good name. It's latin for "dream".
@oglothenerd
@oglothenerd Ай бұрын
Did you find this out from Tantan?
@dphfox
@dphfox Ай бұрын
My main reference was this talk: kzfaq.info/get/bejne/at6jaZmelrXKZHU.html Ultimately what I wanted to do was HDDA/ray marching in a fragment shader rather than doing rasterisation at all, but I figured that it's better for performance to take advantage of the power of rasterisation for direct visibility checks. Down the line I'll probably use GPU-side HDDA for lighting / ray tracing. I saw Tantan's video and it looks like they're doing slightly different things - they're focused more on just using meshes. I don't know if splitting the chunk mesh based on block ID is what I would have done, but it seems to work for them! :)
@oglothenerd
@oglothenerd Ай бұрын
@@dphfox Ah, cool!
@alexanderheim9690
@alexanderheim9690 Ай бұрын
Will the game support multiplayer?
@dphfox
@dphfox Ай бұрын
Hopefully!
@gsestream
@gsestream Ай бұрын
why do you need to send stuff to the gpu. isnt it already there. gpgpu not cpu to gpu. yeah 16+ say 48gigs of gddr6+ is main system memory.
@dphfox
@dphfox Ай бұрын
Forgive me if I'm a bit nooby! I do vaguely understand that things nowadays are moving towards a GPU-driven direction (do things in compute etc) but honestly? I'm just not yet smart enough to understand it all. I'm also not sure if wgpu is particularly well suited to that kind of thing, judging by the Github issues.
@gsestream
@gsestream Ай бұрын
@@dphfox cpu is fine too. I mean gpu compute, use gpu ram as the main ram.
@hackrmomo
@hackrmomo Ай бұрын
First (hehe)
@timmygilbert4102
@timmygilbert4102 Ай бұрын
Voxel dev stealing algorithm from each other without crediting their sources... Hbomberguy plagiarism 😂
@dphfox
@dphfox Ай бұрын
Oh I absolutely don't take credit for these! I'm not that smart 😅
@yal1621
@yal1621 Ай бұрын
why do you move your hands around so much are you trying to give me a seizure
@pwf2k
@pwf2k Ай бұрын
i like your funny incantations magic man
@jabalahkhaldun3467
@jabalahkhaldun3467 Ай бұрын
i think humans communicate emphaisis by using hand gestures so
Blazingly Fast Greedy Mesher - Voxel Engine Optimizations
23:35
Ultrafast voxel loading in Rust... gone wrong (Daydream pt. 6)
10:32
Daniel P H Fox
Рет қаралды 2,9 М.
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
МЯТНАЯ ФАНТА
Рет қаралды 4,4 МЛН
Red❤️+Green💚=
00:38
ISSEI / いっせい
Рет қаралды 60 МЛН
Этот Пёс Кое-Что Наделал 😳
00:31
Глеб Рандалайнен
Рет қаралды 4 МЛН
Дарю Самокат Скейтеру !
00:42
Vlad Samokatchik
Рет қаралды 7 МЛН
Magnifying The World's Brightest Flashlight (200,000 Lumens)
8:55
The Action Lab
Рет қаралды 450 М.
Mirrors with reflection in Godot 4
5:12
Dreamed Away
Рет қаралды 18 М.
The Topological Problem with Voting
10:48
Physics for the Birds
Рет қаралды 227 М.
When Your Game Is Bad But Your Optimisation Is Genius
8:52
Vercidium
Рет қаралды 1,4 МЛН
Optimizing my Game so it Runs on a Potato
19:02
Blargis
Рет қаралды 481 М.
What is the Smallest Possible .EXE?
17:57
Inkbox
Рет қаралды 283 М.
I made a Compression Algorithm for Heightmap Terrain
16:00
mohsen zare
Рет қаралды 66 М.
Why Do Video Game Studios Avoid Blender?
6:49
The Cantina
Рет қаралды 402 М.
Где флагманы с IPS?
0:52
Не шарю!
Рет қаралды 95 М.
Мой инст: denkiselef. Как забрать телефон через экран.
0:54
iPhone 16 с инновационным аккумулятором
0:45
ÉЖИ АКСЁНОВ
Рет қаралды 8 МЛН
Телефон-електрошокер
0:43
RICARDO 2.0
Рет қаралды 79 М.