Lava Shader Effects in Maya
Application Used: Autodesk Maya
Author: Bogdan Amidzic
Lava shader effect
Here I will explain how to make a shader for lava effects using Maya's material editor, called Hypershade. For this tutorial I recommend basic knowledge about connecting material nodes inside Hypershade.
So for the lava effect, we will use the following procedural 3D textures:
Also, we are going to use the following Utility Nodes:
- 3D texture placement
First, create plane (NURBS or poly), and assign a lambert shader to it.
Go to Hypershade, graph the network of lambert material(lambert4 in my case, in yours will be lambert2 if you started with a blank scene), don't use lambert1.
Create stucco node (under 3D textures tab)
Stucco and the 3D placement node shall pop near the material. Also, open the Attribute Editor for stucco (ctrl+a)
Change shaker attribute to 30, and change channel1 to black and channel2 to orange.
Connect Stucco to the incandescence of the material.
Create Fractal texture (also under 3D textures)
Open color balance tab and click to change the color gain attribute.
In the color wheel, make the color orange. In the HSV sliders under the wheel, change V to 2.5 (basically the color goes higher than the actual color range, use this every time you need to create fire and explosions).
Connect Fractal to the channel2 of the stucco. You can do that easily by selecting the stucco, and then dragging fractal to the channel2 color (black rectangle).
Now you are starting to get something that looks like lava!
If you go to the persp view, you'll see nothing. You can go to the material attributes and turn on hardware texturing for incandescence channel, but the result will be ugly even at 256x256.
Instead, I prefer going in High Quality (in the viewport menu bar shading/High Quality Rendering option box). This mode works only if you have pixel shaders, and will display color/incandescence/bump all together.
In the options, change color resolution to 256 and bump to 512. Hit the Set button!
After a few moments, you will get nice hardware display. But now you can notice that there's no color from the lighting (just gray), and also there's no bump. So let's get to it.
Back to Hypershade, create another stucco node, change it's shaker attribute also to 30. Select placement of that new stucco and delete it!
Now connect the placement of the first stucco with the second stucco (just MMB drag from placement to texture and a small menu will pop up - choose default)
Also connect the second stucco to the material color attribute.
* Some of the names of the nodes maybe won't match with the names of the ones you've created, but I don't want to bother you with renaming nodes:
I'll call the stucco we created first, incandescence stucco, since it's connected to incandescence.
I'll call the second stucco, color stucco, since it's connected to color.
Now create Granite texture (also 3D texture), and change it's attributes like I did.
Connect the Granite to channel1 with the "color stucco".
Make Multiply/Divide node (under general utilites), and connect Granite.OutColor to the MultiplyDivide.input1. Change input2 to 0.5, 0.5, 0.5.
Connect MutiplyDivide.output to channel1 ot the "incandescence stucco".
* MiltiplyDivide node is reducing strength of Grainite color to a half, so it will shine a bit in the incandescence. You can change input2 as you wish, feel free to tweak the lava colors more.
Also you can select Granite placement and scale it in viewport to get it to the size of granite you want. If the viewport is in High Quality mode, you can do this interactively. I've scaled the placement node about 4 times.
If you render now, you should get something like this:
Create another stucco texture and delete its' placement, than connect the placement of the first to that new stucco (like you did with the second stucco node),
Change shaker to 30, and make channel1 white, and channel2 black (so that channel1 is higher then channel2)
Connect the third stucco to the bump of the material (bump3D node will be automaticly created).
* This stucco node I will call bump stucco
Create Set Range node (under general utilites), and connect granite to the setRange node (just MMB drag from Granite to SetRange node, a menu will pop up, choose value).
In the SetRange node enter these values:
Connect SetRange.OutValue to channel1 of the "bump stucco"
Create another SetRange Utility and connect SolidFractal to it.
Connect that SetRange Node to channel2 of "bump stucco"
* I did this thing with set range nodes to compress textures to selected color range, so the height of channel 1 will not go over 0.4 (that's hot lava height) and the height of the channel2 will go from 0.6 to 1 (that's cold lava).
Now you can preview bump in either viewport or render view. You can see, that bump alone is not enough so we are going to add some displacement. You can add some lights to see the bump a little better.
Create MiltiplyDivide node and connect the "bump stucco" to Input1 of the MultiplyDivide Node.
Input2 will control displacement height, so I entered 0.5 to make displacement lower, but you can change this number as you wish.
Now Create Luminance node (under Color utilites), and connect MultiplyDivide to it. Then connect Luminance node to material displacement attribute (again MMB from Luminance to material (lambert), then choose displacement).
* You cannot plug MultiplyDivide directly into displacement, since displacement works only with alpha information (grayscale). So we are going to converting RGB of the MultplyDivide to Grayscale information using the Luminance Node.
Now if you graph network on the material, you can see that Maya has connected Luminance directly to the displacement shader attribute of the Shading Group. This is bad!
Delete that connection and create Displacement node (under Displacement), and connect luminance to it. Then connect that displacement node to the shading group.
And the last thing ?Glow. For the glow, create MultiplyDivide and connect "incandescence stucco" to input1 of that MultiplyDivide. Input2 should be 0.2 less, basically that number controls the strength of the glow. Create Luminance node, and connect MultiplyDivide to it, and connect that Luminance to material GlowIntensity.
So in the end, you get a shading network that looks like this.
* As you can see, there is only one placement for all three stucco nodes. I did that because this way, you can change the size of lava without having to grab three placement nodes. Also I left SolidFractal and granite Placements separated because they are not the same sizes and of course if you want you can animate SolidFractal movement so you can get the effect of hot lava moving beneath the cold lava.
Then set your displacement values. I used mental ray and made a displacement approximation node, to get nice displacement. You should get a render like this: