title: Unity/CG: Scale object in vertex shader
body: <p>I'm trying to write a vertex shader that scales the size of the object. I've found many "solutions" to this problem, all to the tune of "expanding vertices along the normals" like so:</p>
  
  <pre><code>v2f vert(appdata_base v)
  {
      v2f OUT;
      float3 norm = normalize(v.normal); //Unity 5 fix
  
      v.vertex.xyz += norm * _Scaling;
      OUT.pos = mul(UNITY_MATRIX_MVP, v.vertex);
  
      OUT.normals = v.normal;
      return OUT;
  }
  </code></pre>
  
  <p>However, this does not work for objects with sharp edges, such as cubes. In the case of a cube it just makes the sides move directly out but the sides stay the same size thus you get an "exploded" cube:</p>
  
  <p><a href="https://i.stack.imgur.com/T3JxC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T3JxC.png" alt="enter image description here"></a></p>
  
  <p>Can someone tell me what I might be missing to get any object to scale properly in the shader?</p>