[Unity] Lava Flowing Shader


Done with blending 3 textures:

1. Rock with some outline glow, transparent background (RGBA)
2. Distortion map made with the above texture, but blurred (A)
3. Lava, where the scrolling UV takes place (RGB)


The shader is just 1 draw call [that little poor man doesn’t count xD its just for fun] so I can’t add more texcoords to it to create more layers with different scrolling speeds

The distortion effect is just what so called “water refraction” shader, which is modified from the code: http://unitycoder.com/blog/2012/02/26/water-splash-screen-effect-shader/

The scene works in my i9000 phone with 4x-5x fps but the scrolling stops working after one UV cycle.  Newer devices runs smoothly without any problem.



I further added vertex displacement animation to the lava by using the script in : https://stevencraeynest.wordpress.com/2013/03/29/easy-volumetric-explosion-in-unity3d/


Also tested in my i9000 phone, the scrolling problem still exists, but the displacement animation works fine.

6 thoughts on “[Unity] Lava Flowing Shader

  1. Cool! Looks terrific.
    I always love lava in games. The most brilliant game with lava in it I think is From Dust. I thought that was a very inspiring game. Also the water in that game really formed sand delta’s as it flowed down mountains.

      1. No thanks! Yeah also the sounds of the volcano are real sounds recorded from a real volcano. It really sounded impressive. I’m still waiting for more From Dust kinda games:( Btw the much older game black & white 2 also has great volcano,lava effects.

    1. good reference also!
      I didn’t play lots of games….I really should see more >0< so anyway, thx again xD

      this lava shader idea actually came from the guild wars2 mega destroyer scene. I saw the lava flows with some distortion between layers

      1. That’s ok:) I should play more games myself but i don’t have the money for it nowadays. Being an artist made me a poor bastard:/. Good luck with the lava Dexint. I’ll keep an eye on your blog and I will upload some of my programming work in the coming days. Cheers!

  2. Terrific! Is it possible to make the rocks and the lava go in different direction, up and down. Been trying this but I can’t find the solution. Cheers!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s