Blender for Biochemists | Fundamentals of 3D

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right welcome back to what will be episode number two of blender for biochemists and we started off last time just importing a protein making it read sort of getting familiarized with blender so this time we're going to start off with sort of some fundamentals of working in 3d I know we want to get to the exciting stuff but before we start making complex scenes and that sort of thing you need to know how to work properly within 3d and so we're just going to cover a few things we're still going to use some protein models and make something cool looking so let's get started so if we boot up blender again you'll be greeted by the 3d viewport and so here we have a default cube like we did previously I'm just going to play around with the cube for a bit before we start importing any sort of protein geometry and so if we look at the cube currently like I sort of said said I said previously we're in viewport shading mode or also if you look at the top left here you'll see we're in object mode and if we click on this there are a few other modes that we can go into now we're really only interested in object and edit mode and to quickly change between those two you can just press tab on your keyboard and if you do that you'll see that your box is made up of a series of points and so in 3d geometry basically you have vertices which are these individual points here and then you have faces that are connected in between those vertices and you have lines and so currently at the top here I can choose to select vertices edges so I'm selecting the edge cracking select faces I'm selecting the whole face and so if I go into vertex mode and just click on one vertices and just press G to move it about you can see that I am deforming the mesh and so if I click I've now applied that transform we're going to now have a weird sort of looking mesh so I just go ctrl Z now if I go if I press tab I'm back into normal view and so what we're gonna do now is have a look at sort of smooth and rough shading well smooth in flat shading and so what we're going to do is we're going to apply a modifier so if you come over to the right here and this little wrench icon this will likely become your good friend and we can add a modifier and now you'll see a whole range of modifiers doing all manner of things there's ocean modifiers and particles and this and that what we are interested in in this generate if you go down to subdivision surface now what this will do it'll take your very simple object which currently is a cube made up of eight vertices and it will subdivide it and so here in the viewport we can crank that up to two up to three up to four up to five and so you'll notice that the cube by adding a series of subdivisions onto those faces is getting smoother and smoother now for a quick tap you'll see that our actual object is currently still only eight total vertices but you're applying this modifier that's doing subdivisions up to five now there are two options here this render and viewport so viewport is what you're looking through currently and render is what the actual render will happen so if I actually press tab again if I click f12 and take an image what your camera sees in the render is actually only two subdivisions now we'll go back bring that down to let's say two now if you wanted this to look smooth you could in theory crank this up until let's say six and you're starting to see some smoothness in the sphere but this is a very bad way to go about it because what you end up with is the computer will have to basically simulate each of these tiny little bits of geometry and so there's hundreds if not thousands of pieces of geometry so if we just crank that down to two you see that currently it's treating each of these phases as an discrete face and shading it accordingly so this is one flat surface what you can do is it's click on your object right click and you have these two options here shade smooth and shave and so if we have shade smooth rather than treating each face discrete blender will just average across the surface as if it was a smooth sphere now obviously towards the edge you're still seeing the limits of that geometry and so if we were to just increase this by one more for about three already you're getting a pretty smooth looking object now we're going to apply this to some protein surfaces in a bit this is why I'm introducing it now and so I'll just you can even crank that down to get a sort of smooth looking object from far away if a little bit janky so what we'll do is right click and shade flat again and we'll just press X and that modifier to delete it now a few other modifiers you can do if we just add array so this really quickly adds more of the object and so you can very quickly build up a scene of multiple things arrayed I've actually had the idea of doing some crystallography videos using these array modifiers but we'll delete that now what the next thing I want to deal with is what's known as the origin point so if we press G and move our cube up you'll notice that inside this cube there's this little dot now this dot is basically the origin point so it's the point through which all of the transforms are apply apply it so if you press rotate now it's rotating around the center of the cube if I control Z but if I go into edit mode and press a so I've selected all of my points of geometry and press G and move them up you'll notice they move the cube without moving the origin point now what that means is this this'll only happen in edit mode if I'm back in object mode the two will move together what that means is now that when I apply transforms it rotates it around the origin point and so currently the origin point is outside the box and so when you apply rotations you'll notice that they are applied around the origin point which is outside the box and so if you don't want sometimes this is useful sometimes it's not I found that a lot of the times when porting geometry from PI mol and chimera and a few other things that origin points don't end up inside the geometry and so what you can do is just right click set origin origin to geometry so it'll find the middle most point of the average of the geometry and move the origin point there and so now our middle point north at origin point is back inside and so it rotates around as it should the middle part okay so that's probably enough playing with the cube so what we're going to do is we can now boot up by Mullica mirror and get some geometry now what I was thinking we were trying to use is something topical so one of the main proteases of the current novel coronavirus there's a lot of structures coming out with various things bound to it a good place to start always is PW 101 I think this is bound to something yeah so we're gonna work with wide Lisa I'm gonna work with you can feel free to work with whatever structure 6lu seven so this is one of the main producers in the corona virus bound to it and inhibitor n3 so they go fetch and cool I've got my structure here you can see the inhibitor there now we're just gonna work with something's going to select the small molecules and then action extract objects that's a different thing and turn that off so currently we have the cartoon so I'm going to file sport the armor and well to to my desktop and what I want to do now is as surface so shot the surface file now it's important that in between these steps you don't move around the camera in PI mole because plan will exports the geometry relative where the camera is currently in your surface and stuff won't a lion surface and now it's going to turn on so there's much more molecule there and I'm just gonna say save this and sort of exported or live geometry and so now we're just gonna start a new scene in blender so ctrl n starts a new scene delete that cube delete the default cube and import X 3d and so desktop cartoon and wait a few seconds for that import Pam import next 3d surface wait a few seconds for the surface to import and I can go file import and three ok so we've got a few things that are now imported into our scene so as you can already tell you're the surface is covering up the cartoon and so if I can click on the surface G move it around the cartoon is hiding underneath and so what we can do we're gonna work on the surface first before we work on the cartoon so I'll just press escape to cancel that now as you can see and in the render we did previously everything's looking quite sort of blocky and so if we go right click shade smooth you can see nothing's actually happening now this is a quirk of exporting things from jump from primal and chimera the geometry is exported very very weirdly rather than exporting this as one big mesh with all of these vertices it exports each of these individual triangles as their own individual object and they're all just sort of joined together in an object and so if I go tab into edit mode and I go face select and grab that and press G and move it around it's actually a completely separate face to the rest of the object so if I go controls G and I we add our subsurface modifier to try and make things smooth it's going to take a few seconds to sort of think through everything it needs to do and you'll see something that isn't quite the effect that you're after or maybe it is and you can work with us but it's not quite the effect that I'm after so I'm going to cancel that subdivision and so the way to get around this is if we go tab into edit mode click for vertices so we have all of the vertices selected and now we can go right click down to merge vertices by distance and so if you take say these two triangles here in here because they each have their own they each have three vertices each but two of them are currently overlapping so currently in the scene we have six vertices but really we only need four in total and so you can actually vote merge the two that are on top of each other into one thing it saves on rendering time and so you can actually clean up your object quite a lot if you have complex things down the road and also allows you to apply things like subsurface modifiers so if we click a to select it all right click merge vertices by distance and so you can see down here it's actually removed eighty four thousand eight hundred and twenty four redundant vertices that were previously in the model and now you can see it started also shading the model smooth because it couldn't previously well it was shading it smooth previously but it was just thousands of individual models they were all shaded smooth but now it's one big model all joined together shape smooth and so now we can shade flat again add this modifier sub surface modifier computer will think for a second as it sort of does its thing now obviously this gets a lot slower and slower the larger and larger your mesh gets but we're starting to get something that's much smoother now and so if we right click shade smooth and now that we're getting a lot of geometry you're gonna get it maybe it'll chug a little bit as it sort of goes along and take a while to think about different things the more geometry and stuff that you get the more RAM you'll need in your machine we'll be okay for now and so now we're getting a sort of smooth looking surface that's we're starting to look pretty cool what we're gonna do is gonna hide that and hide that and so what we have here is a whole bunch of separated geometry that is a small molecule and so for a simple effect we're just going to select it all press ctrl J and once that has done is taken everything that you selected and joined it into one object so these are no longer individual little cylinders but that's all part of just one object now we can start shading things in our scene and so if I press alt H to bring everything back we now have a small molecule sort of hidden in amongst our protein bound to our protease now why would we work in blender when we can do something in per mole so as you can if we go into rendered view you can probably see that nothing's actually shaded at all so while information you would get from PI mole or chimera is sometimes hard to bring across into something like blender so quite often it's best just to work in those programs but we're going for something that's more sort of aesthetically pleasing maybe you might see on like a journal cover or on a presentation or something like that and so we were in rendered view currently we're using Eevee like we were previously but we're going to switch over to cycles so down to cycles and again your computer is going to start chugging I'm going to switch to GPU compute to make my life a bit easier now we have a few lights that came with us from the original scene so we're just going to select all these lights and delete them delete delete and so we're left with just the original light so just like that and delete now in rendered view sometimes hard to see where you are and get lost you can just turn on the overlays that you would have so if we click that we have our grid back so no shift a and add in a light so an area light like I said it's my favorite cheesehead gy x and point that that way and we're going to crank the up to 10,000 and up to 10 meters let's take it up to 20 minutes so we've got some nice diffused light coming in here on this molecule and importantly we've still got this sort of shadowy area which is the pocket where this entry in here but there is binding and so now we're gonna start adding some shading so what I'm gonna do is select that bring this up here and we're gonna go to the shader editor so I'm gonna give it a shade up now currently or previously in the last tutorial we only worked with the principle VSD F and I didn't really go into different shaders and that sort of thing but if we were to work in here just like in the 3d viewport we can press shift a to add in new shaders now in the shader viewport you can do almost anything I'll put up some examples now of the crazy sort of stuff you can do just using shaders which is essentially just doing a lot of very complex math now on how light should interact with objects to get 3d animated stuff this really cool project node-red November which happens in November where people use just a shader editor without editing geometry to create all sorts of cool animations so what we're going to do is add in an emission shader so we're going to shift a shader and a mission and so place it there if you ever get lost you can go shift a and search and just search what you're looking for so a mission click that and press X to delete and so currently the principal or BSD F is sort of a catch-all shader it used to be split up in a button to a bunch of different things where you would have to tweak them all and join them all together the principle sort of brings it all together into one catch-all but the emission is a little bit limited and so I won't sort of like a glowing affair to the sort of going on here so this emission shader I'm just gonna plug if you're gonna click and drag on that you see this at all pipe that comes out of that and we're just going to pipe that into the surface and so already you can see the effect that's happening we're starting to get where that molecule is it's glowing and so I want something sort of an in a cool-looking so we're gonna go green so we're getting nice sort of green glow that's happening there and so the strength of the emission is currently one that's click that to five now we're getting quite an intense sort of glow that's going on and so if we zoom out we've got this molecule and we're really starting to highlight the green of where the inhibitor is binding onto this protease and so let's add a shader to the surface okay to add new shader hmm this is running very slow I think I should probably apply my subsurface so it might be running a bit slow if we go into our modifiers panel turn that render down to one just so the to match and then apply that subsurface so currently it's doing some funky stuff where it's displaying with one and rendering with the other and it might have to do a whole bunch of math that each you really don't want to you know when your computer to do it more math than it has to and so we're just going to apply that and hopefully that'll make our life a bit easier it means it's no longer reversible you can control ze but it's a good way to work if you have a whole bunch of modifiers in a stack that you can always tweak them later and so everything's procedural but now we've applied it its destructive so we've got this selected maybe you want this to be kind of blue so the light blue may be good yeah like a good purple and so we've got purple bring that down a bit so it's a bit darker so it's really highlighting where that binding pocket is and so we got our inhibitor binding to our main protease got a bit of light coming in the scene let's now we were working also with our cartoon in the scene and so if we select the surface and press H to hide it you can see we're getting some cool effects with glow and so we'll add a shader to our cartoon as well make this I think I might just make this sort of a dull gray cool and then if we get old age to bring back our surface now what we can do with this surface is decrease the alpha and so what that's going to do is basically increases the transparency and so now some of the light can actually get through that surface and you're getting this sort of cool bubbly effect and so the majority of the light is sort of catching around where this small molecule is binding but then some of the lights getting through you're getting some of that glow onto the cartoon beneath so I mean you can decrease it more and you're getting just like a real faint eye outline and mostly it's not there but it might increase that a little bit to say about there and so already we're getting something that's looking kind of cool so if I press 0 to look through my camera you can see that up cameras really not positioned very well and so if I press 0 again well if you have a full keyboard a good shortcut is control option and then 0 on the numpad and what that'll do is bring the camera to look exactly where you're looking now we have the same problem that we had last time where the camera can no longer see far enough so we just click on our camera go down to the camera option and increase this up to 1000 now we also have some additional cameras that came with us from the other geometry so I'm just going to delete those and clean up our scene a bit and so cool now we have some cool geometry because gcz zoom in G and just sort of move it around and so cool we're starting to get a scene set up and so we just press f12 and render that already we're starting to get something that's looking pretty cool as you may have noticed in your previous renders whether it take a little bit long or not long at all you may start seeing some noise it's sort of like if you would take your photo at night you see some sort of colored noise and places where it's not super bright and that's down to something called the number of samples now like I said I said in the previous tutorial cycles is a photorealistic rendering engine and so it takes a photon traces where it goes traces how it interacts with various things and how it interacts with the camera now the more photons that you can trace the more photorealistic it will be but they're more computationally intensive and so that's known as the number of samples so by default if we go to this camera tap they in the viewport is 32 samples and in the render at 128 so that's why already you're seeing a bit better quality image in the final render then you are in just the viewport now most photorealistic renders would probably crank this up to around 12,000 or so if you maybe like 7,000 or so if you're really wanting to get a photorealistic render but if I press f12 we're probably gonna be here for I don't know maybe an hour or so as this slowly goes through and renders one frame now already you can see that we're starting to get a lot less noise than we were in the previous image so it's ultimately it's a trade-off between the computational power that you have available the time that you're willing to spend on one image and the quality that you get from that there are quite a few options in terms of denoising in post-processing so depending on the scene that you're setting up you don't actually need that low noise you can get rid of that later on and so it's not really super concern and in most things that you do unless you're doing working on like a Hollywood movie or something like that or trying to do deliver architectural images low noise isn't really that much of a concern so we're just going to click exit on that and bring that tango back down to 128 and so we have something set up in our scene we have something sort of cool-looking and so we're going to do one last thing that's really going to add some life to this scene before we wrap this up and we're gonna really start seeing the power of using something like blender to make a cool-looking scene and so currently we heavenly have one molecule and so what I would like to do is have lots of molecules so sort of to try and sort of emulate that this is maybe like a cellular compartment where you have lots of molecules floating around in space so we're going to make just a few more other particles in this scene just to sort of a few more proteins in this scene just to add a bit of interest before we render an image and so we're going to go back out into solid view and if you select all of this and press ctrl J again it doesn't want to work so if you press just on that molecule and shift-click on that and then press ctrl J that'll work and then up on our selector we also control will shift click that and then ctrl J this is now all one object but if we go in to rendered view it's still all rendering discreetly as different things but if we go into solid view we can now it's all just one object and so it controls that now what we can do is we can duplicate and so if we go shift D if we got a whole new object that's exactly the same as we had before and so we're going to split up the scene so if we go 0 to look through our camera and again down in the corner here to just click and drag across so now we have two things that are set up now I didn't show you last time but if you get too many of this you know you can accidentally drag a whole bunch the way that you delete them is if you click in that corner again and drag back across into the other one you'll get that sort of arrow prompt and that will delete them and merge them together and so we have one which is now our camera so we can sort of see what's going on might bring our camera back a bit geez ed said bring it back a bit so now we want to move this one back so maybe back down here add some rotation add some rotation like that shifty geez ed bring it up add some more rotation and maybe bring it all the way back you know gene why bring it way back out there and then for dramatic effect click on this one shifty sort of maybe have one just in front of the camera so if we go into rendered view I've got a few of these sort of molecules sitting about and so something that's really cool that you can do in blender that it's hard to do in things like chimera and primal is adding some depth of field so some blurriness when things are far away and so currently if we click on our camera go down to our camera settings and so we currently have depth of field off if we keep ticket depth of field is now on now it's good practice to try and keep things always to scale so if you're modeling a teacup or you're modeling a table didn't have it you know 10 centimeters across and so your f-stop in your field of view and your focal distances and all that sort of thing will match up and it's good practice and physics wise sometimes things go a bit weird obviously if you're modeling proteins it's a little hard to have your camera accurately set up because it's physically impossible for your camera to detect proteins in any sort of meaningful way and so we sort of just have to wing it and choosing a scale is up to you and usually you'll go with maybe one nanometer equals one meter and inside blender or one angstrom it's sort of up to you or maybe a centimeter is an angstrom the important thing is to be consistent throughout the scenes so that everything is to scale but that's just a caveat for what we're about to do with f-stop switches make them really weird that really doesn't mean anything to you if you haven't done much photography but using an f-stop that's maybe of 0.1 is completely ridiculous in real life but we're going to work with it and so we're going to take that back to 2.8 what we're going to do is choose our focal object so what do you want to be in focus so I drop off this protein that's going to be in focus and so now with f-stop the smaller the number the more blurry everything will be and so if we bring that down to let's say 1 yeah you're not really seeing much now but 0.2 maybe not really seeing much now 1 forget 0.001 all right things are starting to get really blurry and so even the thing that's meant to be in focus it's very very blurry so we're gonna have to dial that back a bit that's good my name is eros eros and so cool we're starting to get an in focus protein and some blurry proteins and so maybe we'd take that up to 0.05 so now we're starting to get a little bit of out of focus and maybe a bit a bit more so that's our point zero two so there was something in a nice blurry out-of-focus protein and some nice cool looking proteins and so again another good practice thing is to save before you start rendering so I'm just going to save this to the desktop just test or whatever because sometimes when you press render things will just crash and then you've lost an hour's worth of work or whatever so it's always good practice to save for your render and so I'm going to press f12 to render and we're going to start rendering our scene and so you'll start seeing your glowing small molecule which is bound to your protein sort of really highlighting that binding pocket you've got your surface you've got your cartoon and we're starting to build a nice sort of scene and so around the outside we've also got some additional molecules that are sort of out of focus but just sort of starting to build up a cellular environment now what we would really do is add hundreds more molecules that ends up going into something known as particle systems which is probably a bit more advanced then we want to dive into just as yet but already we have a pretty cool looking scene where you can see off in the distance other proteases that are also bound by inhibitors so hopefully that is introduced you somewhat to a few more additional things and got you thinking a bit more about sort of point of origin geometry and vertices and all that sort of stuff and so like I've said I said bringing geometry across from things like pi mole and chimera can sometimes be difficult because they're built for molecular graphics they're not really built for exporting geometry to the 3d modeling platforms and so you have some weird things that happen along the way and so we just need to do some cleanup steps thanks so much for watching this one and for the response to the previous video as well it's been really really encouraging actually I'll probably after we now we've done some basic intro to blender we'll dive into a few more series and really start getting stuck into it again like previously if you feel like I haven't covered something properly or you would like to see something in particular let me know you know the comments or tweet at me I love reading the feedback love seeing your images so please tweet those at me as well I'd love to see the results and different proteins that people are working on otherwise thanks so much for watching and yeah I will see you in the next tutorial
Info
Channel: Brady Johnston
Views: 6,601
Rating: undefined out of 5
Keywords: Blender, biochemistry, tutorial, biovisualisation, sciart, structural biology
Id: 8NC4GqvQPTM
Channel Id: undefined
Length: 32min 3sec (1923 seconds)
Published: Thu Apr 23 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.