Mesh Melt shader test


Quick test for melting mesh effect using vertex extrusion shader

Gif anim preview:

Forum topic:

– C# Script adjusts mesh vertex colors, based on the distance to heat point gameobject
– Then shader pushes(extrudes) vertices based on that vertex color (alpha)
– Would be probably better to do everything from script (to allow splitting the object, avoid intersecting faces etc..)

– Download sources below
– Add sphere to scene
– Add Melter.cs script to that sphere
– Create new material “meltmat” and assign it to that sphere
– Assign Custom/MeshMelt2 shader to that material
– Add empty gameobject to scene (this is the heat source)
– Assign heatsource gameobject into Melter.cs “HeatPoint” field in inspector
– Hit play, then inside scene view move heat source near to sphere to see effect

– Melter.cs has public bool, [x] Restore Color, this slowly restores vertex colors
– MeshMelt2.shader, see line 23 & 24 for different effects (melt in normal direction or melt downwards)
– Adjust Extrusion amount in shader material

Shader source: MeshMelt2.shader

Script source: Melter.cs


8 Comments + Add Comment

  • wa~sounds cool!

  • […] across a deformation shader which was easy and fun to use on a bunch of objects lying around (original inspiration). We discussed a bit about what can be done with it and what features were missing before we could […]

  • I am getting Array errors at 46 if Restore Color is enabled, and 50 if it is not.
    I have checked these lines and cannot find anything wrong with either.

    I am using Unity 5.

    • Yeah getting the same thing, any idea how to fix this?

    • Does it work if you try with default unity sphere? (works here atleast)

      • No, using a default sphere here is an image of the errors I’m getting:

        • Script updated, for some reason it didnt get the vertex colors from mesh, even though it worked before.
          (maybe I had modified the builtin sphere vertex colors during that unity session, so it had them, while in default there are no colors).


Leave a comment


Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.