Тёмный

Making voxels MOVE with the separating axis test [Voxel Devlog #11] 

Douglas
Подписаться 11 тыс.
Просмотров 15 тыс.
50% 1

Online demo: github.com/DouglasDwyer/octo-...
Geese event system: github.com/DouglasDwyer/geese
In this devlog, I go through some of the tough decisions that I made regarding my voxel engine. I talk about the separating axis theorem, and how I leverage linearity to use it efficiently in voxel-versus-voxel collision detection. In addition, I showcase transparent voxels rendered using weighted, order-independent blending!
Music used in the video:
Corbyn Kites - The Decision
Corbyn Kites - Dusk Drive
Chris Doerksen - Searching for Treasure
Corbyn Kites - Birds

Игры

Опубликовано:

 

1 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 85   
@GabeRundlett
@GabeRundlett Год назад
Awesome! I may take some inspiration from the continuous collision detection 😉
@DouglasDwyer
@DouglasDwyer Год назад
I would positively love to see a solely-GPU physics engine! Many things, like the separating axis test, would lend themselves well to parallelization.
@TheRaticide
@TheRaticide Год назад
Those transparent voxels look great. I wonder if you could use the pixels of the transparent objects as a mask to distort the solid pixels, allowing you to make a wobbly underwater effect.
@DouglasDwyer
@DouglasDwyer Год назад
That's a great idea! Because transparency happens in a separate render pass, I should be able to sample from the solid render target. This could allow for screen-space reflections or underwater refraction :)
@Tyradius
@Tyradius Месяц назад
Heat waves too I'd think. 🤔
@AlienXtream1
@AlienXtream1 6 месяцев назад
thankyou youtube for this hidden gem! on the note of the transparency, i've not heard of it before but it sounds really useful. im wondering if there may be some extra steps you can do to improve the transparency stuff. depending on performance cost you may be able to achieve a sort of middle ground. using the order independent method as a base and passing in some extra info to account for edge cases. maybe some sort of Z-buffer pass that can be used to get some crude ordering. or if there is enough information to imply order from computationally cheep checks you might be able to use a 3D LUT for RGB values. then you could use something like a ray traced transparency to precompute the LUT and bake that in. that'd also mean you (or someone else) could overwrite it too for some potentially cool effects!
@Gwilo
@Gwilo Год назад
Douglas, the progress you've made with these videos is actually really inspiring and your progress makes me proud Please, whatever you're doing to keep yourself motivated, keep it up!
@shinobudev
@shinobudev Год назад
I found success in optimizing my octree raymarcher by reducing the number of octree subdivisions to step into when traversing with a ray by caching the bounding box and index of the octree node you last searched. Given D as the depth of your octree, normally you would: origin -> search D octree subdivisions -> move forward -> search D octree subdivisions -> move forward But you can just: origin -> search D octree subdivisions and save the D/2 box -> move forward -> if still inside the last D/2 box then just start out there and save D/2 depth searches. This way you can additionally set the starting D/2 box as the one the camera is in, calculated in CPU and passing it to the GPU as a uniform. You now guarantee that your rays will save less octree subdivision searches.
@darkengine5931
@darkengine5931 Год назад
Makes sense to avoid having to start all over again from the root of the tree. Have you tried ray packets by any chance? I'm used to using them for raytracers but never tried for volume ray marchers. It seems a bit tricky to use them combined with your optimization since each ray in the packet might want to resume from a different node in the tree.
@shinobudev
@shinobudev Год назад
@@darkengine5931 have not but I'll be looking into that now
@mark_makes
@mark_makes Год назад
Very exciting to see more progress! Keep the videos coming! 🙌
@AIShipped
@AIShipped Год назад
I spent 2 hours bingeing all your videos so far. Amazing content!
@GreenDave113
@GreenDave113 Год назад
An absolutely wonderful video. I loved the thinking style and the features as well!
@jonathandowns282
@jonathandowns282 Год назад
Great video as always! I've been watching your videos since you started this series, and I use you to inspire myself to work on my own engine. You're doing amazing work, you have the best engine I've seen since John Lin, and I'm really happy to see this engine progress and each of the features get added. I'm glad you're so passionate about this, and I'm glad I found this channel!
@DouglasDwyer
@DouglasDwyer Год назад
Thanks for your kind words :)
@jordanserres-gonzalez9634
@jordanserres-gonzalez9634 Год назад
Awesome dedication been subscribed since 3rd episode and still love the great work keep it up!
@bengt-goranpersson5125
@bengt-goranpersson5125 Год назад
Your work is so inspiring.
@ttj_
@ttj_ Год назад
amazing. loved every second of this
@benrex777productions9
@benrex777productions9 Год назад
Now I'm up to date. Thank you for your videos.
@dominicstocker5144
@dominicstocker5144 Год назад
Great work! Thanks for the video!
@grevel1376
@grevel1376 Год назад
You are a big inspiration for me.
@jsierra88
@jsierra88 Год назад
Things get harder when you have to rotate them. Otherwise, physics are much easier. Thank you for keeping up updated!
@NotAFoe
@NotAFoe Год назад
Soooo impressive!
@hemerythrin
@hemerythrin Год назад
Interesting that your transparency treats objects as hollow shells (so the intensity of the color only depends on the number of overlapping outer surfaces) rather than as "physically correct" volumes (making the color stronger the more voxels it is deep). Could you tell us why you decided to go that route? Was it better for performance?
@DouglasDwyer
@DouglasDwyer Год назад
There are two main reasons for this. First and foremost, it was an "artistic choice" to mirror the style of Minecraft transparency. I want to allow people to create thicker glass windows and sculptures, which I fear would appear noisy and majority-opaque if I used volumetric transparency. With the shell approach, users still have the option to create volumetric transparency by layering different materials, which will both appear even on inner surfaces - but by default, it's easy to create thick glass windows. Second, it does help with performance, because there are typically less details to draw :)
@hemerythrin
@hemerythrin Год назад
@@DouglasDwyer That makes sense. Thanks for the response!
@jarredeagley1748
@jarredeagley1748 Год назад
Great work! Transparency rendering can be a real pain to get working well. Did you look into other techniques like depth-peeling too?
@DouglasDwyer
@DouglasDwyer Год назад
Depth-peeling is an intriguing technique, since it allows for exact results without triangle sorting. However, it places a very heavy load on the GPU (requiring multiple extra render passes and textures). As I want to target lower-end GPUs, this fact made me choose against it.
@user-tm1iq6il7i
@user-tm1iq6il7i Год назад
exelent work
@redstonerti9918
@redstonerti9918 Год назад
Subscription earned.
@TheQxY
@TheQxY 10 месяцев назад
Would be cool if you could add some fake scattering effect, so less light passes through thicker layers of blocks, this would also allow for realistic looking water, where the shade gets darker with depth.
@thertc204
@thertc204 Год назад
Impressive.
@ZealanTanner
@ZealanTanner Год назад
Incredible job. You know there’s something that has both physics and transparency… are you planning to add water to your game?
@christopherbroms2508
@christopherbroms2508 Год назад
he said that he would
@ZealanTanner
@ZealanTanner Год назад
@@christopherbroms2508 epic
@user-xd4nb8wm5l
@user-xd4nb8wm5l Год назад
do you hear of sign distance field ray marching rendering?
@nullp0inter
@nullp0inter Год назад
u deserve more
@brunowallner1670
@brunowallner1670 Год назад
Can you explain how you implemented the per-voxel lighting?
@DouglasDwyer
@DouglasDwyer Год назад
Sure! The lighting is a standard shadowmap, as described on learnopengl.com/. To make the lighting appear per-voxel rather than per-pixel, I just round the position at which I sample the shadowmap to the nearest voxel.
@brunowallner1670
@brunowallner1670 Год назад
Ah i see, I want everything to be per voxel including reflections, but I cannot get any good working method.
@chucksneedmoreland
@chucksneedmoreland Год назад
@@DouglasDwyer real smart, utilizing what gpus accel at (rasterization) and combining that with existing techniques with a twist
@wirththewait144
@wirththewait144 Год назад
you should add a water system like john lins sandbox
@Nolanyoyo
@Nolanyoyo Год назад
Iv tried to do voxel, witch i had multiplayer working, but at some point something started causing lag and I don't have a back up of it before it started happening without going way to far back. I used unity since it would do shadows and a lot of other effects (I add lighting to the blocks with vertex color and add shadows ontop of that). Do you think unity is bad for voxel? I dont know what alternative I could use, I dont really want to learn a new game engine(or new language).
@DouglasDwyer
@DouglasDwyer Год назад
I think that it depends upon your goals! If you're looking to make a game with a voxel art style (or even a game with editable, Minecraft-style terrain) then Unity is an excellent choice. Its batteries-included engine makes it easy to develop gameplay and other fun concepts. This is at the expense of flexibility, though - if you're looking to create a highly-detailed voxel environment (like myself or some other RU-vidrs), then it's probably necessary to build your own engine. However, that takes a great deal of time and dedication, and it's a lot harder to make a feature-complete game. So choose whatever best fits your aspirations :)
@Nolanyoyo
@Nolanyoyo Год назад
@@DouglasDwyer Thanks, ya unity definitely struggles when you make the voxels smaller then minecraft
@bluesillybeard
@bluesillybeard Год назад
Unity allows you to create custom meshes, so you can probably use a greedy-meshing algorithm to speed things up.
@Nolanyoyo
@Nolanyoyo Год назад
@@bluesillybeard i just dont think i would have the time to learn greedy meshes and deal with all the bugs from it
@stablemind
@stablemind Год назад
nice
@shohamtzubery8456
@shohamtzubery8456 Год назад
The transparency is great but I feel like something is missing. Usually for transparent objects, the thicker the object is the less transparent it becomes. This effect is most commonly used to makes it harder to see the ocean floor the deeper the water is. Would something like this be possible to implement with your transparency solution?
@DouglasDwyer
@DouglasDwyer Год назад
Thanks for the question! Another commenter asked something similar, about why I chose to make transparency be "hollow." This was my response: First and foremost, it was an "artistic choice" to mirror the style of Minecraft transparency. I want to allow people to create thicker glass windows and sculptures, which I fear would appear noisy and majority-opaque if I used volumetric transparency. With the shell approach, users still have the option to create volumetric transparency by layering different materials, which will both appear even on inner surfaces - but by default, it's easy to create thick glass windows. Second, it does help with performance, because there are typically less details to draw :) Regarding whether it would be possible, it probably would take some additional work. I wouldn't implement it for normal voxels, for the reasons above. But I would like that kind of effect for water!
@-keimurikxe2252
@-keimurikxe2252 Год назад
I have a few questions. 1. Are you still using Vulkan? 2. What will happen to performance if you decide to increase the number of voxels, for example, by 8 times, meaning that each voxel will turn into 8 new ones?Will this have critical consequences? 3. Have you thought about creating a Discord server?"
@DouglasDwyer
@DouglasDwyer Год назад
Thanks for watching the video! Let me give you the details: 1. No, I switched to targeting OpenGL about a year ago, in Episode 4. This was because I wanted to make my project usable in a web browser, and playable on a wider variety of hardware. It was a tradeoff for portability that I made for my specific design goals. I still do miss Vulkan and its modern features, though. 2. Performance would definitely decrease. For projects like this, achieving good performance means fine-tuning to one's specific use case. As I've designed my engine to work at the scale shown in the video, I fear that it wouldn't run well with larger quantities of voxels onscreen. That's not to say rendering more voxels is impossible - it would just require more engineering and special use of LODs. Dealing with that much data voxel data has consequences beyond rendering, though - I also need to sync voxel objects over the network and store them in-memory, so it's a delicate balancing act :) 3. I don't have a Discord server - unfortunately, I simply don't have the time and willpower to manage one. However, there's another voxel RU-vid called Gabe Rundlett who's working on some really cool tech. He has a Discord server where myself and a number of other people talk about voxels, so you can reach me there if you'd like!
@dimitrisgkofas7787
@dimitrisgkofas7787 Год назад
If you had a ray shooting from your camera and every time that It hitted an object It could pass through or not. If the ray doesn't pass you give at the camera pixel this color. No if it pass It will give to the pixel the value of it multiplied with the coeficient of transparency. Lets say 1 is zero transparency and 0 is full transparency.For exapmle If you have your first object with color red and transparency 0.9 then the number for this ray is for now 229. Now the next object that the ray hits it will add to that number by a factor of (255-229)/255*newcolor*newtransparency and the output color will continue the gerney until it will hit a wall with transparency 1that will set the end for your ray.
@dimitrisgkofas7787
@dimitrisgkofas7787 Год назад
It may give an nice ray tracing touch!
@spr_
@spr_ Год назад
have you considered implementing something similar to "cubic chunks" mod from minecraft? i feel like it could improve performance with more detailed worlds but im no dev (and possibly allow for faster and more view distance)
@DouglasDwyer
@DouglasDwyer Год назад
Yes - in fact, chunks are positioned in a 3D coordinate system already! There's no build height limit.
@augustvctjuh8423
@augustvctjuh8423 Год назад
Very interesting. Btw I think you might be confusing the pronunciation of axis (not plural) and axes (plural)
@-keimurikxe2252
@-keimurikxe2252 Год назад
Sorry, just a couple more... Are there any alternatives to your engine at the moment? Are there any RU-vidrs or videos that have helped you? I also want to dive into learning what you're doing, but your project is the first thing I saw on the internet that seems to align with my views on this idea. And of course, very useful links like the ones you leave in the description, such as the link to Nick's Blog.
@DouglasDwyer
@DouglasDwyer Год назад
No problem - I love answering these questions, it's why I make videos! 1. Yes, there are some other people working on voxel engines. One such individual is Gabe Rundlett - definitely check out his channel if you haven't! His voxel engine is open-source, unlike mine. John Lin, Voxelbee, and some other RU-vidrs are developing engines as well. I'm not aware of anything that's been completed, though. That's part of my motivation for working on the engine! 2. While many of the above-mentioned RU-vidrs provide inspiration, I don't have as many resources to provide regarding technical help. Do you have any specific areas of voxel engine design that you'd like to learn? There are so many topics - rendering, networking, audio, storage, and the like - which is part of what makes engine development so fun. If you're interested in rendering voxels, the first place to start is probably learnopengl.com. The website provides a stellar introduction to computer graphics :)
@-keimurikxe2252
@-keimurikxe2252 Год назад
@@DouglasDwyer I can't believe it, I never expected such a detailed response, thank you so much! You went above and beyond my expectations, and now I'll start exploring the channels and resources you recommended. I already joined the Discord server! I'm absolutely convinced of the success of your project, and I really don't want your idea to die at the stage of creating a game engine, as it happens so often
@Alexey_Pe
@Alexey_Pe Год назад
Do you have liquid in your plans? Water?
@DouglasDwyer
@DouglasDwyer Год назад
I would love to have fluids in the game at some point. However, I have some other priorities - such as rigidbody physics, multiplayer, and gameplay - on which I want to focus first.
@NikZapp
@NikZapp Год назад
The progress is amazing, however I strongly disagree about the way transparency looks. In my opinion it really looks vastly different, but since the transparency you used isn't volumetric in the first place I shouldn't compare it like its physically accurate.
@banditbloodwyndevs8782
@banditbloodwyndevs8782 Год назад
I hope it wasn't asked or shown before: What graphics API do you use? OpenGL? DirectX? Vulkan? I'm asking because maybe I will try to write my own engine just for fun and I'm looking for some examples how others tackle this.
@DouglasDwyer
@DouglasDwyer Год назад
I target OpenGL and WebGL 2.0 so that my engine can run in a web browser. However, I am hoping to switch to WebGPU soon - it is a more modern and ergonomic API that will soon be a browser standard.
@banditbloodwyndevs8782
@banditbloodwyndevs8782 Год назад
​@@DouglasDwyer and the CPU code is Rust as far as I can see :) So you have some experience in writing a rendering engine. What would you say if someone (not me haha) wanted to write his engine in C#? Notice that he tries to make everything manually disposable (via the IDisposable interface), so he can avoid the automatic garbage collection, which can cause stuttering) as good as possible.
@DouglasDwyer
@DouglasDwyer Год назад
@@banditbloodwyndevs8782 I think C# is a fine choice - in fact, my engine started out in C# (see devlogs 1-3). You'll never be able to achieve the performance of a native language, unfortunately - in my testing, I've found that Rust and C++ are about twice as fast. This, coupled with the fact that C# doesn't run well on the web, was why I switched to Rust. That being said, C# is a great backend language and very good for writing business logic. So if your primary goal is to create a scalable application with many features, C# should be fine. For any heavy calculations, though, you might need to offload to native code or the GPU. Regarding optimizations, I think the biggest thing is avoiding heap allocations entirely. So your primary goal should be to use structs, not classes, wherever possible. If I recall, you can implement interfaces on structs - so using IDisposable with structs might be a powerful idiom. But C# is not at the point of being as fast as a native language.
@banditbloodwyndevs8782
@banditbloodwyndevs8782 Год назад
@@DouglasDwyer good points. So one last question: In C# we have projects to organize large solutions. Let's say I switch to C++. There we don't have projects. Do you know an easy and elegant way to organize the code in a similar way beside of simple namespaces?
@DouglasDwyer
@DouglasDwyer Год назад
Depending upon your build system, you can still have separate projects with dependencies - I believe that MSVC allows for this, at least. That said, C++ build systems are a nightmare, and I would recommend against them for productivity's sake. Much better to use Rust and its package manager Cargo - which allow you to easily separate your workspace (solution) into multiple crates (projects).
@UnofficialFoneE
@UnofficialFoneE Год назад
Noice
@Nazo224
@Nazo224 Год назад
How small can voxels be?
@DouglasDwyer
@DouglasDwyer Год назад
Right now, I'm aiming for the scale that Minecraft *would have* if every single voxel were editable. This would mean a scale of 16-20 voxels per meter, since in Minecraft there are 16^3 voxels per block :)
@geko2867
@geko2867 Год назад
Your project look's very cool! But I'd love to know if you're ever going to invest in a better mic, it may help keep people's attention ^^
@DouglasDwyer
@DouglasDwyer Год назад
Hey, thanks for watching! I appreciate your honest feedback. If I could ask, what exactly is bothersome to you about the mic? Granted, it definitely sounds bad in my earlier episodes. In the latest few, though, I've managed to eliminate noticeable artifacts like clipping. Truly, it sounds fine to me. What should I improve?
@geko2867
@geko2867 Год назад
@@DouglasDwyer Your audio seems a little echoey, and a bit distant. I'm going to assume it's a standalone mic and not inside a phone or laptop. If you want to make the most of your mic, first you'll want to stay within 2 feet of it. Next, you'll want to prevent your voice from bouncing around the room, the best way is to have something soft like a blanket surround your setup. This is why some people record in a closet with lots of cloth in there. You can also try comparing your audio to a clip of someone testing their studio quality mic and see how close you can match theirs. I hope any of this can result in some improvement, but your audio has gotten better recently, but your current audio quality doesn't subtract from the videos or your project! Good luck ^^
@aspidinton
@aspidinton Год назад
not baaad
@alessioolivieri5460
@alessioolivieri5460 Год назад
Is this project public?
@DouglasDwyer
@DouglasDwyer Год назад
While there is a public demo, the project isn't open-source at present. I'm still working on refining the technology and turning it into a playable game :)
@djaccount5458
@djaccount5458 11 месяцев назад
Hello, is not true voxels? Its look like 3d cubes not voxels.
@oliverreader2954
@oliverreader2954 7 месяцев назад
Light theme? You make me sick!
@dandymcgee
@dandymcgee Год назад
Your videos have so much potential, but your audio setup is holding you back. If you want more viewers, stop recording videos with a cheap mic in a hella echoey room. It would make your channel blow up so fast.
@st20332
@st20332 7 месяцев назад
i personally don't mind, im here for the info, and its not distractingly bad
@UltimatePerfection
@UltimatePerfection 6 месяцев назад
Your voxels are too big. Less Minecraft, more John Lin, please.
@vinay0arts
@vinay0arts Год назад
Amazing work sir, I am a voxealrtist and feel free to contact me if you need any help with models
Далее
🌊🌊🌊
01:01
Просмотров 924 тыс.
Non-Euclidean Voxels
0:30
Просмотров 14 тыс.
New Voxel Engine Reveal - Crystal Islands Experiment
5:05
To Blur Spinning Things
13:59
Просмотров 3,7 тыс.
GPU-generated DISTANCE FIELDS [Voxel Devlog #8]
12:53
Voxel Planets: 1:1 Scale with Level-of-Detail
0:35
Просмотров 9 тыс.
GORGEOUS, speedy terrain generation [Voxel Devlog #14]
12:20