Quantcast
Channel: effect – Unity Coding – Unity3D
Viewing all articles
Browse latest Browse all 18

Mesh Melt shader test

$
0
0

mesh_melt_shader

Quick test for melting mesh effect using vertex extrusion shader

Forum topic: http://forum.unity3d.com/threads/has-anyone-ever-written-a-mesh-melter.311135/

Info:
– 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..)

Instructions:
– 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

Customizations:
– 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

Gif anim effect preview:
http://pasteboard.co/1QARh81p.gif


Viewing all articles
Browse latest Browse all 18

Trending Articles