lavashader

LAVASHADER

for 20 hours in The Game Assembly we assigned us self a task. I choose to make a lavashader in Unity. So I overscoped it and learned Houdini a bit on the way and made a simple interface to play with the settings in the shader. You can test out the WebGL version of it here. But It was my own project so I didn’t mind overscope it.

I decided to work with Maya, Unity, Houdini and Amplify Shader plugin for Unity

First off I made a blockout in Maya, then made a nicer mesh and exported it to Houdini to create final mesh and also create flowmap

I used Houdini to generate flowmap. For that I used the normal direction affected with curves and in the end added a combe node to edit som extra details.

In Houdini I also made a rock generator to populate rocks in scene. I then made it a digital asset and used it directly in Unity With the Houdini Engine.

Finally in Unity and after setup the scene, I started working on the shader.

With the flowmap from Houdini I first extrude the channels only to red and green. Subtract 0.5 and multiply with 2. That extrude the base flowmap color and only show the flowmap as masked so I easily can just add it on the existing flowmap. I then have time-node moving the flowmap. To avoid repeating pattern I used lerp-node between Two UV sets with noise and time offset.

To get a nice effect so the edge dont get so strong, I used three textures to blend the edge. a-b-c is lavashader and d is rockshader.

In the shader I used vertex color to differentiate between the textures. I also added some multiplier and Power Of to sharpen or move the edge.

  1. lerp between floating lava-UV-textures to have a nice flow
  2. with vertexcolor, still lava-texture is added with red color
  3. with vertexcolor, rock-texture is added with blue color
  4. the vertext color extractor
  5. som multiplier that I used for cranking up the emissive to bake lightmap for the scene.

To tweeking the vertex color i Used the Unity Fbx exporter beta plugin to paint the vertex color in maya. I planned to use a Houdini Tool to make it live in Unity, But didnt have time for it.

To make the lava have some wave I decided to use black and green vertexcolor to divide it.

  1. Two  different wave offsets.
  2. Masking out with green vertex color
  3. With the world normal i make sure only surface with Y-axis get effected. Used it as a mask
  4. where the green channel come from
  5. append the vector to 3vector component and send it to the Vector Offset Input in the shader

There are a lot of stuf that I would change and do another way, but I will put that energy to learn new things. I want to work some more on the shader and add some more effects. Make a nicer way to mask between textures, make the waves work better and add some functionality where rocks are moved with the flowmap. But not today! Thanks for reading and have a great day! Don’t forget to check out the WEBGL I made for this. Click below for link.