Making (Procedural) Membranes | Blender for Biochemists | Geometry Nodes

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Thanks for sharing this!

👍︎︎ 2 👤︎︎ u/theCmonster22 📅︎︎ Mar 23 2021 🗫︎ replies

When my two interests intersect 🥰

👍︎︎ 2 👤︎︎ u/vivasuspenders 📅︎︎ Mar 23 2021 🗫︎ replies

Amazing. I love open source ❤️

👍︎︎ 2 👤︎︎ u/[deleted] 📅︎︎ Mar 23 2021 🗫︎ replies

Thanks for sharing this! I am really interested in trying my hand at this now.

👍︎︎ 2 👤︎︎ u/GandalfDoesScience 📅︎︎ Mar 23 2021 🗫︎ replies

This is awesome

👍︎︎ 1 👤︎︎ u/HalbtagsP 📅︎︎ Mar 23 2021 🗫︎ replies

Waow this is so cool !

👍︎︎ 1 👤︎︎ u/Thog78 📅︎︎ Mar 23 2021 🗫︎ replies
Captions
okay welcome back so today i'm going to be showing you how to make a membrane scene in blender there are several other tutorials already on youtube showing how to make various membrane scenes and how to make phospholipid bilayers but what i wanted to really do is take advantage of some new tools that have only just come out with the most recent version of blender so 2.92 called geometry nodes now this is the future of modeling in 3d and it can help you do it procedurally much less work much more organic and sort of random looking and it's really the way that the industry is going and especially the way that blender is going and so that's why now with the release of the tool i wanted to do my own tutorial on how to make a membrane scene and show you how to do it using geometry notes if you've done any kind of programming before this will be really quite nice if you haven't done programming it may be a little bit of a jump but thankfully it's visual programming so it's using nodes just like we've been using in the shader editor so we're going to use that to basically build up our scene and randomly play stuff and distribute stuff across the scene let's get started here i am in blender 2.92 and i'm just going to basically start with my blank scene to begin with let's delete the default cube and add in a plane so we've got just our plane here this plane is ultimately what we're going to use to build up our membrane scene and we're going to start by doing that programmatically well generatively so if we press tab and go into edit mode you'll see that there are four vertices and there's one face so what we're going to do is we're going to need more vertices in the scene because ultimately what we're going to do is make these go up and down but you can see if you just put one up and the others down you don't have enough vertices in the scene to make it sort of look like a properly flowing say membrane or surface so if i control z that what we could do is press a to select all the vertices and click subdivide and we could add in more vertices and then if we were to say to click that we could move stuff up like that or we could turn proportional editing on move stuff off like that and do it manually but i prefer to do things as procedurally as possible so you can change parameters basically rebuild the entire scene later on so we're going to do basically everything programmatically so i'm going to control z and we see we're back to basically four vertices so what i'm going to do is i'm going to add a modifier so we've dealt with the subdivision surface modifier before well we haven't really dealt with anything else so what i'm going to do is add a subdivision surface and now what it's doing it's subdividing basically and so it's doing it on all those corners but i'm going to turn it to simple so now it's not going to do it on the corners it's only going to do it on the surface and however many levels you have is however many extra vertices it's going to have in between now be careful with setting this to a high number it will crash your computer i'm just going to leave it on two for now and we'll come back to that we're going to add another modifier called displace and so this takes some information and displaces your geometry based on that information and what we're going to give it is we're going to give it a texture so press the plus to give it a new texture you can either press this little button here or just come down to the texture chat and so this texture is currently what is displacing your mesh and so currently it's blank so let's go to clouds and so what's happening it's feeding this cloud information into the displace and that displace is then displacing the resulting mesh you can see not a whole lot is happening that's because currently there's not really a whole lot of geometry inside here so if we turn this up so levels in viewport you can see that the more you add the more uh smoother the definition of these bumps become because you're adding in more geometry and importantly you're doing it programmatically so if we wanted to we could press tab go into edit mode select these vertices you can press e to extrude so you're basically extruding more vertices you can click and then press tab and now you've just made a slightly bigger membrane and so if we had instead gone about it through the other way so if i add another plane and then we subdivide say 20 and then we grab this side and we extrude we can see that this part portion has lots of geometry but this has none so if you were to add apply this displace onto you can see that it displaces over here but it doesn't displace over here this is what i mean by doing things programmatically so i can go back to here and change this around if i want i'm probably going to leave it at six just so it doesn't end up crashing our computers and just make sure you turn that up to six in your render as well because if we were to say leave that at two and look through our camera so you can either click camera or what i like to do is press tilde on the keyboard so that's the one just underneath the escape key tilde and that will bring up this view here and then press one or you can click for the camera so one for the camera so you can see this is what we see in our camera but if we were to press f12 and render it's actually not a lot of geometry going on that's because our levels in viewport and render is different so let's just turn that back up now if we were to press f12 it matches basically what we're seeing which is good let's get a move on we're going to change the size of this noise these clouds so something maybe like that so we're seeing we're getting this sort of undulating pattern which is what you might see on a membrane it's not going to be a perfectly flat thing and now we can start adding lipids you can if you want source lipids from a structural file where this is going to make more of a cartoonistic representation of some lipids so if we press shift a mesh and a cube we've got our cube i like to just say basically so you can press ctrl 2 and that adds a subdivision surface modifier or you can say subsurface and we can over here apply or press ctrl a to apply and now we have this cube we're gonna go into edit mode and down the bottom here press three so you can switch between selecting vertices edges which are these parts or faces so now if i click i'll select a face instead of vertices where i select individual vertices so i click to select a face press e to extrude and let's select that face e to extrude e e and i'm clicking each time so let's go e e cool so now we have something that's starting to look like a lipid if we stay in edit mode and press one and if you press shift z or you can click up here so this goes into x-ray mode so before if we just stayed in this view and we select that and press g oh just turn our proportional editing off press g we're moving around vertices but we missed the one that was behind it because we couldn't see it but if instead we have x-ray vision on and now we select everything even if we it's hidden behind the face now we can just sort of move stuff around make sure these legs are a bit sort of all over the place like you might expect sort of a lipid to look a bit of a kink that sort of thing and now we have a lipid now this isn't necessarily going to be proportional we're just sort of making a cartoonistic representation of our membrane but we've got our lipid if you ever find yourself sort of around here as well something else i like to do is if you press tilde again you have something selected tilde three it'll snap your view directly to where whatever you have selected so we have our uh lipid let's go gy just move that slightly out of the way and so now comes the new really exciting part that has only just come out with blender in version 2.92 so if you have a previous version this won't be available i'm just going to delete those vertices so we just work with just our plane so if we drag this up and we're going to go into the geometry node editor now geometry nodes is a whole new way of working in blender it may seem a bit scary and if it doesn't quite click with you just follow along exactly what i'm doing and you should be all right to get rid of this you can either sort of click that there or you can press n to show in hide tools but what we need to do you'll notice that there's nothing in here so we're going to need to click new and you'll notice over here on the right it's added something called geometry nodes modifier and so if we zoom in here we have geometry in and we have geometry out now again this may seem weird especially if you're new to 3d but basically plane is being piped in here you can do a bunch of operations on it and then it's being piped out here and that's what we're seeing and so what we can actually do is if we say shift a so just like in the viewport or in the shader editor and say point distribute we put our geometry into there and put our geometry into there you can see it's made a bunch of points now don't think of these as little cubes or circles or anything these are just individual basically points in space but blender is representing them as these things so we can actually see them and if we shift a and search and join geometry we can actually see both of them combined so what this is doing it's taking the mesh that we're piping in so our plane it's distributing points along that plane and then we're combining it and that's the output so if we increase that you'll see that you're increasing the sort of number of points that are being distributed on that plane if you've worked with particle systems this is basically will end up being similar to how we replace particle systems and that's the point of what blender is trying to do is making a far cleaner sort of interface but we're distributing points all over this plane it doesn't look that great for a membrane so what we can actually do is um rather than going random we can do poison disk or poission disk i'm not entirely sure how to pronounce that but we can basically now give it a minimum distance so if we bring that up you can say we're now giving it a minimum distance so those points need to be at least this distance away and so now it's distributing it evenly so let's leave that for now um but now we have these points what we can do again shift a point instance and so we can take each of those points and we can instance an object and so if we zoom out and we click this little eyedropper you can click our cube or you can click here and find your object there so cube actually let's rename this cube to lipid so i just double clicked or you can press f2 we'll rename something so lipid and now we have where each of those points are our lipid is instanced now you can see if i click off um this disappears this is actually gets quite annoying so you can click this little pin and now if you click off the geometry nodes that you're currently working on won't disappear so we have instance but what we need to do is do we want to scale things down so we want to reduce the size so if we shift a point scale now where you put this is important if you put it after the instance and we say vector scale that down nothing happens because you've already instanced it then you're scaling and then um things are already happening so you need to scale your point before you actually make the geometry real so let's plug that in there unplug that and if instead we place that here you can see that we're scaling the points and the x y and z so we can just change the z if we want um and it's scaling them and then it's instancing that new geometry now if you hold shift and drag you can adjust multiple things at once inside whenever there's multiple little boxes in blender you can shift and drag to do it or you can do shift drag and then left to right and we'll adjust them all at once so let's go down to say 0.1 and so we're starting to get we've got quite big sort of lipids but i mean you can do whatever sort of scale you want let's go 0.5 oh 0.05 looking good let's increase now that we're starting to see where the plane is we can actually unplug this original geometry which is the plane so we'll no longer see it and we're just seeing the resulting which is these lipids so let's decrease the distance that's looking pretty good and increase let's take this up to like 1000 density and so now we've got a nice quite natural looking um layer so when you in other sort of methods of instancing you can get quite rigid sort of everything's perfectly inline and that looks obviously like a computer graphic um so this just looks a bit more natural i mean as natural as you can be when you're modeling lipids with a computer lipids uh a lipid bilayer is a by definition a bilayer so we're going to need a second layer and so what we can do is we can basically take our points we can point translate so after the scale so it's applied the scale already oh this is separate my apologies point uh translate we're taking our geometry after this the points after they're scaled and then if we just plugged it straight back in nothing's really changed because if we go to vector we can see that basically nothing's changed but if we say drag that down okay something's being translated so we're moving it down on the z-axis by 0.21 meters and then we're instancing so what if instead we take this join geometry over here and we join up this and we join up this so we've got our points that are down and our points that are up and then we instance now we have a buy layout now again your something's quite wrong because the bottom ones um need to be turned around so what we can do is shift a again point rotate so again we can just rotate them by 180 degrees on the x-axis and then maybe adjust that some more and there we go where things are we have our little bio layer so if we're going to say rendered view you can see there's our bio layer we might want to add some maybe some more randomization to the rotation so what we can do is if we we can say shift a attribute randomize now this is where things do get a little confusing now this is where things can get a little bit confusing because we're dealing with things that aren't explained super well in this first iteration of geometry notes the later iterations using the next 2.93 alpha and in later versions this will be much clearer but i thought i would try and jump in here and just give you a demonstration so you can start playing with it but basically we're gonna if you hold shift right click you can see it's joined these two together and you can press g to move that around this is basically just a way to visually clean things up a little so the geometry is still going to here and then it's being fed into here and then into here and so before that happens we're going to drag this on top and we're going to change something so we're going to change the rotation and you can see once we've put in rotation it's now randomizing things a little and so if we go vector you can see that we're putting in a min and a max and then it's then randomizing that rotation now if we select all of those and go zero so we're no longer randomizing what we really want to do is just randomize that z so what it's doing it's if we basically plugged this into there it's just or even if we plug that into there it's randomizing that z and then it's um translating one down um and then we're rotating on the x and then we've got basically a completely randomized looking bi-layer and so things are looking a bit more quite unquote natural now like i sort of said the whole point of doing this is that it's completely programmatic so we can go into our displace modifier here on the right and increase the strength and you're getting a sort of a bendier looking bi-layer we can because this is originally built on top of a plane so we still have that basic plane information if we press tab you'll sort of see maybe it's a little hard to see if we go into x-ray mode it's a bit easy to see we've still got these four points so if you selected these two and press e and extruded you're seeing that as we're building this new geometry so this new plane blender is taking that information applying everything in the geometry nodes and rebuilding basically the brand new bi-layer on top of this new plane that you've just made so you do a little bit of extra work in the setup setting up this sort of programmatic way of working and then you can quickly build a along the bylayer or we want it even longer and already you're getting this nice long by layer and so you can apply the initial work you've done to basically everything in the future saving a lot of time now you'll notice that when i go in and out of actually let's go into solid view when i go in and out of edit mode uh it goes flat and then unflattens that's because this displays edit mode so this modifier currently isn't ticked so it won't show up in edit mode it only shows up in object mode so we can click that and now if i go into edit mode you'll see the plane is still flat but the actual modifier is still previewed so that's maybe a bit better because now we can say okay e shifts dead and so now we're making this big plane and now we're getting a nice looking sort of liquid by layer we can basically make some let's right click that shade smooth so already it's looking a bit nicer we could even go control two so adding a subdivision subsurface modifier onto the lipid before it is then done uh applied under here so everything here is now a bit smoother so if we go say back into rendered view things are looking alright what i'm going to do is just delete these vertices delete that and keep working just for this plane just so things don't slow down too much um but now we have our plane like i've sort of shown you can adjust the say the strength of that displacement or you can even go back into the texture adjust the size of the that cloud that is using to displace it so that's quite messy looking you can go bigger you'll notice that if you're dragging it sort of stops at two that's just sort of like a soft limit you can now put in say 20 and it'll go up to whatever you put in but when you're clicking and dragging blender limits it to a certain number but you can usually override that with certain defaults and so you can sort of see let's drag to maybe something like that and just reduce that strength to maybe something like that so we want to add a protein to our lipid bilayer to complete our scene so what we're going to do um i'm just going to open up in chimera so i'm working with 6wg which is a gp gpcr now this is a structure from a friend of mine sarah piper but so this is the structure i'm going to work with now because previously we've been putting our proteins just randomly in space with a membrane protein you need to make sure it's properly in the membrane so if you're familiar with the structure or you have the structure inside a membrane you're all good but if you're working with a protein that you don't necessarily know where it's how it should look in a membrane you can basically copy the code and go to this mem protein md and you can search it and i say cool there's the protein and here is what it should look like inside a membrane so this is basically run some md simulations and found where the membrane should sit and how it should look inside that membrane so we've got this main sort of alpha helical um region here which is the hydrophobic region and that is where the membrane goes so in terms of income mirror what i'm going to do i'm just going to hide that and go into molecule display show the surface now depending on what you're trying to show in your scene the typical sort of surface representation may or may not be what you're after so if this is what you're after cool save your file you're good to go but what i want to do is go surface surface resolution 10. and so basically it's going to recalculate the surface with a slightly lower resolution well higher resolution number but lower resolution and so everything's a bit blobbier looking and personally especially when you're going into large complex scenes if you're dealing with a surface let's say for a resolution of say six or even four while it is i suppose you could say like more accurate it's more visually distracting because in this sort of structure you have well that's not quite what we would expect let's go five in say this structure you're seeing all these like nooks and crannies that your brain is having to process that sort of 3d information that shading but really it's not serving a huge amount of purpose because overall what we want is this overall structure and so something that looks maybe a bit blobbier while you know if we were doing some kind of analysis would be bad because we want all of that minute detail that we can really dig around in and do some analysis on but when you're visually trying to communicate something the simpler it is and the quicker that your brain can pass that information the more sort of satisfying looking the um actual animation or visualization so resolution of around 10 i like the look of so if we go cd to the desktop and save surface.glb and jump over into blender file import glb desktop surface and so now if we zoom out we'll see structures all the way up there so it's massive so with your structure selected so it should be selected when you're initially importing it scale i'm just going to 0.1 on the keyboard and that should scale it down we're going to scale it even more so scale 0.2 and again i can go tilde 3 to sort of zoom in on it we're starting to get the scale so let's just scale it a little bit more 0.5 that's sort of looking more like it okay so my screencast keys have stopped for some reason and i'm not entirely sure why so i apologize but i will continue on so we have our structure if we go into rendered view we'll see that it's blank so we can in geometry nodes or even actually i might just drag over a new window so if you haven't seen in a previous video i've done or in another one if you're in the bottom corner or one of the corners of the any tab in blender basically you'll get this little icon up here you can click and drag and it'll create a whole new window which we can then say go to our shader editor and so now we can click new so this is now driving the shader for this so if i say red it will go red now as we learned in the previous video we can say shift a vertex color and it will take basically the color information that it had inside blender sorry inside chimera and pipe that and use that in blender now what we can do is if we look at this so this is this one what you'll see is it hasn't applied it to the other ones but if we go shift click and you can see inside blender that while you can have multiple things highlighted one object is sort of selected inside that highlight and so with um the surfaces highlighted but importantly the surface that has this material already applied to it extra highlighted and you can do that by contr holding down control and left and left clicking you'll change what you're currently highlighting if you just click it'll change it but if we shift click and then control click that'll change what you have like selected inside your highlight we can do inside the viewport control l and we can link so we're going to link materials you can also do that inside object should be a make links and materials but you can see that the little shortcut is ctrl l so if we do control l materials now you can see that basically every one of these surfaces has the same material and while inside the material we're not setting a different color each of these surfaces had different vertex colors as we saw in the previous video and it's using that to then color the actual surface itself inside that basically what we can do now is if we drag and select all of those we can say control j which will join them all into one mesh and if we say if we right click and change the origin point so if i just ctrl z that origin point was over here so if i move around like that it'll rotate around the origin point so escape to cancel that if we right click set origin origin to geometry the origin is now in the middle of the actual protein itself what we can do now is press r so if you press r it'll move perpendicular to the camera and press r again it'll sort of rotate on the spot and we can move that basically into our membrane so gz let's make this bigger so you can see but you can also when you're trying to position things in 3d space sometimes it's good to just move look from one particular direction so while you can click and drag on this up here to move around if you click it'll go perpendic um sorry orthographic projection from just one view and then if you hold shift middle click and move around you can sort of see it from different perspectives so if we go from the x we go maybe to here line it up and we go from the y maybe about to there and now we can see it's sitting nicely in that membrane and so the protein itself is actually a little bit bigger than [Music] what we would expect from the how it is positioned in the membrane so what we're going to do is just scale it slightly down gz and that's looking pretty good if you look through our camera it's looking good what we might do is jeez that said zoom in what you can do to help you basically position the camera is if you press n if you press n to bring up this tool menu and so you probably have item or something selected if you go to view you'll see this camera to view and to 3d cursor so if we click camera to view now if we move our view around it'll basically the camera will stick with us so now we can middle mouse click and move around shift middle mouse drag around oh my screencast keys are back i don't know where they went but they're back now and so now we can sort of move that around set up our scene and we can turn that off press n to hide that away so now we've got our scene press f12 cool so basics of our scene is basically set up we can do the same thing we've done with our lipids but we can do it with our protein as well all inside geometry nodes so let's say we're going to need to point distribute again so we're taking our plane geometry we're distributing a point we're going to need much less density so let's zoom in so we can see what we're doing let's go 3 oh let's go 10 and 0.5 and now let's take our point instance and we're going to instead include our protein surface we're going to plug that in and then we're going to if we say just plug that into our output you would see we zoom out that things are massive and looking weird so what's happening is we've scaled our protein down but we haven't applied our scale so let's unplug that plug that back in so if we just say control a and apply a scale so we're not going to do all transforms let's just apply a scale and apply a rotation and now if we plug that in things are looking less weird so they're still massive so i'm still not entirely sure what's going on there [Music] but what we can fix that the same way we fixed the lipids basically so if we add another one of this so if we grab this point scale shift d to duplicate and put it on top of that you can already see it's decreasing that size we want to decrease that even more so let's go 0.005 much better and let's oh 0.01 there we go so thing so size wise it's looking basically exactly the same as our first one and if we join geometry you can see that it's placing them inside the membrane what we might want to no that's looking good what we might want to do though is if we press tab into edit mode and g z and just bring that up slightly it'll bring them all up and left click and then press tab to come out of it what we needed to do basically is because even no matter where this is the way blender actually instances the geometry is where this point of origin is so the point of origin was slightly higher so i just if you go into edit mode you can adjust where the mesh is relative to the point of origin so i'm pressing g so we can see the point of origin is still here but i've adjusted the mesh and so you can see all the copies in the background disappearing basically so if we press escape to cancel that press tab so now things are being instanced properly let's increase the distance so there's a few less of them let's go even more let's go 10 and now what we can do click on that let's go to now if we e to extrude we're just making a membrane with our protein distributed all over it okay so i've just made some adjustments so i've just moved my camera over here so it's now looking at our primary protein here here's our membrane with everything instanced on it i'm just going to basically take this edge e shifts that so i move it perpendicular bring that out there so that you can't sort of basically see anything cool and now we're going to maybe adjust that density and adjust that seed cool so things are in our basic sort of scene what i will do is now camera in the camera you can enable the depth of field focus on object we're just going to select our primary protein and if we bring our f-stop down you can see that the focus is on our protein everything else is sort of sitting on the membrane in the scene press f12 you can get but a pretty basic sort of render of maybe your protein in a membrane you can label stuff if you want currently we've been using ev you can switch over to cycles so gpu compute well probably what you want to do is go edit preferences system and you can if you have if you support optics you can turn on your gpu for either cuda and optics i use optics because thankfully i have a one of the new 30 90s just use my gpu that'll shoot through and render that nice and quickly now so we've got our scene the you'll notice that obviously the membrane is just plain so we can if we want select that and we can we could add a shader to it so new maybe something slightly yellowish if you want to color say the tails and also the heads of the lipids differently if we go over to our lipid and press tab if we select actually let's press three and select so now we're selecting the faces so if we select everything on that everything on that so we've got all the faces selected of our legs and if we go over to [Music] um our shader little tab here so this little circle what you can do is you can assign shaders to different parts of the lipids so with this selected you can say assign we can add another shader and if you press ctrl i you'll invert your selection so we've changed us we can see that we've actually missed some stuff i'm going to turn that off so i'm shift-clicking to deselect i'm going to press ctrl i assign control i say new shader assign and we're going to turn this into green so now if we go into rendered view you can see our legs of our lipid and our head is different so inside our little render you can even go let's go yeah just slightly different sort of shades i'm liking we've got our membrane protein we've got our lipids do a little test render and so you've got your sort of molecular scene and like us that are saying it is procedurally generated so we can jump out into here click on this and adjust this however you want and it'll basically regenerate that scene which is the real power of it now this is going to go really really dense really really complex in the future and i'm really excited for where this is going to go but currently we'll probably leave it off there because already this is going to be a really long video and i just thought how i would show you the basics of geometry nodes i recommend having a play around with geometry nodes there's lots of other really great tutorials i sort of brush the surface of some of it uh if you like the idea of this sort of procedural generation there's lots of really great tutorials out there this is just a basic way to basically make a membrane with it and whack a protein on there as well and if you're going to make this sort of membrane scene you want to make it sort of a bit nicer you might add some particles above and below to sort of make it look like a cellular scene add some other proteins on here so you can do that basically the same way as we've done here you can manually place them but again this is already a really long video so i'm going to leave it there i might if people want pick up from this scene or from another membrane scene and sort of build up a more complex membrane scene and sort of show you how to do that but this is sort of just going to be an intro to how to initially make this membrane and how to whack some proteins onto it but let's just crank up that let's just turn that up to say 1024 let's crank up the render um leave that rendering so like i sort of said uh thank you so much for all of the support and all the really kind comments i'm glad to see that people are excited that i'm making videos again there's lots more topics to cover i know i've said i will do animation and i'm getting there i will i really want to show you how to sort of animate stuff and especially molecular dynamics please do like please do subscribe it really helps like i said motivation the channel and also sharing it with other people by liking and subscribing so i really appreciate that so please do continue to do that um please do continue to share feedback with me tweet at me with renders that you've made so i'm at brady johnston on twitter because i love to see that this stuff is getting used i've seen that it's you know people have sent me stuff that they've made that's now in nature and it's being used in the new york times and all sorts of stuff so it's really cool to see that i am helping enable people to make cooler more compelling graphics so yeah please do like and subscribe and i will see you in the next video
Info
Channel: Brady Johnston
Views: 10,235
Rating: undefined out of 5
Keywords: blender, geometry nodes, membrane, protein, chimerax, chimera, lipid, bilayer, procedural, sciart
Id: FfXJsvxhRQk
Channel Id: undefined
Length: 41min 13sec (2473 seconds)
Published: Mon Mar 22 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.