Thank you all for watching, and for all of your amazing support recently! ❤️ Let me know what you think of hazelengine.com, and if you need a web host definitely check out Hostinger's great Black Friday sale (and use coupon code CHERNO for a discount): hostinger.com/cherno
Hazel looks amazing Will you guys ever include a webgl flavor? Would love to utilize your engine on the browser Also, unrelated, I've got like 4 hostinger servers, and really like their service
I'd very much like a technical breakdown. I implemented instancing in my own Vulkan engine also, but haven't gained much performance because of the way my Mesh system is set up :/ Also if you read this I wan't to let you know I became an actual graphics engineer at an actual game engine company because of you, thank you!
About hostinger: I really recomend it. I work with hostinger a lot, with shared hostings and VPS for clients and Hostinger have improved their infrastructure a LOT in the last few years. Also the support is very good. And if you are in a third world country like me (Argentina) they have localized prices in my local currency so it's really affordable.
It's incredible to see how far Hazel has come! I remember when it was used to create a clone of a Unity Game (Farty Rocket, I think). Respect man, and wishing you all the best!
2 года назад
This project went from educational to a showcase of the behind the scenes improvements.
9:23 was pretty cute for me lol. I know nginx/apache/sysadmin stuff inside out and I am just in awe of you and your gaming god abilities feeling like "how will I ever get there". Of course I'll get there.
Maybe have a look at dual quaternions as a replacement for 4x4 transform matrices. Mathematically speaking, they are the algebra of quaternions in tensor product with dual numbers, and they represent any rigid transformation as a corkscrew motion. You only need 8 floats to store a dual quat, so that's quite the improvement. However you will need to convert them back to matrices in the shaders which may hit the performances a bit. I never used them personally in game dev, as I was more interested in the maths side of things, but I know some big game engines use them. Good job on your website man!
What's the advantage over just a quaternion plus a translation and scale, that would also be eight floats. It also allows any rigid transformation (reflections can be achieved with a negative scale), and it seems like it would be cheaper to convert into a matrix.
Where did you learn most of your game dev related knowledge? Was it self study, university, or something else? I mean, I know you worked at EA, but you probably knew a good amount of game dev and CG knowledge beforehand right?
Backend engineer here, (not game dev) but the process is similar. You learn the basics of programming syntax. You design a few projects from the ground up, learn tons and patterns. You work with other people, learn more patterns. After several real world projects, things become quite easier to implement. Also you don't have to be a super programmer to start, you'll never know everything. You just have to know enough to get started, and then experience will make you a better dev.
After finishing some kind of graphics API tutorial, you can understand most of content in this channel. Most of the technique here is about 10~20 years old. There's also a lot of books about how to make game engine which you can learn from. Or you can also google the specific technique about game development(e.g. ecs system, pbr rendering, instancing) to learn.
@@fangsunjian2 could you recommend some resources like books or articles that go in depth into computer graphics stuff related to game engine dev and game dev
@@anonymoussloth6687 I'm now working for a AAA console game studio. Wish this comment can help you. Here are some books which I personally recommended. I recommend you complete a graphics API tutorial first and read other books casually. You can learn a lot of technique terms from the last two books and just google the specific one when you want to implement it. Introduction to 3D Game Programming With Directx 11/12 (API tutorial) Mathematics for 3D Game Programming and Computer Graphics Real-Time Collision Detection Real-Time Rendering Game Engine Architecture
Would be great to see how changed transforms are handled by renderer. So, how to gpu's buffer checked and synchronized with transforms on cpu's side, when transform gets dirty and needs to be updated in buffer
Hey Cherno, how about doing reaction/analysis videos of siggraph talks or slideshare presentations on subjects you like? I learned a lot digging those but it would be cool seeing your take from a graphics programming POV.
Maybe I missed it in the video. Do you expand the buffer with the transformation matrices every time you spawn a new sphere or do you just have a big preallocated buffer?
Did you check what is more performant: one giant shader storage buffer (probably double or triple buffered) mapped once on the app start and on glsl side layout(...) buffer Transforms { mat4 transforms[]; }; indexed by gl_InstanceID or a second vertex buffer like you've got right now?
My intuition says that it would be better to use a per-instance attribute buffer as it would allow better memory optimization than a global storage buffer where the gpu has to wrangle many random (as far as it knows) memory accesses across multiple lanes.
@@DFPercush I'm not sure what you mean by saying random. If you create a UBO/SSBO (whatever) with size for 1024 instances, the GPU will only loop through linear, well-defined memory region. It's like you'd do something like this in C++ std::vector transforms[1024]; for(int instanceID = 0; instanceID
@@sc5shout Yeah I understand. Hmm, I guess as long as it's a read only buffer in that stage, it would probably be ok. But you might want to check vkPhysicalDeviceLimits :: maxUniformBufferRange (64k on my RTX 2060) as well as maxVertexInputAttributes (32 on same card). Beyond those size limits, you're talking about storage buffers, which are writable from shaders, and that's when you can run into cache coherency issues slowing you down. Although there might be a way to flag it as read only. ... But I haven't tested any of this, so, short answer no. :P
What happens when you spawn new cubes? You create new entity in c++ memory, update the main vertex buffer + update instance buffer? Also, when these cubes are moving is the instance buffer also being updated every frame by some physics engine event? PS. Oh, as i'm writing this, i realized that you probably don't update main vertex buffer - geometry is already there, since it's the same cube.
Just keep in mind that changing shaders is usually quite a bit slower than a whole bunch of draw calls, so it isn't the only thing to keep in mind when doing instanced rendering, especially when you start pushing like 100k instances or more.
@@theRPGmaster The actual context switching is what costs in terms of swapping from shader to another, setup time for the shader is a thing too but generally that is a fraction of the time the context switch takes. So what you want is master shaders that can do everything but are fast as hell, but those are contradictory goals obviously.
I really don't understand why people make systems where x and y aren't ground. And z is up. It's not a unreal fan girl thing, it's a real life thing. Look at GPS. Any coordinate system actually. Anyway. Interesting video
I actually had the idea to implement a kind of instanced rendering, but then didn't properly implement it so I only got some of the upsides, with only minor performance increases. But at least I had the right idea!
Why do the cubes in your game fall at a constant speed, gravity is an acceleration that should be added to the cubes velocity so the bigger the mass of the cube and the further it falls then the faster the velocity until it matches the air resistance at which point its velocity would be constant, or am I barking up the wrong tree, it just looks kind of weird watching the cubes slowly fall
Hey, I've been toying with the idea of using instancing in complex scenes in unity. Basically just taking GameObject scenes we already have and converting all the rendering to using an instanced rendering system to avoid having to do batching (which don't quite work well with baked lights). I was also considering doing culling on a compute, do you know of any obvious pitfalls with this approach? Started watching your videos recently, they're really good.
Do you think it would be a challenge to make it possible to switch rendering apis at runtime in hazel based off how the application is structured right now?
The endgoal of Hazel is a comprehensive learning project / experience. Hazel was never intended to / designed to compete with major engines. Rather it was designed to teach the architectures and design of a game engine to a wider audience
I am a very very stupid idiot and I'd like to know two things. 1. What actually _is_ a draw call? Why is it expensive? Why is it expensive for the CPU and not (presumably) the GPU? What does it arrange to happen on the GPU? 2. It seems obvious that you can't just give a triangle's mesh data as an instance and use that triangle for literally everything in every scene forever, but why?
A draw call basically starts a "thread" on the gpu. The reason they are considered slow is that it takes time for the hardware to set up everything before it starts running your shaders. It's like booting up a computer, kind of. It's not really that bad, but if you're doing it thousands of times per second it starts to add up. There's also a "ramp down" time. Some pixels might finish running their shader before others, and the gpu has to finish everything before it can switch to a different pipeline and start rendering something else. So you're not getting full utilization at that point. 2. Actually, in theory it might be possible to render a scene by using several instances of a single triangle, depending on the material, and just transforming that. But that would take a lot more data to store all those transform and be generally less efficient than having an indexed mesh. Plus you'd have to generate that asset data somehow for all those transforms, and that's just not the way 3d editing software works. But fundamentally that's what a mesh is.
I had a programming and cybersecurity blog and it was taken down by hostinger, including the domain name even if the content was 100% legal and educational, never trusting hostinger again
@@kyleleblancvlogs3820 Yeah but maybe you don't want the whole world knowing your home ip address. It's important to mitigate the risk of getting "cancelled" when looking at hosts though, for sure. It's an unfortunate calculation that has to be made these days.
@DFPercush you don't need to expose your home ip. You isolate your home network through a bastion server that you harden for security and that allows outward traffic to the internet. Your internal network and all its ips would be hidden and not accessible from the outside world. I am considering setting up a data center for hosting etc. But that's....hard. so we will see. It will be small at first.
ok, this is looking like unity too much, you need to give your engine a personality. At least change the UI man. and how you're saying optimization October, but it's already December?