Blender to Godot with gltf

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
greetings my name is Brian and I'm going to build a video game in the last video and I'll have a link to that right up in there someplace I'll have a link to that in the last video we showed you the overall concept how we're going to take things and put them in blender using 2d assets we've made in or perhaps in Krita and now we're gonna show you actually show you how are we gonna get our information how we're gonna get our 3d models from blender and dump them over into the Godot game engine so that we can use them this is a missing link for a lot of people so a lot of folks have a lot of trouble getting the information from blender over into Godot while retaining all the textures and being able to make changes back and forth so you dump it into your video game and you discover that's not exactly what I want I need to go back over to blender and tweak my material or change the UV or change the materials textures or normals or something and then when dump it all back into Godot and I want it to just work what is my workflow that's what we're gonna do today my name is Brian Carey and I am the savvy barbarian [Music] [Music] okay so let's say we spent a lot of time in blender and we've made a really cool asset and we've we've modeled it we've textured it we've put normal mapping on it and it's is just exactly the way we want it and then we want that thing to be over into the Godot game engine how do we do that how do we do that repeatedly how do we do that in a way that makes sense we've got an easy workflow let's dive in okay so here's blender this is blender version let's see what we got here anyways splash screen this is blender 2.8 - a I like blender 2.8 it's almost as good as blender 2.79 except they took away all mighty panel stuff and replaced it with these miniscule couple of icons and I really hate that I want my tea panel back but I don't think that's happening anytime soon it was it was cool there was every button Under the Sun over there you know like all the physics buttons but anyways blender 2.8 it brings some other different things to the table I just wish I had my old tea panel back anyways so here's how we're gonna do step 1 everybody tells you when you start blender that the first thing you need to do is delete the starter cube do not delete the starter cube the starter cube is your friend starter cube has a name he has feelings his name is Jeffrey the monkey is named Suzanne the cube is named Jeffrey what so we're gonna work on Jeffrey here and let's just open up a quick glance at the shader editor so we'll flip that over to that thing get off that a little bigger okay so let's give him let's give Jeffrey a material now we'll go to the material tab which is this little guy right here and one of the things you want to do is not leave the default names just be material because what's gonna happen is your materials are gonna go over into Godot and Gotha is gonna see the same name and if you keep leaving generic material it'll import this and I'll name this material we leave that just where it is material dot material thanks Godot oh well what else is it gonna do I don't really blame them for that so you should put a unique material name down for everyone otherwise it's gonna start sharing materials and it's gonna confuse you why you're getting the wrong materials on the wrong meshes so just name them smart and you don't have to worry about it so we're gonna name this guy Rix dot now we're gonna give Brix Matt yes because Brix material the end well that problem solved okay next we're gonna actually set up a quick Brix texture and we can we can actually add a material here we can say texture image texture and we're gonna open a texture that I just happen to have handy brick and this lovely castle brick thing here and we're gonna connect that color to the base color now if I go over hearing @z excuse me I should be able to hit the material preview and now Jeffrey looks all rigged up and that's that's pretty good let's let's also add a normal map the normal map is it's another map that's it's kind of this nifty lavender color it gives the XYZ coordinates so that every little Texel on the surface of your mesh can be perturbed in a certain direction so it it's really not doing any changing of your geometry but it's adding shading so it looks like there's a lot more material there there are a lot more texturing there then there really is so it's a great trick and if you get a chance to use normal maps you should put them in your video game because it will make it look a whole lot better so I'll add one more texture and this one we're gonna add let's see bricks you can see it's kind of this nifty lavender color so this this material was made from this excuse me this Pete ping file was made from this one and if there's interest maybe I'll make a video on how to make a normal map you can see build these in blender and it's pretty cool so you can't unfortunately just connect these here these apparently yellow to blue is bad so what you've got to do is add a vector normal map because we have a normal map so now yellow goes to yellow and normal goes to normal blue goes to blue and tada did you see this that's kind of that's kind of cool so it's it's added all this surface detail that isn't actually there it's still just eight vertices but we can turn the strength of this up and down to it can slide this back and forth and we can see no strength up to you can actually go over one which I don't recommend doing um set that to about 0.5 and it looks like we've got some some little defects and some little bits inside the brick that we wouldn't otherwise have it looks wicked shiny so I'm gonna turn the roughness down right there go all the way left zero is in black is totally shiny and one white is not shiny at all so you can see all the specularity all the high reflection stuff seems to go away when I want to drag it down so leave that maybe about a point nine or something give that just a hint of specularity all right so Jeffries all set and that's what he looks like so I want that brick I want Jeffrey to show up in the Godot game engine looking exactly like that here's how we're gonna do it you might think we're gonna use the colada exporter you'd be wrong and you're thinking of course not everyone knows if you're gonna use Godot you use the better colada export no colada is terrible I've had a terrible time with that it seems to drop my textures I can get him over but then I have to reconnect them manually every time I've had just a terrible run of luck using the colada or the better cloud I I personally recommend against it this is the way that works we're gonna go up to file export and we're gonna select the GL tf2 exporter this is our friend so give that a click and here is the settings that we need to look at so the format that you should pick if this isn't here you want to hit the N and this will show up so if you hit the by default I believe it shows the GLB this binary format it works but I have trouble with this one it doesn't always give me the textures the way that I want them to come over the second one here embedded gltf that one works really good so choose embedded you can type some nonsense here if you want to copyright barbarian yay and I don't know where that actually goes if anywhere so what do I include if you hit the include drop-down here we're gonna say I just want selected objects yeah I've got Geoffrey selected but I don't want the camera or the Sun or the lamps or any of that other stuff coming over I just want my selected object so typically I will collect I will select the selected objects checkbox and that's really all I need right there under transform you want this Y up to be checked and the reason is because blender and Godot have different XYZ axis transforms so quick note here's here's how that works they're both left-handed there's right hand which just changes the positive and negative value but blender and go dad are both left-handed so I'm going to think hold your left hand up and you're gonna make X Y & Z so what's gonna happen is this is blender so X is in the positive direction going out sideways Y goes into the screen and Z goes up that is blender Godot does this okay so it's still it's still closed X is still same fingers X is still sideways but now Y is in the positive direction goes up and Z in the positive direction comes back out of the screen which is why in Godot most of the time your camera is facing in the negative Z direction so you need to know that blender is Z up and Godot is y up if you don't check this box right here then what's gonna happen is all your geometry and your materials are gonna come over into Godot but they're all gonna come over locked over 90 degrees onto their side so leave that checked under geometry typically these defaults are fine you do want the UVs to come over this is a the way that we've mapped the effect I should probably go back and tweak that just a wee little bit the UVs are how we map the 2d texture onto the 3d object I'm gonna cancel and we'll come right back but I'm just gonna show this real quick so here is my 3d object and we have I'm just gonna open up another section of window here and I'm gonna show my UV editor now the castle brick here here is my 2d texture and in this window we see that this 2d texture is wrapped around this 3d object so how do we do that so if we hit if we go into edit mode here we can see the shape of this cube this is six squares here and these are the six faces of this cube so that is how that's unwrapped and we're gonna do something else a little fun here just to test it we're gonna scale this wrapping up so now we're actually going outside the line and we're gonna let that happen so just scale that up I'm gonna try and put the edge of the brick roughly on the edge of the cube so now we've actually you ve unwrapped us and as as we go outside the lines here outside the edge of the 2d object we're gonna wrap around to the other side and pick up from there and keep on going and we want to see if Godot respects that okay from the top we're gonna do export gltf - we have selected gltf embedded remember my settings from the last time I am going to include only my selected objects I am going to make sure that my Y up is checked geometry so I do want the UVs to come over that's important I want my normals that's the direction that each face is pointing I want that to come over that's good vertex colors don't think I have said any of those but sure materials of course I want my materials to come over that's the whole point of this now this box here compression usually you think that compression is a good thing in this case compression means destroys everything and mangles it beyond all hope and recognition so whatever you do do not click that box just leave it empty it means I'm broken I don't know what that's for lastly animation oh let me one more thing I didn't touch your apply modifiers so usually what's gonna happen is you do want the modifiers to be applied if you have say mirrored your monkey head and decided to cut off half mirror the X make some changes and ship it over when you don't apply modifiers you're gonna get half a monkey head over and go die so you definitely want that check I'm not checking it because I know that I have no modifiers in blender that I've applied Geoffrey has no modifiers so I don't need it also if you're gonna use shape keys and that's probably the subject of a whole other video shape keys I believe get treated as if they are modifiers even though they really aren't so you can't get a shape key to come over if you have this checked and it gets really messy if you have an object that has modifiers and shape keys so in some cases you want it often in some cases you want it on at the same time but for our purposes we have no modifiers we're gonna leave it off typically if you have any modifiers apply them yourself or you can check that here finally animation I don't have any animations in blender coming over I don't have any shape keys coming over but it doesn't hurt to leave them checked so I'm going to so I got pick where this thing's gonna land before I hit export so I'm gonna go over to my Godot folder and let's see here I think I've got a temporary folder I'm going to where did that live kill me for that sounds like a lovely place I'm gonna overwrite Geoffrey right there and we're done now we'll just head over into Godot I'm gonna find my project well edit it and you can see it's importing the assets and I named it Geoffrey and it's Geoffrey gltf right if this says GLB then you forgot to change the checkbox there though drop down in your exporter so I'm an openness and I'm gonna say open anyways if you say you new inherited he starts running down the road in some other direction the point is gltf is not a native format of Godot it stores things in its own format so I'm gonna hit open anyways make any changes I might need to make and then save it in the right format so open anyways and there it is so there's Geoffrey my default cube he's got the lovely brick texture and if you look we zoom in a little bit here we can see we even have those normals so the surface is perturbed just a little bit to give a little bit more realism so what we're gonna do is I'm going to select my mesh and I'm gonna select it here if I click on the shape so there's two things going on here also so you've got surface one and that's this surface you can see this is the the material but if you scroll down a little bit you've also got a material down here now I don't have one loaded but why is there material here and why is there also material here so that's actually a really cool feature and a lot of people like I don't understand well I'm gonna explain why that's really cool when we and we can change this in the import and I'll show you where that is in just a second if you import something and you stick the material on the mesh like it is here then all instances this particular scene every time I see this mesh it's going to have this material and that's cool I probably want that most of the time but maybe I want to do something particular like when Mario runs along and hits it with his head I want it to turn yellow or something okay so in that case I would like to change perhaps the material of this object but just this one not all of them in my scene if you change the material here down here in the node the material applies this material here only applies to this object so all the other objects you might have twenty cubes in your game if you change this material on the node only the material on that one node the other 19 are fine you're just changing this one so Mario comes up hits this one this one turns yellow if you change this material yellow then every cube in your entire game just turned yellow if you change this bottom one so that it's on the node and not the mesh then only the one materials me only the one object changes color so it's really handy and this one down here this this material on the node will supersede whatever you got up here in the mesh which is cool so that works out great in most instances when you've got you know all your cubes are this brick color and I want to change one I can just dump a material in here into the onto the node material my one changes and I'm good to go and I don't have to worry about it so it's kind of a neat concept it's really neat that somebody thought of that here's where you set that by the way so if we select Jeffrey in our file system and you go up here to import what you got slide that down out of the way a little bit is you can tell it where the material is going to be so if you see in the into this materials section the location I'm telling it I want you to be on the mesh so by default it's picking mesh but if you select node then the material won't be here it will be down here instead okay we're almost done here so what we got to do now is we're going to take our new 3d object that does very little and that's fine and we're gonna do is we're gonna save this object we're gonna say save scene as and we're gonna pick a place and we should probably organize this but since this is just a quick quick and dirty I'm not gonna bother so I'm gonna save this as Jeffrey dot T SC n so that is a text-based scene so I can actually edit this for the text editor which is pretty cool so I'll go ahead and click Save and now I've got a Jeffrey gltf right here and I've got a Jeffrey dot T SC n so this T SC n is the native go dot scene file this is the one that I want to use don't ever use the gltf one ever again just forget all about it you probably should make a separate spot in a folder so that you can collect them all they're all the ones that you bring in from blender because eventually you're gonna want to throw them all out now you won't want to throw out the material files but these gltf things you don't want to use those anymore that's not what you linked to so now we're gonna say start our new 3d scene and we'll call this world and then we'll add say a quick camera so we can see what we're seeing let's say camera rotate that down a little bit make sure that we like roughly what we're looking at and then up here on the world we're gonna add we're gonna add a light like this directional light sure and we'll rotate that so it's pointing roughly down and finally we're gonna add this we're gonna use our instancing of this node so we've created a node this node down here it's gonna be called Jeffrey T Sen so we're gonna use the link button we're gonna pick not the gltf one but the Jeffrey T SC n that's the one I want okay so I'm gonna move my camera just a little bit get that looking kind of roughly decent and if I can run my game at this point and it works all right Cena's never saved one save this well yes yes I do world sure we're gonna name that world safe at the end and then there's my game so there's Jeffrey I've got my normal map going and everything is good so that's the basic workflow I created in a blender I exported it as a GL tf2 I've used the embedded oh my chair broke okay guys this is Bryan from the future now you think you got this all figured out and everything's fine and everything is uh it's working but let me tell you later you go back into blender and you find out that none of this stuff is updating you've updated your newbies you updated your textures and jeffrey is sitting there looking like he used to so there's a little bit more to this video stick stick with me here we're gonna show you what happens when this gets fixed but let's say that we will change our mind a little bit and I don't want Jeffrey to be a bunch of concrete blocks I'm gonna change what he looks like and put a new material on here let me show how easy it is to tweak that so come over here I'm gonna hit f8 stop this flip over to blender and let's just change the material so I'm gonna come over here to blender and what I'm gonna do is I'm just gonna change Jeffrey's basic color here so we'll just go up here to our shader editor this is my base color and I'm gonna pick a different texture so let's pick this horrible terracotta color click open image and now Jeffrey is this horrible terracotta color now you can see the normal texture I've still got this castle brick normal so the surface is being shaded as if I've got bricks however I've still got this horrible terracotta color on my on my Jeffery cube so now all we got to do is do the same export that we did before file export gltf to Jeffrey I'm exporting this directly into my into my Godot project file my settings I said remember from the last time but I've got my selected object my Y up I've got my UVs are being exported my material is being exported I hit export to gltf to now I go over to Godot my cube looks exactly the same as it did before with no changes as if I hadn't son of ab edna go okay so there's that okay so it was blender file export gltf to geoffrey Godot double-click go to let's go dad engine it doesn't even what why would you do that why would you not just update every time that I tell you to do that ok not happy not happy at all because does that mean I can just do it once I only get one shot ok that's not cool let's look and see what we got here let's do let's do something else so gltf close you I'm going to open this open anyways so the gltf file that I got from blender still shows bricks even though that cannot be the way so if I select the mesh and I select you you still show Serpas wrong thing I can see my normal map there's my lovely lavender texture my roughness as you remember in blender we set that at point 9 everything's good but this is the old texture where is my new horrible terracotta Geoffrey okay so let's try deleting the texture and seeing if that fixes things so we named it something that material right so it's called bricks that material down to my block in my own view I certainly am just jump out of your way here okay so if I look at my materials I've got bricks material right there so let's just delete you to wheat delete goodbye are you sure yep really sure let me close Jeffrey I was open last time maybe that's the trick don't say and we'll go back to blender blender you Jeffrey selected file export shield tf2 we go to this thing we exported go back to Godot come over here and it totally doesn't work what on earth okay this has got to stop where is it even getting this from because I deleted it the last time okay but I'm in world I'm not in Jeffrey so so if I look at Jeffrey dot gltf to open anyway where are you even coming from I have killed people for less than this there's my cube there's you why are you even in existence right now this makes no sense show in file system where do you live mesh got you surface you I can't even showed in the file system that's usually there why are you not there you know it's times like this when you just need to blow off some steam by burning a village but no that is highly discouraged in this time of social distancing so I don't even have that material in the list and it's still hanging on somehow to this horrible thing so clear it close it don't save it I don't know we gltf to open anyway oh come on blender file export she also you have to all my settings export it go back to Godot can we're here I could delete my GL so you have to file completely closed don't save now hopefully we've destroyed all vestiges of the cube you're gone - no I want you to come with me dead I want to make me change to keep that file blender file export gltf - Jeffrey export back to Goethe imports gltf open anyways I kill you now I I kill you know you are a dead man you know Android hell is a real place where you will go at the first sign of disobedience all right it's gotta be somethin on the export right or on the on the import right that's gotta be what this is so let's look at that so there's gltf we still have the material make bricks material it's back I kill you and give that a select import so what is the score here haha materials so as you can see keep on import so I don't want the material to be kept on import so I'm gonna turn that off it re-import okay so that can get really frustrating and it doesn't always work the way that you would expect here's what's really happening behind the scenes when you go over into blender blender is creating one file so no matter how many different meshes you have no matter how many different textures you have blender is spitting out just the one file its spitting out the gltf file now when you go over into Godot sometimes Godot gets you a bit confused so what you have to remember is sometimes it works perfectly when you go over to Godot it senses the change of your texture or your UV map and it just updates and it's fine sometimes you have to go back in and make sure the keep on import button is off just pop over there and show you that well that's that's this button in the import tab this keep on import turn that off and hit re import a couple times and sometimes that will do the trick and you'll be fine but sometimes you have to actually restart Godot and when you restart Godot sometimes you need to come back you still have to re-import once or twice but then it works so it's a little bit clumsy it doesn't always work the first time out of the box but I can always get it to work so I'll turn demonstrate that now it's difficult to sometimes it doesn't break when I want it to not work but we will always get this to work so let's give this a shot so let's go over to let's start in blender actually so here's blender and we've got ugly terracotta geoffery in blender and in Godot so let's change him to chainmail so here's chainmail Geoffrey and if you look really closely I know if you can see that because the way YouTube does they're degrading of the videos me crank this up a bit so as you can maybe you can see this I've got little tiny bricks and this is the normal map showing up it's it's this texture right here is the normal map is putting bricks around this this object so let's export him the way we same way we've been doing it file export gltf exporting it into the gotough project folder and we're exporting jeffrey gltf flipper or Dakota it thinks it's imported things but as you can see we still have the old terracotta jeffrey and not the chainmail jeffrey like we want so keep on import is off we're gonna select jeffrey go to the import tab and then go to keep on import make sure that's off and we're gonna hit re-import once or twice and see if that fixes it and it does so this is typical for me that once I hit rien port sometimes I hit that two times and then it works let me see if I can get that to break so that worked that worked just the way I want it as you can see we've still got the you can see that or not the the normal texture let me switch to Jeffrey's go to the mesh go to the surface and turn up the normal map power so that's not pretty high actually already but if you can see that in the YouTube video we've got little tiny bricks here as the normal map and chainmail has so this is working exactly like we want it to you go to blender and see if we can break it one more time and see if I can get have to force Godot to restart so this time let's go to chain mail and let's pick a texture like body parts here bloody jello Geoffrey and we're also gonna scale the we're gonna scale the UVs way down so now we've got giant bricks so now we're still off we don't have to be off we can be completely on I'm gonna make it tiny and I've got gigantic bricks now make it something I can actually see no it's pretty good so I've got bricks on bloody jello Jeffrey we've changed our UV map and we've changed our texture file export gltf to re-export into our gold app folder using the same settings so you've been using before export you go over here to Godot and nothing so let's select Jeffrey and then go to import sometimes you gotta go somewhere else and come back I go keep on import is off and hit re-import once or twice here okay now I can't get it to not work but trust me when I say this sometimes you just have to go up to project here and go quit the project list save your changes and then come right back in and this will work so them's the steps make your object in blender your workflow is to make your object in blender add your textures add your normal Maps add your you v's and save and export that export that using the GL tf2 format use the embedded when you get over to Godot it's going to work perfectly the first time but when you do rien ports when you go back to blender a second time and change your mesh or change your you v's or change your textures sometimes Godot gets a little confused and you have to hit rien port at iMore to make sure you keep have to keep on re-import turned off hit rien port a couple of times usually that will work if it doesn't work immediately and worst case scenario you save your work you pop out of Godot and you come right back in and usually then you're just fine so if you have any other questions feel free to leave those in the trumpery below feel free to click like and subscribe if you've got some ideas of what you want to see me cover next feel free to pop those in there and I will try to cover those off for you this is Brian Carey reminding you to be a scholar and a barbarian
Info
Channel: Savvy Barbarian
Views: 17,727
Rating: undefined out of 5
Keywords: how to, savvy, barbarian, savvy barbarian, gltf, gltf2, blender, blender guru, godot, godot guru, linux gamer, indie games, indie game dev, foss, linux, ubuntu, debian, 3d assets, modeling, import, export, blender to godot, godot import 3d model, godot import assets, blender 2.8, blender 2.82a, godot 3, tutorial, godot workflow, workflow, workflow hell, 3d modeling
Id: grPbk-bfMO4
Channel Id: undefined
Length: 34min 55sec (2095 seconds)
Published: Thu Apr 30 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.