Join Aaron F. Ross for an in-depth discussion in this video Varying fluid texture, part of Liquid Simulation in Maya.
Let's do a test render of our particles with just the default fluid shader applied. Get in really close on these, so we can see them more clearly, and do just a standard test render. That's what our particles look like with just the default shader applied. I want to store that image so I can compare it to others. And if you look closely at this you may notice that each one of the particles looks remarkably similar. And that's because, in fact, each particle has exactly the same fluid attributes.
That means each one is going to render the same. We got a really kind of repetitive look on this. We want to fix that up and the way to do that is to take the position of each particle and pipe that into the texture origin of the fluid that is doing the actual work of the rendering. We want to go to the hyper-shade window. Window > Rendering Editors > Hyper-Shade. We want to select the particles and in the hyper-shade click on Graph Materials on Selected Objects.
And let me maximize the hyper-shade. By the way I'll mention that if your not terribly familiar with hyper-shade then you might want to take a look at my other course which is called Creating Shader Networks in Maya and Mental Ray and that goes into great detail about the hyper-shade window. In here we're going to do some magic to make that texture look a lot more varied. Let's get in closer with Alt+Right, and you can pan across with Alt and middle mouse button. And you'll see here there's a particle sampler info node and it's feeding into this fluid shape node.
And that's whats actually doing the rendering. Notice, by the way, there's also a blend node here. That only becomes active if you choose Blobby Particles as your render type in the N particle shape node. Currently, because it's set to the default of Particle Cloud render type, that means that Maya's going to use this fluid to render the particles. If I hover my mouse over this connection wire you can see that the particle sampler info node is passing transparency, incandescence and color from the particles to the fluid.
In other words, if we change the color in the N particle node, then that will change the color in the fluid node. What we need to do here is we need to take the position of each particle and use that information to drive the texture in the fluid shape. So I want to right click on the particle sampler info node. The world position is a triple digit value. So I want to go down here to Triple. And you want to go to World Position > World Position. And that's all three x, y and z values.
So I've held my right mouse button down the whole time. And then when I've got it hovering over world position, I'll release the mouse. Then on the fluid, I want to left click on the lower left hand corner of that fluid node. And what we're looking for here is Texture Origin. There it is. Now that connection's been made. An again, if I hover my mouse over the connection wire, you can see it says, particle sampler info, world position is connected to fluid, texture origin. Let's minimize the hyper-shade and see what has happened here. I've got my render view minimized as well, so I'll bring that back up again. Here it is with just the default texture on each particle. And we'll do a render now.
We can see the result after we've connected the particles' world position to the fluid's texture origin. I'll go ahead and store that so we can compare it. So this is the one we just rendered and this is the one with just default parameters. So you can see here that these two particles are exactly the same and then after we've made that connection now each particle is different. There's one more thing we need to do, which is to get a consistent scale to all of these particles. And as you can see here the larger ones, the texture is kind of large, and on the smaller particles the texture is small.
So in the next movie, we'll correct that so that they all appear to be the same size.
- Creating dynamic foam and bubbles with nParticles
- Rendering particles with the Fluid shader
- Colliding particles and fluids with polygons
- Storing simulations with disk caches
- Emitting particles from a texture
- Pouring liquid with nParticles
- Converting particles and fluids to smoothed polygons
- Simulating volumetric liquid with a 3D fluid container
- Controlling key simulation parameters
- Texturing a 3D fluid