I had Chat GPT Create Fully Automatic Blender Scripts!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome back to another tutorial of sorts this is going to be sort of an integration of two of my favorite softwares actually Chad gbt which is obviously the more contemporary one um I've got a couple of messages around here saying it's under high capacity or it's reached high capacity so there's no promise that this will stay on I'm assuming now that I'm logged in I should have a continuous session but we'll see we might get cut short um and we're going to be working again with blender actually I don't think I've worked with blender before on this channel except for the backgrounds video but I've used you know I've used blender for a couple years now I've done a lot of creative projects with it arguably my favorite software to work with if not stable diffusion I kind of go between that and blender so um but blender as a creative tool is is honestly insane the amount of progression and updates and plugins that you can use it's it's mind-blowing the amount of features one thing we're going to work with or actually the only thing we're going to work with today in integration with chat gbt is going to be the scripting tab which is something I've never really touched in fact if you speak to the average blender artist the majority of them will say yeah I've never really worked with the scripting tab it's it's sort of a not really a lesser-known tab in blender it's just it's just not something most people go for scripting of course is a tab where you can import or write custom Python scripts to automate your workflow or to offer more fine-tuning I suppose in your scene or your model whatever it is I'll be honest I don't really know what a really good use case for scripting would be I suppose automation or if you have a really complicated scene and you have a lot of moving parts that are supposed to be autonomous I'm not sure I'm just kind of thinking out loud here but what we're going to do let me sort of resize this so we get a good view of our 3D viewport and go back here hopefully we're still here okay so I'm going to show you a few examples that are proven to work prompts that are proven to provide valid scripts and then for the rest of the time I'm just going to think off the cuff and just try to come up with some stuff on the spot so this this was something I've seen demoed previously it's a very simple script or at least the script it's going to produce I'll just say write a capitalize that write a blender script uh um been having some finger issues lately which is why I can't type as well write a blender script that generates 20 circles um in a ring around the origin uh oh no not circles not circles uh Spears in a ring around the origin at a radius of one meter I'm pretty simple right we we're just looking for um I guess sort of uh that'd be just exactly exactly what I typed there a ring with hopefully equally spaced spheres at a radius of one meter and given that unit in blender the Spheres should be relatively small again I didn't specify the sphere size but let's see what this gives us so as soon as I sent that over yeah as you can see it's not going to save my script here on the left side which is a bit unfortunate um let's see what it's doing here okay so we're importing bpy um okay very short script I ran this exact same prompt um weeks ago I got a much longer thing oh we have a copy code thing forgot about that okay so let's do this um if we go here up to the scripting I clicked new we should just be able to copy and paste and then run script alt p okay so it didn't work this time in fact it looks like we have if I'm seeing this right a couple sphere okay are these superimposed on each other they are we do have 20. interesting interesting and it's not even centered too okay well this is a obviously a different result can you can you update the I can't type scripts so that the Spheres are spaced out in a ring kind of being nondescript with the radius here well no I specified the radius yeah one meter this looks I'm not sure why is it defining an angle for high in range 20 angle is 2 pi divided by 28 okay that's equal spacing okay okay wait this might work let's um let's try this now we'll go here uh clear the script clear all of these objects repaste that and what is it alt P to run beautiful beautiful okay um yeah I guess I should have been more detailed in the initial prompt are more specific but yeah this is sort of what I got a few weeks ago as you can see we have these spheres these look like um UV spheres yes these are UV spheres as opposed to icospheres there it's a very interesting process the way the model determines or rather the scripting determines whether or not to use icospheres or ice or UV spheres there are many ways you could go about producing this result in blender if we look here more closely at the scripting we can see um I and I'll be honest I'm not a python expert I have actually never coded with python to a large extent so but but you know I can sort of read in between the lines here we're defining um some equal spacing here I can see this is two times what is this Pi the pi function divided by 20 this is going to give us an equal angle uh we're defining two variables for angles uh is equals zero location equals x y z okay so we're just placing spheres at each of those angle points at at this scale I suppose I might have butchered that but you know you can sort of see exactly what it's doing um producing this result so we're going to get into some other things here I guess I got to be in the window Mouse is lagging a bit there we go okay so let's try something else um write a blender and this is sort of interesting use case you've seen some of these text to 3D models I know Google has one I forget what it's called but you also have Nerf Nerf models and what is it dream dream Fusion I believe it's dream Fusion or something like that dream something text to 3D models these sorts of models aren't very good at the moment simply because of the training data which is insufficient certainly there are thousands perhaps millions of 30 models out there but to gather enough to you know comprise a sufficient training you know data training set that's sort of a challenge so we don't have very clear models but an alternate way to create or take text and produce 3D with it is through here which is I could say write a blender script I mean we pretty much did it in the last example write a blender script that creates a dog use a primitive shapes um just keep it simple now I always get very wildly different results every time I use this prompt um okay we've got actual titles here we have the body we have the head um create the ears okay ear one it's creating the ear separately it's always fun to see the model try to imagine what a dog looks like and then break it down into its basic features apparently the ears are very prominent features of a dog in fact they're just third and fourth then we have leg one leg two we should have two more legs we'll see these scripts tend to run a bit longer of course if I'm asking for an entire dog uh you're talking about 10 or so primitive shapes if you wanted to get like the very basic shape of a dog we've got the tail there okay that was it so if we copy this code and fair warning don't get your hopes up it's not going to look amazing but if we go ahead and hit alt p it's not running hmm oh there we go okay interesting you know what this is actually the best result I've seen so far this is genuinely surprising um the proportions are not the best obviously but in terms of object position you can see the head let's go to the side view we have perfectly yeah the units here are spot on as you can see with the background grid hopefully you can see that these cubes are set to an exact size in accordance with uh the background grid and also in terms of position we have very flush connections here the ears appear to meet at the top corner of the head the top surface everything appears to be perfectly centered yes yes indeed the legs the front legs are disconnected which is interesting the tail tail is just a centered Square everything's cubicle in nature which is surprising I've had it use different shapes uh one time I got like a sphere or it's like an oblong for the head which is an interesting choice here we have more of a voxelated version but honestly kudos to the model this is the best so the best result I've gotten so far um if I were to look at this not knowing that it was AI generated that it was just some random voxel art who knows I I probably would at some point say oh yeah that's a dog um or that'd be my second guess first guess I'm not sure um but not bad not bad at all okay so those are some of the previous problems I've used so let's try to come up with something a little more challenging for the model this happens every time I'll keep pushing the model to more and more complex scenes and eventually it'll break it'll return some errors the nice thing about Chachi BT is it can troubleshoot errors simply through speaking to it you're like hey I got this error you copy the error code feed it back into the model and most of the time I'd say 80 of the time it is able to successfully troubleshoot that error on the first try otherwise you're just going to find yourself iterating through more and more prompts and sometimes the error won't be resolved at which point you might as well just give up because the model you know chat GPT isn't optimized for this kind of thing it is optimized for code completion and code generation but not really in this sphere as much the fact that it's able to create blender you know coherent blender scripts at all is honestly fascinating and impressive so okay let's go with some more complicated shapes we've only been working with superposition and differently positioned primitive objects but what if we use some more Tools in blender say say for example an extrusion or how about a Boolean Let's do let's do a cube write a blender script that creates a cube with a cylindrical pull through the center now the quickest way to do this in blender manually is of course to create a cube import a cube on your own import a cylinder then select the cube and apply a Boolean modifier with the cylinder as the driving object simple as that then you apply the modifier and boom you have your cylindrical hole so this is going to be a multi-step process for the script I'm not sure if it'll do it successfully okay we're on the right start create the cube good localized to the origin perfect cylinder also localized beautiful subtract the modifier type Boolean difference it should be different smartphone yeah okay I I'm Blown Away genuinely I mean that impressive I already know this is going to work I mean I don't really have anything interested we'll see we'll see I am 99 confident this will work okay okay okay just have to hide that nope oh we did get an error there um okay so okay not quite I got my hopes up um we have this looks right up to this I didn't read this these last two lines maybe that's why this it looks right up to this point we were initializing a Boolean we have a difference modifier applied with a cylinder apply as data I'm not sure what this line is doing can we manually finish this process if I go over to the modifier we can see there's nothing in the modifier right now if I go here Boolean I select whoops why can I not select the cylinder there we go uh difference fast apply now if we hide that okay one issue might be that these surfaces are coincident and when you're normally doing a Boolean difference you want to have the object that's creating the cut to be longer or larger than the object that is being cut so as to allow for you know no clipping you have this sort of weird clipping going on because both surfaces are coincident you remove one you still have that surface the the other surface so what we could do actually is go here as Z I'm just going to shift Z so you see how I have a bit of um it looks like a Lego piece you have a difference in height and this should hopefully you can just finish the process manually this is a very simple thing in blender um now if I delete that there we go yeah so we got our hole this is what I would have expected to see um but it got most of the way there it set everything up nicely at least okay uh last thing I don't want to make this video too long just showing you kind of some of the things that this is capable of doing um last example is going to be an animation actually which I've never tested before so this will be interesting write a blender I always feel like I should capitalize this too I don't know if it makes a difference a huge difference um but I'm assuming it does because I mean it's obviously it's not gonna it's not gonna be like what do you mean a kitchen blender I I'm sure it would know that it's a it's the 3D modeling software but anyways I I digress write a blender script that animates a cube translating one meter to uh gotta be specific with the language here write a blender script that animates a cube translating one meter on the x-axis where the animation animation is uh five seconds long so pretty low hopes for this one um we're asking it to cover a whole new tab in blender which is the animation tab um I'm assuming it actually might be able to do it like for example one thing I wouldn't expect this to work very well with would be the textures tab in blender creating a procedural texture I feel like that would be a challenge I'm going to try that though I'll try that later and certainly you know after seeing this hopefully you're inspired to push the limits on your own if you work with blender if you're an avid blender user I encourage you if you can get onto chat gbt assuming it's not down try to run some really interesting scripts like something so out of the box you wouldn't expect it to work you might just be surprised all right here we have a cube this is pretty default this is just this is the default Cube size you we've got our unit size location at the origin titled Cube we have our frames initialized 1 to 250. Now by default blender is I believe 24 frames per second so 250 frames divided by 24 that's not going to be five seconds long but it's okay um insert path Cube location plus equals one so we're incrementing we're incrementing a whole meter we're just going zero to one uh I feel like this this does not look like yeah again low hopes but we'll see um okay alt p okay well I mean it's off center now we have to go here to layout wait oh okay laughs wow all right um not bad genuinely why did I think why did I think that wouldn't work move the cube location X oh okay okay so it's interpolated I forgot animation is often interpolated so it just created two keyframes um I cannot my camera is covering the bottom left of the screen so I can't see on the timeline there well maybe I can oh okay okay yeah you can so it just created two keyframes at keyframe zero and 250. um and blender has a built-in interpolation where the steps each frame is just going to be equally split between these two positions so that's why the cube is moving so slowly but the fact that it works is impressive um yeah so you can animate stuff with chat gbt in blender that is crazy I'm I wonder if it can rig and automate characters now that's something I want to try um but anyways I'm going to close or pause that rather that's all I'm gonna I'm gonna do for today hopefully um this is an inspirational uh take it you know take take it take some inspiration do your own sort of experiments um I would love to see what sort of things you can do in blender or any other creative software um honestly like drop drop a link in the comments if if you're making your own videos I would love to check it out um this thing is only going to get better uh hopefully I mean I hear they're releasing a um professional version of chat gbt which will be um which will have a price uh price interior hopefully that's not too high we'll see we'll see what happens there's a lot of action going on here with open Ai and the capacity server capacity right now there's a lot of confusion a lot of questions but who knows um that doesn't change the fact that it's still an amazing software you can do so many cool things with it um but yeah I'll leave you guys with that uh thanks for watching leave a comment leave a like please and uh I'll see you next time
Info
Channel: Virikemen
Views: 16,176
Rating: undefined out of 5
Keywords:
Id: HobnMo7AZbM
Channel Id: undefined
Length: 21min 50sec (1310 seconds)
Published: Fri Jan 13 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.