Let’s consider the extrusion surface shader from here:
Here is the vert function which makes the extrusion:
void vert (inout appdata_full v) {
v.vertex.xyz += v.normal * _Amount;
}
Assume I have a scene with number of boxes varying with scale (uniform or not uniform) and rotation and all the boxes use this shader.
How to modify the above function so that the visible extrusion was the same in world space on all the boxes?
I guess I have to use _Object2World and _World2Object to transform the data to world and back,
but how to transform the normals?
On normals only rotation should be transformad, the scale should be left untouched.