The "Curvature to weight paint" add-on for Blender (v4.0+) automatically converts 3D mesh geometry curvature into vertex group weight maps (weight paint).
Converts geometry data into vertex weights to easily generate masks for wear-and-tear effects (e.g., edge wear, dirt in crevices), modifiers (I use it for decimation), animation, or particle distribution.
Accessible directly from the right-click context menu and the Object menu.
Script logic: check existing vertex colors:
If missing, generate Dirty Vertex Colors via bpy.ops.paint.vertex_color_dirt().
Read the active color layer (mesh.color_attributes.active_color).
Extract the red channel (color[0]).
Invert the value (1.0 - val).
Assign inverted values to vertex weights.
The plugin is set so it should work in any blender version (maximum compatibility)
logic explained: https://youtu.be/m5LHxkAfC6o
Working code for blender 3.5 and logic explained: www.youtube.com/watch?v=3MqsnXkyGik