How can I unwrap UV and have the results automatically match the scale of my texture?

I have textures I’ve created which wrap and are at specific scales, e.g. maybe one texture’s scale is such that the width of the whole texture is exactly 12 inches.

I’m creating models which are also at a specific scale, e.g. one blender unit = 1 inch.

I’m trying to find some way to unwrap UVs such that Blender automatically creates the UVs so that e.g. if I unwrap a face that’s 6 blender units wide and 3 blender units tall, it creates UVs that are 1/2 the width of the texture and 1/4 the height of the texture, since the texture is 12 blender units wide and tall.

The closest thing I’ve found is the “Project from View” unwrapping, as it’s the only one that seems to preserve the shape of the polygons (though only when I’m looking straight at them) but the scale it chooses merely depends on my present zoom level, which might be a usable way to do this if I could see it displayed somewhere so that I could make sure I’m always using the correct zoom level when I unwrap UVs, but I can’t.

So what I’ve been doing is the “Project from View” unwrapping, but then I have to go into the UV editor and scale the UVs up or down, and at that point I’m just guessing at the correct scale and so it’s easy to accidentally apply a texture that’s incorrect in scale by a factor of two or more. Since I already know the scale of the texture, it would be great if I could just type that in somewhere and get perfect scaling.

I note that there are “scale” values for a texture, but while I can’t figure out what they do, they don’t seem to do this. In particular there are X, Y, and Z values whereas what I’m looking for would either have just an X and Y value or be in terms of pixels per blender unit.

For reference, what I’m trying to do here is like apply a wood texture to wood objects, a carpet texture to floors, etc. So I start by just taking a picture of something with the texture I want, with a ruler in the shot, so that I can then load the picture into Gimp and scale it to a specific DPI and then use Gimp’s “resynthesize” plugin to create a new texture that resembles the photo but tiles perfectly. I don’t really care whether the UVs wrap around corners correctly, or if I have to rotate the UVs afterwards so that the wood grain goes along the length of a board, as the texture isn’t all that wonderful anyway. The idea is just to have something that looks more realistic than flat colors. I just don’t want to have to guess at the correct scale every time I unwrap UVs for every single object, as I’m sure to guess very incorrectly at times and thus end up spending a lot of time correcting very bad guesses only to then find that correcting one bad guess makes another bad guess more obvious. So I’d like to be able to just type the scale in somewhere (like as a property of the texture itself) as like “width and height of texture in blender units” or “pixels per blender unit” and then when I unwrap UVs the scale gets used by default. …or even more ideally, the UVs are unwrapped to that scale by default when the material is applied to the object.

There are some UV unwrap add ons I didnt think I needed but might be helpful for you I will try to find when i get home in a few hours.

That being said I honestly think you’re better off guessing. What you could do is create a single 2 by 4 with real world scale and visually scale your texture to match that. What I like to do is put a single person sized object in my scene and make sure everything looks ok in relation to it.

I don’t get how you could count that. Usually density of pixels on the texture per unit on the mesh is counted the other way around, like 512 pixels is 1 meter or something like that. Then it is considered as 512 pixels / 100 cm = 5,12 px/cm and it is called texel density.

This is closer to what texel density is and what is done by some quite useful addons like TexTools > UV Layout > Get / Set Pixel per unit ratio (in the UV editor). Then you pick density from one mesh you count texel density for and apply it for all others getting the same level of details on the textures. See TexTools thread for more info (it has way more functionality that this).
Generally Ctrl+A in Edit mode in UV editor does the same, it equalizes scale of UV islands to make resulting density the same however it can’t use value from one island to others as reference, it makes kind of averaged value instead.

I don’t get how you could count that. Usually density of pixels on the texture per unit on the mesh is counted the other way around, like 512 pixels is 1 meter or something like that.

It’s just another way of saying the same thing. If the texture is 12 blender units wide, and it’s 512 pixels wide, then it’s 512 / 12 = 42.666 pixels per blender unit.

The advantage to saying it that way is that it’s independent of image resolution. Like if I started with a 4096x4096 texture, but that was too much detail and so I downscaled it to 512x512, it would still be the same number of blender units wide, but I’d have to recalculate the pixels per blender unit.

some quite useful addons like TexTools > UV Layout > Get / Set Pixel per unit ratio (in the UV editor)

That seems to do what I want. Thanks!