Generating univeral UV coords

I am trying to write an algo that will map UV coords to brushes in my engine, in a universal way, so the UV coordinates will be continuous and smooth.

For instance, if you put two brushes one aside the other, you will not be able to see when one brush is ending and the other begins, because the UV should be continuous.

Another example:
The texture should repeat on a big brush, not to strech on all of it.

I have tried to project the polygons into the y plane. That works fine only for polygons parallel to the X, Y, or Z planes,
otherwise the UVs look shifted.

Any suggestions?

[This message has been edited by Quaternion (edited 01-16-2002).]

What you’re asking for is a topic of “on going research”…

Depending upon what you’re trying to achieve, you could have an arbitary plane that you project to- but that will stretch as any surface pulls away from that plane. Some modeling packages allow for “guide splnes” to be specified that are used to generate UV coords along a complex surface. But I believe that to really make a “univeral” texture coordinate mapper, you need to go into 3D textures- the result is sorta like carving your model out of a cube of marble (or whatever your 3D texture looks like).

How do the recent games’ engines do the UV coords?

The 3d-artists apply them by hand when modelling. Or rather, that use e.g. cube or planar mapping and then tweak the results.