Realflow For C4D: Blending Fluids With Vertex Maps

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hey guys it's Sam for digital meets and in this real flow for cinema 4d tutorial we're going to be looking at how we can blend fluids together using vertex maps so let's just jump straight in I've got a simple scene set up here and in this scene folder at the top is contained my lighting in the background and the floor that's pretty unimportant I've done other tutorials about how I set these scenes up so you can go look at them and in fact while I'm on the subject I'm not going to spend too much time setting up the real flow scene in terms of the colliders and the the emitters and that kind of thing because it's not really about that this tutorial so if you're unfamiliar you can go to my youtube channel and check out the real flow for c4d playlists or you can go to my website digital meat UK and go to the tutorials page and you can filter the tutorials by the real flow category and they'll all be listed there so let's just get straight into this so what we're trying to attempt to do here is blend two different fluids so in this case it will be the same fluid but two different emitters and to come up with an effect like this this kind of blending mixing effect as you can see we've got blue and yellow here they're mixing together to create this green color and yeah I'll basically be showing you how you can do this using vertex maps and kind of a clunge kind of a workaround that I came up with to get this effect because the way color blending works within cinema 4d is a little bit difficult but we'll get into that after we've set the scene up so let's get cracking okay so the first thing I'm gonna need to do is actually get my real flow sort of scene tree in and we can do that by creating an emitter so I'm gonna create a circle emitter and as you can see we've got the scene here I'll move it down to the bottom because we're gonna be dealing with this mainly so we've got our emitter under emitters and I'm just gonna tweak this slightly because let me just come out this camera as you can see we've got the real flow symbol on the floor there that might be slightly distracting so let's get rid of the display a icon you can do that in the scene there so that gets rid of that and I'm gonna actually create two emitters here so I'm going to create emitter I'm gonna call this emitter zero and emitter one so we need to size these so I'm going to object and the width for this I'm going to say it's 43 Senate me is for both of these now I've set this scene up before so that's why I'm able to do this quickly like I said I don't want to spend too much time on doing doing the setup of the emitters and the colliders so I'm just going to zoom through this okay so emitter zero its position say coordinates I'm gonna leave that at zero this can be two four five two six six so that raises up to about here and for this I'm gonna go minus seventy point six nine three now you might be think that this is very specific and it's because I've set this scene up before so I know what values are used I'm going to rotate this as well so it's pointing towards the glass there we go so now when we play this it should yep and as you can see they're not falling so will remedy that in a minute after we set up our second emitter and you can't really see the particles that well so we'll remedied that as well so let's go to emit of one and put our values in for this so two for 5.26 X so it goes up to the same height six nine that'll do something like that yep okay rotation we want seventy degrees actually we want minus seventy degrees because it's on the other side and minus and funny okay cool so now that set up these things are pointing towards each other lovely so we want to make our particles a little bit easier to see and that can be done in the fluid and we can go to the display tag and we can just put the particle size up to three that should make things a lot easier yep so we can see those a lot better now okay so we're gonna need some gravity in our scene as well so let's go to real flow demons and then we'll add a gravity demon there it is so now these should fall down yep great so they're just going through the floor at the moment because the glass hasn't got a Collider tag on it so let's um let's sort that out so where's our glass there it is say grab our glass right click real flow tags Collider so what do we need to set up in this little bad boy so in the properties all the collisions stuff is pretty much as I want it although I'd like to add a bit of friction so let's just crank this up one and I'm going to leave everything else as it is so let's add the other tag which is the volume tag and now we can actually start tweaking the settings in this as well for the most part I'm quite happy with these settings apart from the cell size because if we visualize our Collider so go to display check on geometry go to the beginning of the scene and you can see that it's a little bit it's not great um but if we go to the volume tag turn off ourselves so as you can see it's a seven at the moment on the changes to two so we've got a bit of a tighter there we go that looks a lot better great so we can go back to our Clyde attack and turn off our show collision geometry so we're back to where we are and now you can see the particles are collecting in the bottom of the glass now great so moving on to the fluid settings let's go to the fluid and go to the fluid tab and here we've got the settings for the fluid now I want to crank up the resolution so let's call that furry so now we should have more particles there we go much better we can actually see what's going on that's good as far as all the other settings go I'm more than happy with those at their standard setting so that's so that's fine okay so seen solver we're gonna have to affect some of these and there's a good reason for this if I come out of this view and go into a side view here we can see the bottom of the glass let me just zoom out a little bit what's that oh that's my light so in fact let me just go back to this view and as you can see you can see the lights in the scene and sometimes these might get get in the way so what I tend to do is go to filter and turn off the lights so they're not visible in the scene they're still there and they still have an effect they just they're just hidden so yeah let's go back to this view and get in on our glass and see what happens when we press play because in this view you know our camera view everything looks fine actually these are pissing particles into our cup and it's filling up and for the most part looks like correct but if we go into our side view you might find that you have particles going through the bottom of our container and that's a problem it will slow down the scene because these particles will be falling essentially forever and they'll need to be calculated as they do that so that's no good as you can see they're all there falling forever and we could put a kill box around this or we could actually affect our collider shape to make it a more efficient well not the collider the the solver actually so if I go into the solar settings and have a look at this stuff for the most part this needs to be left alone this stuff here but these all parameters we can change these so I'm gonna turn this off and I'm gonna crank these min sub steps up to 6 and the max up to 6 and that I'm hoping should fix our problems so let's go back into this view and as you can see now we have no fluids escaping through the bomb and actually the way this fluid is reacting is a lot more natural which is which is good great okay so let's go back to our camera view so the only year the only other thing that we need to do is add a mesh so let's go to real flow measure and that adds a measure here and I've got a few seconds for them for the mesh in terms of its um looking structure and to be honest again this tutorials not really about a look at the mesh so I'm not going to spend too much time on this and in fact I'm gonna leave most of these settings as they are I'm just gonna bring the radius down because we've got quite a lot of particles in the scene we don't need to we have as low as three and that should be fine you shouldn't look too blobby or anything because there's not enough space between our particles to cause that because we have a lot of particles in the scene so that's a so that's pretty good okay so now all that setup if I hit play there we go our mesh is being generated along with our particles and all is well okay so now we can actually move on to the blending aspect of this tutorial so what I'm gonna do is actually I'm gonna let's get our lines back I'm gonna hide this glass just so we can see what's going on them with our fluid so we're gonna hide it from the viewport and hide it from the render everything will work just as before but we just won't have that the mesh of the glass getting in the way and in fact while I'm here I'm gonna do this so we can actually see everything a little bit better okay so let's get on to the blending aspect of this then right how that's done is through vertex maps and you'll notice on the measure if we look here we have three vertex maps already and we've got velocity Z velocity y and velocity X and we can actually use these vertex maps to well we can do loads of stuff with it but the problem with these is they aren't really given as any information about each of these emitters they're only given as information about the speed well the velocity of the fluid so that gives us the velocity in the Z direction this direction and then obviously Y and X so that's not going to help us so what do we do well if we go into the measure and go into this channels tab here we have a few different options here so you can create vertex maps based on speed vorticity age and then we have this weights and this is what we want to look at so let's check the whites checkbox on and in the drop-down we've got a choice between fluids and Aamir's now this is because we can generate vertex weights based on whether it's looking at the separate emitters in the scene or we can have two separate fluids in this case we've got a couple of different emitters so that's what we're going to do and so let's choose emitters now you'll notice that not much has happened we've still got the same amount of vertex maps up here and that's because we actually need to cache the scene so if we go to scene go to cache let's just make sure there's nothing in there no there isn't okay good so I'm just going to catch this and I'll be back in a second okay it's finished caching it just took over a minute 1.5 gig there you can okay that and as you noticed up here on the measure we now have some extra vertex maps so we've got the X Y Z velocity still but if you also got this white zero and white one and if we scrub forward and in fact I think I'm gonna hide the particles just so they're not in the way in the scene and if we select any one of these it will show us where the the whites are so that's fluids zero I think yet and this is fluid one and as you can see they're all kind of sort of mixed together so we can actually use this information to create a material so first of all I'm going to I'm gonna go through the way that is actually suggested in the real flow documentation just to give you a taste of what they sort of recommend so I'm going to create two fluids so let's create one here and let's call this fluid zero because that relates to Y zero and this is exactly the reason I called this emitter zero and emitter one okay so let's keep it nice and simple fluid zero and we're going to the reflectance and get rid of this horrible specular turn on Beckman make it a dielectric and then we're gonna choose a color for it so in this case let's just crank these up and then choose two hundred for the blue so this is our blue fluid okay and then I'm going to make a copy of this and I'm going to call this fluid one and in the color I'm gonna make this yellow so sixty for that and yet those two at the top so we've got our two fluids now so what you'd what suggested in the real flow documentation is that you stack these up so fluid zero goes on the measure first because that's our base material and then fluid one goes on top of that and if I were to render this obviously it's only gonna render the fluid that is on top so there we go it's not great is it um but we can use these vertex maps and we actually only need to use one because fluid zero is the base layer if you like so there's no point using the white zero in that because it's at the bottom anyway you don't need to see through that so in this case we can forget about that but in fluid one what realflow suggests you do is turn on the Alpha Channel okay and then put our vertex map in here so we need white one in our fluid one but you can't just drag this in here what you have to do is click this go down to effects and then right the bottom you've got vertex map and that lets you feed this into this vertex map shader so if you go inside that there's a slot for vertex map we can put this in and Bob's your uncle so let's give this a little render now and see what happens well now you can see that we've got a sort of mixture of blue and yellow but it doesn't look very prey does it and it doesn't really look like it's mixing too well either well there's another setting in the measure if we go back to the measure and go back to the channel tab we've got this smoothing length scale and currently is set to one so I'm gonna set this to say five I think its maximum is ten actually and if next limit is listening it might be good to not have ten as the cap and let us go a little bit further now I don't know if that's a limitation of cinema 4d or just a limit realflow pitting but it could it could be good to have that as a bigger value and I'll show you why a little bit later so actually let's just put it up to ten and now this will have no effect on our vertex maps when you change this you have to cache the scene again so let's put it all the way up to ten I'm gonna go back to scene I'm gonna remove the cache and I'm going to calculate the cache again so I'll see you in a second okay so the cash is done and as you can see it's taken to significantly longer this time it's around three and a half minutes so I should imagine that's because for every frame of the of each of these vertex animated vertex maps it have to apply ten smooth operations to each frame if you not I mean so that's probably why it's taking longer anyway let's just hit OK and have a look at these vertex maps now you can see the edges have been smoothed out quite a lot for each of these so this may give us a better result so let's hit render and see what we got okay well they're definitely blend in better but we do have a little bit of an issue you'd expect that when you mix blue and yellow together you'd get a green and you kind of are here but it's also looks like it's being multiplied with white some reason now I don't know the reason for this I think that maybe when you've got zero value for vertex map the underlying color if the value is zero might be white or it might have to do with the way cinema4d mixes colors and I think this may be the case and I'll show you how I think I know this in a second when we move on to sort my method cinema4d uses a RGB model for its color and RGB is an additive method a good example of an additive method would be if you had a load of lights of different colors and shown them on the same spot as you build up more and more colors what the result or the outcome is is actually white so that's additive subtractive is more like paint so the more and more colors you start to mix together with paint they actually add up to black instead of obviously like white with with the light example but in cinema 4d the RGB method is additive so the more and more you add the more closer to white gets that that's my understanding over anyway so let's let's get rid of these materials because they're obviously not doing the job and this doesn't look quite right like I said earlier so let's delete these let's get rid of these and in fact we can get rid of one of our fluids as well so instead of stacking fluids on top of each other we can actually do this in a single fluid so let's get rid of the yellow let's open the blue and put this back to why unless just call it fluid now what I'll do is I'll do a quick experiment if you like just to show you how these colors are blending together just to get a bit of a better understanding so in this texture slot in my color I'm gonna actually add a color riser and what that does is if we go inside it it basically lets us map something that's in our texture slot to this sort of gradient of colors here so we don't need all three of these let's get rid of the middle one and let's make these our colors okay so we had 200 in the blue didn't we I think oh excuse me yeah 200 there and then we can crank these right up to the top and say okay this yellow is exactly where we want it and this actually gives us a clue as to what was going on with our vertex map earlier as this goes from blue to yellow it doesn't transition through green on the way it's more like this sort of messy gray color so let's inform this gradient wise should be applied to by adding in our texture slot the vertex map shader and then if we delve into the vertex map we can add our white one again and then we can apply this material to our measure and then give it a render and it should look exactly like it did before when we were using the Alpha map method and it pretty much does we've got this gray in the middle which is exactly what we've seen in this gradient so this is what I think was going on before with the Alpha it was trying to mix and its journey to get from blue to yellow included.this now we could intervene here we could actually put another thing in here open this up in fact let's open up the thing here just to make sure that this position is actually at 50% so smack bang in the middle and we can actually choose a a green that we think this should be something like that and give it another render and see what the results are okay so that's a little bit more like it we're getting a mixture now but the problem that we're having is where they actually meet in the middle of that gradient gray is green but as it gets down to the bottom and they separate out they separate back out to yellow and blue which is not good so that's let's just get a better view what's going on here there we go so that's not what we want either and if we actually scoot along to the end this effect should be even more pronounced yeah so you've got like this strip down the middle which represents the middle of our gradient and it's not particularly nice you know we've got the mix happening here but they seem to be separating back out at the sides and this is definitely not what we want so onto my solution then so let's get rid of this and actually start putting together our fluid this scene let's get back to our camera view as well right okay so in our color channel I'm actually going to create a layer shader so before when we add a couple of materials stacked up and we were using the Alpha of one so we could see the material underneath we can actually do that in one material using the layer shader system so in here I'm gonna go to layer to create this and then when we go in there as you can see it's empty and then we can start stacking up our layers so let's actually just get our separate colors in here what we're going to need to do is add a color shader in fact we're going to need two of these and these are going to represent colors obviously so let's go to here in fact if we go back one we can actually name these so I'm going to name this color zero and color one oh that's not what I wanted to click there we go click on the title just to keep things organized we're gonna choose the colors that we had before so in this case I'm gonna make this yellow so that 60 and then full on both of these great and then color one is gonna be our blue so this is going to be 200 and these are going to be top like this so now it's like we've stacked blue on top of yellow and if I render you'll see that you're just gonna see blue because it's on the top so we need to do what we did before like defining a cut out if you like using the vertex map so what we can do is add a vertex map shader effects vertex map put this in between these two go into the vertex map and it's asking for vertex map now and we're just gonna grab our white one and bung that in there and come back to here now you'd think oh yeah that's that'll define it but it won't it'll just look exactly the same as it did before with the blue on top so we've actually got to change the blending mode of this vertex map so if you drop this down and say layer mask it actually masks out using that vertex map and that's now what we have great okay so there we go I'm actually gonna bung all of this stuff in a folder so let's create a folder and there's a good reason for this and you'll see in a minute so let's buy our color in there let's drag all of our stuff in there and it should be fine and I'm gonna name this folder separate colors okay cool you'll have to excuse the English spelling of colors there okay so we've got all of this in here so what do we need to do now well we can define our mix color as well so I'm going to create another folder oh and it's created it inside this one so let's drag that out so it's fully we don't want that in there all there we go there we go okay good and I'm gonna call this folder mix colors so mix colors there we go and I'm going to turn off the separate colors for now just so we can concentrate on this one what I will do though is open up the separate colors and I'm gonna right click on color one and say what do I want to do I actually want to copy this copy shader there we go and then click on mix colors and say pay shader so there we go we've got a nice copy of color one now and do the same thing with color zero copy shader click on this and pay shader and I'm gonna get them in the right order as well not that this that actually matters for what I'm doing here so this is our mix colors and you're thinking great you've got your colors in there but all you have to do is change the folder in fact change the top color which is blue to multiply so this basically multiplies this blue over this yellow and gives us the result of an excuse me multiply there we go of this green so that's our mix color give it a quick render lovely there we go so now we need to define we want this mixed color where the colors are actually mixing so let's turn off the mixed colors for now and so both of these are turned off what I could do is create a shader a vertex map shader where's that gone oh there he goes in there let's drag it out in between these two okay so now we've got this vertex map shader great go into it and maybe put our vertex map our white one go back and then actually set this to layer mask so this actually masks this from this and I can tell you now it's not gonna work but I just want you to understand why it isn't gonna work so now we render a dare so it looks like this is green whereas this bottom bit should be so we could try invert in the map but all that will do is invert image will get the opposite result this will be green up here so that's gonna be no good either so what we've got to try and do is find a way of basically finding the difference between our two vertex maps so that's what we're gonna do next so I'm gonna actually delete this vertex map and create a layer shader so we can play around with in it okay so this is our layer I'm gonna put this here and let's go into our layer shader and then think about what Y is that we're gonna do well we're gonna need both of our vertex maps in here so let's create a vertex map and I think you can copy if you drag yep there we go so we're gonna need vertex map zero and we're gonna need vertex map one why do I keep clicking on that I'm trying to change the name there we go so open up zero and we're going to drag weight zero into this and then we're gonna go into one and drag white one into that so now if you go back to the top level we've got this layer which I'm going to change to a layer mask because we're trying to cut out use these vertex maps to cut out or at least show the difference between these two colors so I thought oh that may work so let's give it a go and see what we get not much difference in fact it's not what we want at all in fact again this is terrible so if you're go into our layer shader I think I multiplied this over this so basically it's like these vertex maps are being merged if you like let's get back to our top layer yeah layer mask now that's kind of working but this layer marks needs to be inverted and if we right click on this layer mask and invert image we do get a result but it's not one we want and I found this quite confusing at first and but I did come up with a solution for it so basically inside my layer shader what when you actually need to do is create a colorizer and let me just make sure this is no longer inverted yeah so let's get this back to normal go into here our layer we're gonna get rid of these and we're actually going to create a colorizer now you saw why I did with this before I had it basically maps colors onto this gradient so I'm gonna get rid of these and a good way to invert this stuff now let's change this to white because basically a vertex map is a black and white value so that black and white value you represent in sort of zero and one and that's exactly what the black and white here is going to be doing zero and one so we need to multiply this over our vertex maps but we're going to need both of our vertex maps so if I just loaded white one into here that's not going to help us so we need to nest another layer shader in here so let's put another layer shader in go in and then we can load our vertex map so let's affect vertex map and then we do another one and and just as we had before just so I can keep track of what's going on we'll name that vertex map zero and I did it again there we go and vertex map one and in zero we're going to grab zero and in one we're gonna grab one brilliant so it's exactly like we did before and we're gonna multiply this top one over the bottom one so now we have this so let's go back to our layer shader sorry nialaya shader our colorizer and just give it a render and see what happens okay great brilliant I'm actually gonna reverse these so we've got white down this end and black up this end and let's see what we get so it's basically like we've inverted it great so we're getting the result that we had before but you notice that these are just yellow and blue and this stuff is kind of washed out at the bottom now the great thing about having our colorizer in this layer here if we go in again we've got this colorizer going again and then we got another layer nested in with our vertex maps but the nice thing about this is now we can actually affect this we can actually determine we can control where our mixes and all of that kind of stuff so what I'm gonna do is I'm gonna grab this black here and I'm gonna drag this down to a knot position of forty-five there we go so let's give that a render and see what kind of effect bars okay well it looks like this is getting more green which is good so we're actually sort of controlling that with this and if I do this it should get even more there we go even more green but this blend is becoming less and less or desirable if you know I mean these wouldn't be mixing at this point here so I'm gonna put this back to where I had it which was at 45 and I'm gonna see if we can do something else and this is the bit that I came up with which is a bit of a crunch and you know a bit of a workaround so let's go back one and it's at this point in here this is the layer with a colorizer so that let's just be clear we've got a layer we go in there and we've got the colorizer I'm gonna actually add a gradient here so let's go to shader gradient and we'll put this below and let's turn off the colorizer for now just so we can see what we're doing going to the gradient and I'm going to change this to 2d you from 2d you even to 2d V so it's a vertical gradient and I'm also going to position this black not here at not position what I'm going to say yeah let's call it 50 okay so you can see that this is what we get in now with this gradient not so let's just give it a render and see what kind of effect we're having okay that's not too great but we'll get to that in a minute so that's everything that we need to do with the gradient but the problem that we're having is because of the location of our texture tag and when I say the location you'll see what I mean in a second okay so let's close this for now grab our texture tag and this doesn't really tell us anything about our location but if you turn on this um texture mode here we now get this gizmo that we can move now currently this is set to UVW mapping I'm gonna change this to spherical because there we go and now we can see what's going on now we've got this texture tag selected we can see this spherical map and if we move this now we can control where that green actually is so let's go into the coordinates for this and we can change our size as well which is what I'm gonna do I'm gonna now I know my st. 135 by 7 to 1 so basically what we're trying to do is make sure that this sphere here envelops our fluid of them in a way that's desirable to us and that it's in the correct position so I know the position that I need to be is 1 3 5.1 four great and you can see kind of bleeds off at the top so let's just select this and go into our side view and then you get a better idea of what's going on here and it's applying that gradient up it and you'll notice if you remember in our gradient we put our grading not about 50% so that'll be the halfway mark here and it will start bleeding off as it travels upwards okay so that's why it looks like this so now we've done that we can come out of this make sure we go back into object mode give it a render and see what we look like ok so now we're getting a bit more of a result but if we go back through our animation to something like this and render we're still getting this horrible sort of white weirdness in the middle now you could probably forgive that you could probably sort of go you know what I could live with that that's not too bad and in fact you might prefer it and might look bail but in my case this is why I've the colorizer if we go back into this and go into our let's just make sure in the right place you get that right to the top okay yeah so let's go into our lair our lair and we've got this colorizer now if we would turn this on the whole Lots gonna be you know it's gonna well override what we just did with the gradient underneath but what we can do is multiply it over the top so let's change the blending mode of our colorizer to multiply and now when we render there we go we get best of both worlds we get this sort of blend that we've control in with our colorizer multiplied over the top of the little sort of like workaround plunge that we just did with the gradient now this isn't the ideal solution because you know in a scene like this it's fine we can use the gradient because we have a container that's been filled up and we can place our gradient where we want but if it was more eclectic scene where you had two fluids splashing into each other and that kind of thing this may not be good for that like I said this is this is a workaround more than anything and if I come up with a better method I'll be sure to to inform you guys about it but this is what I've come up with for this scene and I think actually let's just make sure that we've got a blend correct there as well yep so you know it's slowly blending into this green you can see the beginnings of green here and obviously the gradient is taking care of the green down the bottom so anything for past that fifty percent mark is getting fully green so as before we're not getting that problem now where as the fluids get further away from each other down the bottom you know before we had sort of blue on this side and yellow on this side and obviously you don't get fluids that unmix if you know what I mean once they're mixed they're mixed unless they've got different densities or something like oil in water or something like that but in our case it's the same fluid we're just using two separate Amir's so what I might do is actually experiment with trying different fluids so if we go to our measure we can see that we're producing weights based on our Amir's but I haven't tried to see me two fluids yet so that'd be my next little R&D adventure so yeah that's basically how you achieve something like this yeah so I hope you guys found that useful in some way that's basically my workaround for mixing two colors to get this sort of like multiplied paint mixing look and like I said I'll I'll keep making tests and if I come up with a better solution offshore to let you guys know if any of you guys have anything to add to this be sure to let me know in the comments if you've got a if you got an insight that I'm not aware of I'd love to hear it my viewers on youtube please like and subscribe and don't forget to hit that Bell to be notified of new tutorials you can check out content at digital meet UK where you can filter my tutorials by category and vote in the poll for upcoming tutorials you can also follow me on social media links in the description and the footer of my website if you'd like to help support digital meat this can be done via patreon all the support page on the website but if you want to help digital me keep going and back yourself some extra in-depth tutorial content the Prime membership is available for purchase in the store this will grant you access to the Prime membership area of the website thanks for watching guys ie [Music] you
Info
Channel: DIGITAL MEAT
Views: 14,762
Rating: undefined out of 5
Keywords: Digital Meat, Digitalmeat.uk, Cinema 4D, C4D, Cinema4D, Digitalmeat, Greyscale Gorilla, GreyscaleGorilla, Cinema 4D Workflow, C4D Workflow, Next Limit Realflow, Next Limit, Realflow, Real Flow, Realflow for Cinema 4D, Real Flow For Cinema 4D, Realflow Cinema 4D, Tutorials, Cinema 4D Tutorial, Cinema 4d Tutorials, C4D Tutorial, C4D Tutorials, Fluid Blending, Particles, Realflow Particles, Blending Fluids, Vertex Maps, Colour Mixing, Color Mixing, Mixing Colors, Mixing Colours
Id: WUOJrxcvXdk
Channel Id: undefined
Length: 41min 37sec (2497 seconds)
Published: Sat Jul 06 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.