Unity Settings

source: https://forum.unity.com/threads/warning-to-all-my-friends-beware-optimise-mesh-data.544735/

Optimize Mesh Data will strip unused in mesh component. If the project only instantiate mesh during runtimes, Unity might delete some components in the build, such as lightmap uv.

Unity Shader

Erosion

The most basic erosion (or dissolve) is the alpha clipping method. To soft the erosion, we can instead use a float to convert the noise between 0 and 1, and use the result as alpha. Twitter

Flat Shading

To ensure the triangle is flat, we can not use the normal vector provided by the mesh. We can calculate the normal in the fragment shader by using the rate of change of the world position. ddx and ddy return the approximated derivative in screen space horizontal and vertical coordinates.

float3 dpdx = ddx(positionWS);
float3 dpdy = ddy(positionWS);
float3 normal = normalize(cross(dpdy, dpdx));

Another way is to use geometry shader to calculate the normal of three vertices, and update the normal.

[maxvertexcount(3)]
void geo(triangle Varyings input[3], inout TriangleStream<Varyings> stream)
{
    float3 p0 = input[0].positionWS.xyz;
    float3 p1 = input[1].positionWS.xyz;
    float3 p2 = input[2].positionWS.xyz;

    float3 triangleNormal = normalize(cross(p1 - p0, p2 - p0));
    
    input[0].normalWS = triangleNormal;
    input[1].normalWS = triangleNormal;
    input[2].normalWS = triangleNormal;
    
    stream.Append(input[0]);
    stream.Append(input[1]);
    stream.Append(input[2]);
}

wireframe

Wireframe Shading

Barycentric coordinates In a triangle, the minimum value of a barycentric coordinates is the minimum distance of a point to the edge. If we use the minimum value as color, we can see triangles outlines. The value will be 0 at the edge and 1/3 at the center. We can use smoothstep to smooth the value to draw finer outlines.

[maxvertexcount(3)]
void geo(triangle Varyings input[3], inout TriangleStream<InterpolatorsGeometry> stream)
{
    float3 p0 = input[0].positionWS.xyz;
    float3 p1 = input[1].positionWS.xyz;
    float3 p2 = input[2].positionWS.xyz;

    float3 triangleNormal = normalize(cross(p1 - p0, p2 - p0));
    
    input[0].normalWS = triangleNormal;
    input[1].normalWS = triangleNormal;
    input[2].normalWS = triangleNormal;

    InterpolatorsGeometry g0, g1, g2;
    g0.data = input[0];
    g1.data = input[1];
    g2.data = input[2];

    g0.barycentricCoordinates = float2(1,0); // barycentric coordinates adds up to 1, so vector2 is enough
    g1.barycentricCoordinates = float2(0,1);
    g2.barycentricCoordinates = float2(0,0);
    
    stream.Append(g0);
    stream.Append(g1);
    stream.Append(g2);
}

Awesome VFX

Speed Distortion: https://twitter.com/andre_mc/status/1484246279567949824?ref_src=twsrc^tfw|twcamp^tweetembed|twterm^1484246279567949824|twgr^|twcon^s1_&ref_url=https%3A%2F%2Fhalisavakis.com%2Ftechnically-art-issue-121-11-02-2022%2F

Whispy Boom: https://twitter.com/simonschreibt/status/1487863546893451269?ref_src=twsrc^tfw|twcamp^tweetembed|twterm^1487863546893451269|twgr^|twcon^s1_&ref_url=https%3A%2F%2Fhalisavakis.com%2Ftechnically-art-issue-121-11-02-2022%2F

UE4 Lighting Sphere Effect: https://twitter.com/NotSoLittleC/status/1490424757325639680?ref_src=twsrc^tfw|twcamp^tweetembed|twterm^1490424757325639680|twgr^|twcon^s1_&ref_url=https%3A%2F%2Fhalisavakis.com%2Ftechnically-art-issue-121-11-02-2022%2F

Hyper Foliage: https://assetstore.unity.com/packages/vfx/shaders/hyper-foliage-208353