Manual creation (on fly) of a real world scale uv unwrap for custom geometry

Task: apply a texture (real wordl scale) to a code-generated mesh, without distorting the scale
I am drawing (generating) the walls and the floor from the drawing of the room (set of points)
I need to apply real world materials to the generated walls/floor so that the scale of the textures on them is not distorted when changing shape/size.

The problem:

  • The generated mesh has no sweep.
  • If I shape a mesh with xatlas the texture scale changes
  • if i use a simple shader - the scale also changes