Cube Grid - Use Color on Blender Geometry Nodes Instances

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi this is manuel with entegma with the next geometry notes tutorial the blended developers were busy and they are improving geometry notes inside of the blender 3.0 alpha all the time and that means that now with the latest alpha something is possible that wasn't possible before after the release of my linear falloff tutorial i got a lot of questions if it would be possible to color the effect and it wasn't possible back in the day but now with the latest alpha it is and that is why i'm here to show you how to create a lot of clones and then color them using a little trick so follow me creating this neat effect inside of blender using geometry nodes to start let's delete the default cube and instead let's get ourselves a grid and we want to up the subdivisions to a hundred by a hundred to create quite some points and now let's scale the grid to four say like so so this will be our grid we want to create the clones on this grid now let's create a new editor as always and let's switch this one to geometry node editor let's get rid of the side panel and let's create a new effect and call this clones clones like so okay the very first thing is that we want to use a texture let me quickly switch to the image editor and show you the texture that i'm intending to use you will find this one inside of the download zip that i linked beneath this video that is the texture and that is one of the images that i created when i was exploring these stool sculptures so it's one of my images and we want to use this as a texture so back to geometry nodes editor let's get ourselves a texture node texture attribute sample texture and connect it here now to use this texture inside of geometry nodes we first have to create a new texture by pressing this new button and to be later able to find this texture easily i want to just name it gn for geometry notes now if we go down to this texture tab we now have this vn texture here and we can define what texture we want to use at the moment it is set to image or movie that is what we want to use so let's press open let's go to the texture folder and select the texture and open image so we loaded this image into this gn texture now we have to specify how to map this texture to our grid and we want to use the uv map that comes with the grid and now we want to define the attribute that holds the color result and i want to just name it color this node is sampling the texture and it is putting the color values into this color attribute the default type of the attribute is color that means that we can visualize the color as vertex color so let's go to the vertex tab here and then to work six colors and let's create a new layer that by default is called call but we want to rename it to color like so because then the match of the names indicates that geometry nodes will save this data into this color layer to see this in the viewport let's up here go to this little viewport shading menu and then go to vertex and you see the picture is mapped to our grid but we don't want to stop here instead we want to put a lot of little boxes on the grid and then we want to eventually color these boxes so let's get ourselves a point instance node point instance here we have it and connect it directly after this node is asking for an instance object so let's create an instance object we want to use a cube for this so this cube is our instance object but before we use it as an instance we want to prepare it a little as you can see the origin is here in the middle and we want the origin to be at the bottom of the object such that the object will sit on the plane exactly the easiest way to achieve this with a default cube is to go to edit mode and then just press g and z to just move it in the z direction and then one which will move it one unit up and then the origin point here sits at the bottom now we want to scale this thing to have the right size for our grid and we can do so in edit mode no problem or we can use object mode and then apply the scale but it is even easier to build a little setup to scale the thing so let's use geometry nodes for this press new and call this scale like so now let's use a geometry transform node and using this node we can just scale this object but we don't want to scale it in all directions we just want to scale it in x and y and in z separately because z will determine the height of our effect and x and y will just say how big these little columns are that we have later on so let's get ourselves a combine x y z to set the scale vector and the first two we want to set with a value but i don't want to use the value node here instead i want to promote this parameter up to the level of the modifier here here we have it x but i don't want to call it x instead i want to go in here in the n panel and call it size like so and then we use the same value here and the z value has to be promoted too so take it and drag it to this empty port here and then call it psi z like so so we have two sizes now that are set to zero but we can set them to something else like 0.01 and 0.01 and now we have a very small tiny little cube that we can use as an instance so let's select the grid and let's use this cube as an instant object now we can press the period key on the numpad and you see we have quite some boxes here on our grid as you can see the size that we put in is exactly the right size there touching so we can make them a little smaller by going to the cube and saying 0.008 say now we have little gaps between the cubes great now that we have that select the grid and let's get rid of the side panel we want to use the red channel of our texture to drive the height of our little boxes to do that we want to use this color attribute that we have here and split it up for that we want to use a separate x y z but because this is an attribute we have to use the attribute separate x y z this one and we want to connect it here the vector to be split is the color vector the result for the red channel is x so this will go to a new attribute called valve for value so this is the value that we eventually want to use to control the size to do this we will need a new node the point scale node point scale there we have it and we have to apply the point scale before the instance because after the instance the points are not there anymore instead we have instances and they cannot be scaled by this node so we want to scale the points before putting the instances on the points and now instead of using a vector we can use an attribute and we can use the value if we do that you see that we now see our texture here because the individual cubes are scaled according to the red channel values of our texture the problem is though that they are scaled uniformly and we only want to scale them in v we want to keep the dimensions in x and y set to 1. so instead of just giving this value here to the point scale node we want to create a new custom vector and give this one to the point scale node so we want to create a new vector so we will need a attribute combine x y z and we want to put this before the point scale what do we want to combine well we want to set the x dimension to 1 and the y dimension to 1 but for the z dimension we want to use an attribute and in our case this is the value and all of this goes into a new attribute called scar first scale and now instead of using this value we can just use scar here and as you can see this works now we have our original sizes of the cubes back and they are just scaled in the z-axis but the effect is very shallow to exaggerate the effect let's scale this val before we create this vector to do that we want to use an attribute mass node so let's go to attribute attribute math and put this attribute math here between this separate and combine and we want to multiply so let's set this to multiply our vowel by a float and then all of this goes into val again at the moment this is set to zero so everything vanishes but if we set this to say a hundred we get nice large columns now this looks a lot more interesting already there's one more thing that we can do to define how the effect looks and that is a new node that is called attribute attribute curve map you know this node from the shading context and from the compositor it just remaps the input range to an output range by using this curve but it uses a range between 0 and 1. so we cannot use this after multiplying the values we have to do it before so put this here and if i go in here and move this and specify that we want to use val and as a result val you can see that i can remap how the values are distributed and doing so i can create very different appearances like so for example now you can see that i have exaggerated the very high column there too high for my liking so let's go down to 50 or even 30 like so and i think this is quite neat so let's stick to this for now and now that we have this nice little city here cityscape here we want to finally color this unfortunately after the point instance node all of this geometry is turned into instances you can see this if you use the spreadsheet so let's create a new editor and switch this over to spreadsheet here this little monitor icon tells blender which note to display in the spreadsheet so if i go to the point scale you see a lot of points they have a position attribute and a scale attribute because at this point in the graph we still have points you see this up here we are looking at the mesh and then add the vertices and the vertices have these attributes but if i go to the point instance by clicking on the monitor you see everything is empty because we don't have a mesh anymore at this point now everything is turned into instances and we can see this if we switch over to instances now you see we have a lot of instances here and these instances have a position in the rotation and they have even a scale value but they do not have a color value and at the moment geometry nodes does not offer a possibility to set a color per instance that is just not possible we cannot even specify attributes on instances so what we want to do is to convert all these instances into editable geometry and there is no node to do that directly but there is a node to do it indirectly and that node is the attribute transfer node so let's create an attribute attribute transfer and the attribute transfer will transfer one attribute from one geometry to another geometry if we now connect this attribute transfer here we can transfer the color that we set early in the graph on the points to the instances but not to the instances directly instead to the geometry created by the instance and because this node needs geometry to set the attributes it automatically converts all these instances into geometry so let's see if this works this node is asking for a geometry and we already connected it there's a target and then we need a source geometry and for the source geometry we want to use the output of this very first attribute sample texture so let's drag the geometry that comes out of here into this port and now we want to use the attributes and we want to sample the color attribute on the source geometry and we want to put it in a new attribute called call like so and you see as soon as i do that all the stuff that is here in the spreadsheet under instances vanishes instead now we have our mesh back if we switch to a different domain if we switch from vertex to the face corner domain you see that we have this call attribute here this attribute transfer node is setting the call value on the points of our geometry that used to be the instances now you might assume that we want to use this call in another vertex color layer but that unfortunately is not possible because the size of the vertex color layer does not match the geometry that we currently have so geometry nodes is not updating the size of this array accordingly what we have to do instead is we have to rely on the ability of cycles to render this attribute directly doing so we can use this attribute to color our effect so before previewing this let's go to cycles because using geometry nodes attributes and shaders is only supported by cycles i will switch to gpu compute because i have two powerful gpus and now let's render this and you can see that the result we get everything is white so no trace of color here and that is because we have to define a shader first and be careful we have to define the shader on the cube on the instance object although it will be turned into geometry the shader has to be defined here it will then be converted so let's switch to the shader editor cube and let's create a new shader and let's call that instance shader like so let's see it should have created a principle bsdf and it has and you can see if you change the color here all the colors here change because this instance passes on its shader to the geometry that is later created and now we want to use the attribute that we named call so lay down a new node an attribute node and sample the attribute call in here and if we do so you see that we now can read the color and we can put it here on our grid let's make the colors a little darker by introducing a gamma node gamma put it here and switch it to 2.2 that makes the colors quite a bit darker and now we can use them in the subsurface color and just up the subsurface radius here to give it a plastic appearance now maybe let's go to the 3d viewport and switch this light to be an area light scale it up quite a bit to make the lighting a little smoother like so and rotate this over like this and give it more power let's say 3000 like that and now that gives a nice effect of the color coming through the objects from the backside due to the subsurface scattering like so that is nice so the very last thing that we want to do is up the resolution at the moment we are still at a very low resolution we don't want to do this destructively instead we want to use geometry nodes for this so let's go to our grid and then switch to geometry nodes and at the very beginning of the graph we want to introduce a new node the subdivide node subdivide and if we use this then the geometry of the grid gets subdivided that means we create more points and thus more instances as you can see here but now these instances are too large but because we have this geometry node set up on this instance object remember we can easily change the size and we don't want to change the size z now we only want to change the size in x and y so decrease this and you see now we have the right size back and we of course can go on by doing this like going in and subdividing to three and that of course takes quite some time because that is now a lot of instances but once blender finishes creating the geometry we have a lot of instances here and now we have to adjust the size of the cube again that's half it two times so go down to 0.001 and again let's wait for blender to create the geometry here you have it now we defined our effect now we have a control for the resolution by changing these values and changing the subdivision value on the grid and we might even want to promote this to one level up because then we can control it directly from the modifier and then we can adjust the effect exactly like we want to and there you have it that is how you create a colored clone grid with blender geometry nodes and you can see the effect is quite stunning i like it a lot so i hope you learned something from this tutorial and have fun trying out your own textures and different settings and see you next time if you like what we are doing please consider becoming a patreon for supporting us and for access to more in-depth courses on topics like volume techniques or pdg or vellum and more everybody who is already supporting us thank you so much without your continuous support and tiger would not be possible
Info
Channel: Entagma
Views: 57,659
Rating: undefined out of 5
Keywords:
Id: nOFNTZjiwP8
Channel Id: undefined
Length: 18min 22sec (1102 seconds)
Published: Mon Jun 28 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.