Fragment Interpolation - Vulkan Game Engine Tutorial 07

  Рет қаралды 25,494

Brendan Galea

Brendan Galea

Күн бұрын

Пікірлер: 83
@itr00ow93
@itr00ow93 3 жыл бұрын
I like both theory and code, there are already many other tutorials with just code
@jamesrivettcarnac
@jamesrivettcarnac 3 жыл бұрын
I know! It's super helpful and so well done.
@Aaron-zv5xd
@Aaron-zv5xd 3 жыл бұрын
Yours are the best Vulkan tutorial videos i found so far. The current Balance is great. Imo understanding what to code is way more important than the actual code.
@BrendanGalea
@BrendanGalea 3 жыл бұрын
Ok, Great to hear!
@obiwanus
@obiwanus 3 жыл бұрын
Well, we all know that the real reason this series is great is the chalky style of pictures
@gvcallen
@gvcallen 3 жыл бұрын
Theory in the videos is awesome! Anyone can learn how to use an API to call functions, but understanding how everything is linked together is the real challenge! Theory and explanations about the inner-workings of Vulkan help immensely to understand when you can use what, and the applications of the different functions and options in one. Thanks so much for this series!
@BrendanGalea
@BrendanGalea 3 жыл бұрын
Thank you, I'm very happy to hear that!
@JosephWMicheli
@JosephWMicheli 2 жыл бұрын
I'm somewhat shocked that more of your videos don't have more views - you've done a phenomenal job. I'm currently implementing an engine using Rust and Vulkan (via the really impressive Vulkano crate), and I've repeatedly referenced your videos in the process. The fact that I have had no issue following along with your C++ implementation shows the high quality of your videos. I especially like the illustrations you provide, because it lets me visualize what your code is doing so that I can write the same thing in Rust more easily.
@hexen93
@hexen93 3 жыл бұрын
The balance is great so far. I think you touch on important foundational concepts that must be understood to take advantage of Vulkan (and by extension other graphics APIs) effectively. I wouldn't shake your balance up too much so far, I think you're doing great.
@sanduchicu7545
@sanduchicu7545 3 жыл бұрын
Dude you put so much effort in these videos
@BrendanGalea
@BrendanGalea 3 жыл бұрын
Thank you, glad you like them. Vulkans still a pretty niche topic but I’m happy with the growth of the channel so far!
@guitarvoicing
@guitarvoicing Жыл бұрын
ha 3rd time I am watching these tutorials...I hope you get back to it at some point. Amazingly well explained. Thank YOU!
@phannguyenthanhtung8600
@phannguyenthanhtung8600 3 жыл бұрын
Thanks to your visualization, I can get the idea of the inputs and outputs for vertex and fragment shader stages. Many tutorials I have seen are wall of words and codes. Moreover, the colorspace link is really interesting, this is the first time I've heard about it. Thank you very much, your channel deserves more!
@JMRC
@JMRC 3 жыл бұрын
Great series! I like the theory the most. It's knowledge I can remember so that the next time I can rationalize the code any project.
@Sir_Pickle
@Sir_Pickle 2 жыл бұрын
Balance of theory and code has been really good! as a beginner it is helping a lot. Keep up the great work :)
@cnsujeer
@cnsujeer 3 жыл бұрын
Current style of teaching is helping me to visualize the things rather than just look at bunch of things getting initialized. if possible, continue the same way. :-)
@openroomxyz
@openroomxyz 2 жыл бұрын
I think it's very good balance of Theory and Code, I would even say perfect.
@VoylinsLife
@VoylinsLife 2 жыл бұрын
a month ago I had no idea how assigning of these VertexInputAttributes worked. This time I tried to do it by myself before watching this video and got colors working :D Thanks for the great learning experience! Also last time I was confused with how data get's assigned, I started thinking of a struct as some kind of array, not sure if this helps anybody but that's what made me figure out how structs work in cpp :p
@nikola3730
@nikola3730 Жыл бұрын
This can easily be a paid course, so much detail, thank you so much man!
@goncalosoares8483
@goncalosoares8483 3 жыл бұрын
Great explanations! I really like the balance between theory and coding
@suncrafterspielt9479
@suncrafterspielt9479 3 жыл бұрын
Brilliant series. I just had to watch through all of them.
@frenato00
@frenato00 3 жыл бұрын
Great series! I'm currently in 2nd year university studying computer and informatics engineering and I learned more this week following your tutorials than in a month of computer graphics class. Keep up the good work. Regards from Portugal. Btw I think this is not yet in the playlist.
@BrendanGalea
@BrendanGalea 3 жыл бұрын
adding to the playlist now, thanks!
@rutvikpanchal466
@rutvikpanchal466 3 жыл бұрын
I really love your videos, its the best way to learn vulkan and computer graphics in general. Please continue with the same way you are doing right now, i love those in between theory slides coz they help me build the computer graphics pipeline in my mind. Also what are the topics you'll discuss in upcoming videos?
@BrendanGalea
@BrendanGalea 3 жыл бұрын
Thank you! And still trying to figure out the exact ordering but we have push constants, secondary command buffers, 3d transformation matrices, diffuse shading and per pixel lighting, staging and index buffers, loading 3d models, user input and a movable camera, game object model, uniforms and descriptor sets, textures, phong/specular shading, terrain generation, fog, sky shader, player movement. So like 15 or so more to go to cover the basics... Sorry for the long waits between tutorials, I've been running a bit behind. Trying to get to the point I can ideally have a weekly releases. In the meantime if you're not familiar with linear algebra I recommend checking out the first 5 or so videos in this series kzbin.info/aero/PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab by 3blue1brown. It's excellent and will help with the understanding of 3D transformations and the mathematics we'll be using for upcoming videos.
@jtaimneas
@jtaimneas 3 жыл бұрын
Like balance of theory and code. good stuff!
@7katona7
@7katona7 2 жыл бұрын
Probably late on suggestions, but I will leave this comment here anyways. I am most satisfied by your current approach as I am here for Vulkan tutorial. To elaborate: I like that you explain briefly and leave details optional so I can choose to read them and I read them all so far. I like the way that you focus on progress and won't just type out the 500 line of code if it has no current meaning. I like that you provide git-diff for each video. I like that you don't dwell on offtopic themes (such as build-scrit // platform // C++ language and/or keywords).
@BrendanGalea
@BrendanGalea 2 жыл бұрын
Thank you! Feedback is always very appreciated. Any suggestions on things you think I could work on/improve?
@zentrocs
@zentrocs 3 жыл бұрын
Oh my god. Thank you so much for making this
@arthurklause5251
@arthurklause5251 2 жыл бұрын
Hey ! I like the balance like this ! :) Thank you for your tutorials !
@jentev7217
@jentev7217 3 жыл бұрын
Another great one, keep it up!
@suncrafterspielt9479
@suncrafterspielt9479 3 жыл бұрын
Just a quick fix Timecode 11:15 should be “intro” Again thanks for the insanely cool series
@BrendanGalea
@BrendanGalea 3 жыл бұрын
Hahaha next video will be a short intro and mostly code.
@yegipark4803
@yegipark4803 2 жыл бұрын
Thank you so much for the amazingly helpful video!
@BrendanGalea
@BrendanGalea 2 жыл бұрын
Glad you liked it!
@codinglikeafox4443
@codinglikeafox4443 3 жыл бұрын
Love your videos
@mscmajid
@mscmajid 3 жыл бұрын
The best Vulkan tutorial. Tnx
@Sf37li0
@Sf37li0 3 жыл бұрын
Great tutorials, looking forward to more videos! It would be cool if you set up something like a discord server where we can discuss issues or share stuff that we've created with the engine.
@BrendanGalea
@BrendanGalea 3 жыл бұрын
This is a great idea! You'll be the first to know once I've got it set up.
@BrendanGalea
@BrendanGalea 3 жыл бұрын
discord invite, discord.gg/3bA7Ysau still a work in progress but I did say you'd be the first to know :P
@hrwang1936
@hrwang1936 3 жыл бұрын
you are the savior! please keep up!
@eugenbondarev4086
@eugenbondarev4086 3 жыл бұрын
Thanks for your efforts!
@KamiSlayerz
@KamiSlayerz 6 ай бұрын
Great explanation!
@pedrolino855
@pedrolino855 Жыл бұрын
I'm not an expert, but at 7:23 I think I can suggest a small optimization, please correct me if I'm wrong - always eager to learn more. So, modern compilers are free to add padding to a struct to optimize memory allocation for the machine (CPU), so the sizeof(Vertex) last bytes might actually be just padding zeros, not actual data. To use the correct size, and potentially use & jump over less memory, you can encapuslate the struct on the header by: #pragma pack(push, 1) struct Vertex{}; #pragma pack(pop) PS: this 'trick' may can come in handy for some hardcore programmer's out there ;)
@VoylinsLife
@VoylinsLife 2 жыл бұрын
At 8:58 we set the offset and such, but how does the attribute binding know which variable to use? Do these automatically get assigned in the order we put them in the vertex struct? Or does the offset tell from what point the variable starts which it has to pass to the shader?
@mrshodz
@mrshodz 7 ай бұрын
Brilliant video.
@dexterman6361
@dexterman6361 3 жыл бұрын
@ around 7:50 Is there any way I can use some template magic or some other constructs to generate the offsets and generate the binding info? If I'm not mistaken, this will require some form of reflection support from the compiler, yes? I've gotten to the point where I'm creating the pipeline myself, but am following your code for the videos. Thanks for the really amazing series!
@BrendanGalea
@BrendanGalea 3 жыл бұрын
ya it is possible with some template tricks and use of the preprocessor... but it isn't very straightforward. C++ just isn't made with reflection in mind. There are a few other methods that can be used to coordinate shaders and their attribute descriptions, such as dynamically updating attribute info in the .spv code before creating the pipeline. One system I've been using recently is a Builder pattern for Models, and then a helper function in the model class that lets pipelines to specify the order of their attributes, and the function will generate the correct binding descriptions. I might go over this in more detail in a future tutorial. You could also extend the system to provide hints as to which attributes should be interleaved into a single buffer, or kept separate. Which can be useful for example if you wanted to make a deferred renderer, where the first render pass only uses positions and normals for all objects. My advice would be not to worry too much at this point about it. A mistake I made with one of my first engines was trying to make this super flexible system for automatically binding attributes and uniforms. It ended up being way overkill since in reality your attributes tend to be the same 90%+ of the time.
@dexterman6361
@dexterman6361 3 жыл бұрын
@@BrendanGalea > ya it is possible with some template tricks and use of the preprocessor... but it isn't very straightforward Haha maybe that's a rabbit-hole for an another day! Got my hands full with vulkan already! > My advice would be not to worry too much at this point about it That's a very good point, thanks for putting me back on the right track!
@japedr
@japedr 3 жыл бұрын
Well, I would vote if possible for a reasoned explanation of the remaining unexplained code and (most importantly) why it is a "reasonable default". In particular: the queue families, buffer types and buffer manipulation; and also the synchronization magic in the swap chain. But I guess you were going to cover most of that sooner or later, so just do what you prefer, at this point I blindly trust your judgement. Also I have a question, if you have used Vulkan compute pipeline (with shaders,etc): do you think it could ever be competitive against Cuda? (after removing all the boilerplate, of course)
@BrendanGalea
@BrendanGalea 3 жыл бұрын
Thank you for the suggestion. There are a few topics I’d like to cover first but ya I should probably raise the priority on explaining the code provided sooner rather than later. The code is reasonable-ish. Ie) It wouldn’t be something that is production ready, but is appropriate for beginner/intermediate engines. It very closely matches what would be written following vulkan-tutorial.com with my thoughts being that by reading the links provided in the video descriptions you’d get as complete an understanding of the code as I could provide if i made a video going through it right now. Once the series is a bit further along I’ll have some more context to be able to provide more meaningful explanations. And unfortunately I don’t have enough experience with compute to add anything meaningful to the conversation.
@yaircambordamorocho4506
@yaircambordamorocho4506 3 жыл бұрын
Thanks for the tutorials, very well explained, now I have a question, if I wanted to draw simple lines with a starting point and an end point, how could I do it? Should I create a new pipeline or use triangles by repeating one of its vertices?
@BrendanGalea
@BrendanGalea 3 жыл бұрын
It's probably better to create a second pipeline for specifically drawing lines, and set it up with your configInfo.inputAssemblyInfo.topology to VK_PRIMITIVE_TOPOLOGY_LINE_LIST (or strip). I briefly cover this in tutorial 04 in the triangle list vs strip section of the video, but for triangles rather than lines but it's the same idea. One other property it may be worth looking into is configInfo.rasterizationInfo.lineWidth , just note that for lines larger that 1.0f I believe you need to enable the wideLines gpu feature. I've never tried rendering lines in vulkan before, but I think that's all it should take.
@wChris_
@wChris_ Жыл бұрын
actually gpu processing is SIMT (Single instruction, multiple threads) wich is a combination of SIMD with multithreading.
@胡帆-s5h
@胡帆-s5h 2 жыл бұрын
Hi guys, I just get a question on GPU memory. In this tutorial, we have add a fragColor as output in our vertex shader. But shouldn't we also allocate GPU memory for this fragColor like the way we did for the per-vertex position and color? How does vulkan "know" where to put fragColor after vertex shader and where to read it when doing fragment shader? Thanks in advance!
@DejaimeNeto
@DejaimeNeto 3 жыл бұрын
Oh nice, looks like I was early this time!
@christophbritsch1074
@christophbritsch1074 3 жыл бұрын
What were the steps if you wanted to replace the triangle by a cube in 3-dimensional space? I tried to wrap my head around the necessary steps but couldn't quite figure out what to do or where to start as I'm still very new to this graphics thing. Also my DebugMessengerDestroy function is crashing the destructor every time I try to close the app and throws a validation error and says it can't find any Object of that Type at a given address. Your vids are awesome btw ;)
@BrendanGalea
@BrendanGalea 3 жыл бұрын
I think tutorial 10 will be a 3D cube. It's a bit too much to explain in a youtube comment.But if you want to get ahead I highly recommend the first 5 episodes of this series on linear algebra by 3blue1brown kzbin.info/aero/PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab This is the mathematics that underlies almost everything in 3D graphics. To make something appear 3D we essentially have to perform operations on our geometry to rotate and transform points based on the perspective of a virtual camera. Hmm I'm not sure about the debug messenger. What's the error message, and what operating system are you using?
@nikola3730
@nikola3730 Жыл бұрын
Balance between theory and code is best, too much code gets tedious and tires you out really quick but alot of theory gets boring as we wont understand too much of it and get lost as a result. The current balance you keep is ideal
@chakibchemso
@chakibchemso Жыл бұрын
this tutorial series is phenomenal, thx man for the great work. also i think the color space should be linear to give better and accurate colors, idk tho for now im leaving it in VK_COLOR_SPACE_BT709_LINEAR_EXT it looks great.
@moonyl5341
@moonyl5341 5 ай бұрын
great tutorial but how come its B8G8R8A8 not R8G8B8A8?
@jerrys2292
@jerrys2292 2 ай бұрын
For most practical applications; Apple products screens, and thus GPU, order color components differently than most everyone else
@xiaodulin3765
@xiaodulin3765 2 жыл бұрын
nice!
@theshortcut101
@theshortcut101 Жыл бұрын
Hey any chance you'll make more videos?
@dexterman6361
@dexterman6361 3 жыл бұрын
How does the shader know which binding to look at? The binding number?
@BrendanGalea
@BrendanGalea 3 жыл бұрын
yup for attributes all the shader knows is the location you specify and the data type. From the data type it can infer the size of the variable and how many bytes to read. So if your shader binding locations don't match up with the attribute descriptions it can be difficult to debug because the shader will just read in garbage data. Also each location "slot" is only 32 bytes. So if you have a variable of type dvec4, which is a 4 component vector of doubles (so 64 bytes), that will actually take up 2 locations. In your shader you would have layout (location = 0) dvec4 myDoubleVec; // also takes up location 1 layout (location = 2) float someOtherVar; // next valid attribute location starts at 2
@dexterman6361
@dexterman6361 3 жыл бұрын
@@BrendanGalea Thanks for the details!
@iendedyoui
@iendedyoui 7 ай бұрын
Only the top half of the triangle is being displayed (blue/green cut off).
@gasparliboreiro4572
@gasparliboreiro4572 7 ай бұрын
3:22 that is outright incorrect, that is just if you linearly interpolate, barycentric coordinates aren't that
@dr.raymard9540
@dr.raymard9540 2 жыл бұрын
my triangle with multicolor wasnt generated at the center, rather to the right, did i mess up some coding somehow?
@dr.raymard9540
@dr.raymard9540 2 жыл бұрын
i fixed the problem, in the offset of the position variable of the attributeDescription, i changed the color value to position, and then the triangle was centered, i just wanted to inform that i found the step i missed :)
@ericlanglaismm
@ericlanglaismm 2 жыл бұрын
@@dr.raymard9540 Thank you! You probably saved me a lot of time:)
@meepk633
@meepk633 2 жыл бұрын
Why pass the color from vert to frag? Isn't that an extra copy per vertex?
@VoylinsLife
@VoylinsLife 2 жыл бұрын
I guess when we pass in our position and color, they go to our vertex shader only, that's why we need to pass them to our frag from the vertex. You can see this by how we put the location in the vec3 out, it is 0, which is actually the position on the in variable. You have to see the process as the route he explained earlier, you can't just pass data a couple of steps ahead in that path, you need to carry it along.
@flocela
@flocela 3 ай бұрын
In case someone else has this error: Error: vkCreateGraphicsPipelines(): pCreateInfos[0].pVertexInputState->pVertexBindingDescriptions[1].inputRate (29) does not fall within the begin..end range of the VkVertexInputRate enumeration tokens and is not an extension added token. The Vulkan spec states: inputRate must be a valid VkVertexInputRate value Bug in createGraphicsPipeline(): vertexInputInfo.vertexBindingDescriptionCount = static_cast(attributeDescriptions.size()); SHOULD BE: bindingDescriptions.size() not attributeDescriptions.size()
@cactusmamelu313
@cactusmamelu313 3 жыл бұрын
More !!!
@krabatzki
@krabatzki 3 жыл бұрын
First this is really awesome. I also read the vulkan-tutorial.com/ and with your videos it comes much better together. But I still feel i lack the basic understanding of engine development, do you have any good reading resource recommendations about this? Thanks a lot and keep up the great work.
@BrendanGalea
@BrendanGalea 3 жыл бұрын
Not really, this has been something I've been looking into. I've mostly relied on old course notes and online resources. Game Engine Architecture by Jason Gregory is a textbook that's commonly recommended. It's rather expensive to buy physically though... Here are some good course notes which I think can serve as a pretty good introduction. homepages.fhv.at/thjo/lecturenotes/sysarch/index.html Also this tutorial here on entity component systems I've found myself referring back to over multiple years and I'd say is a great place to start www.raywenderlich.com/2806-introduction-to-component-based-architecture-in-games And glad to hear that you like the tutorials so far. Thank you for the support!
@RealGivre
@RealGivre 3 ай бұрын
" a(1-t) + bt " , not " a(t-1) + bt " (yeah, i'm grumpy)
@offbeatstuff8473
@offbeatstuff8473 3 жыл бұрын
I wish you would use nim for these tutorials. Why ? See github.com/krux02/opengl-sandbox - A nim project for writing shaders inside the code using the language itself
@BrendanGalea
@BrendanGalea 3 жыл бұрын
Nim looks really cool, I had never heard of it!
Swap Chain Overview - Vulkan Game Engine Tutorial 05 part 1
17:08
Brendan Galea
Рет қаралды 52 М.
Wait for the last one 🤣🤣 #shorts #minecraft
00:28
Cosmo Guy
Рет қаралды 23 МЛН
Это было очень близко...
00:10
Аришнев
Рет қаралды 7 МЛН
I Optimised My Game Engine Up To 12000 FPS
11:58
Vercidium
Рет қаралды 709 М.
Vertex Buffers - Vulkan Game Engine Tutorial 06
25:14
Brendan Galea
Рет қаралды 38 М.
Introduction to shaders: Learn the basics!
34:50
Barney Codes
Рет қаралды 353 М.
Fixed Function Pipeline Stages - Vulkan Game Engine Tutorial 04
18:42
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 724 М.
Descriptor Sets - Vulkan Game Engine Tutorial 20
27:12
Brendan Galea
Рет қаралды 21 М.
Graphics Pipeline Overview - Vulkan Game Engine Tutorial 02
20:24
Brendan Galea
Рет қаралды 165 М.
Coding Challenge #90: Floyd-Steinberg Dithering
28:51
The Coding Train
Рет қаралды 438 М.
ALL IT TAKES... A Vulkan Story
29:10
The Cherno
Рет қаралды 131 М.
Wait for the last one 🤣🤣 #shorts #minecraft
00:28
Cosmo Guy
Рет қаралды 23 МЛН