[MED] 'absolute' texture coordinate snapping

Posted By: YellowAfterlife

[MED] 'absolute' texture coordinate snapping - 05/10/11 23:10

While MED has a number of nice tools and modes that make texture mapping a lot easier, but lacks one really simple one.

Sometimes there is a need to set texture coordinates to one of sevaral grid-snapped values. May it be a converted WED level (tiled texture, for which often only values {0, 0.25, 0.5, .. } are sed), 'perfect' rectangle part of texture, or a low-resolution texture that you later want to use with nofilter entity flag. I've chosen last one as example.

When using 'generate mapping', texture coordinates are often 'irregular', especially if you turn on 'Show Texture Coordinates' (which is still labeled 'Show Texture Coordinaten' by the way):

30.7777...? That's probably a nice number, except this quarter of pixel can be quite noticable when looking at model in preview window and in-game.
Of course, it's often possible to select that single vertex, and just type in the right texture coordinates - and that's what I do most of time. But sometimes there is more than one:

There, you can see that there are multiple vertices with this kind of problem. The fastest solution remains to type in coordinates for 'control' ones manually, and try to snap the rest of vertices to these by either specifying Snap value equal to delta, wielding them (often a bad idea), or typing in coordinates manually.

A similar situation happens with Rotate and Scale tools. There times when you do not need to rotate your vertices by exactly 91.0102 degrees, there are times where scaling selection by {1.974, 2.143} would only hurt your otherwise perfect texture map.

So, the request itself:
Absolute snapping, which could be enabled via bottom 'pop-up' panel.
Principle of work is as simple as:
vX = round(pX / aS) * aS
vY = round(pY / aS) * aS
Where {vX, vY} - new vertex coordinates, {pX, pY} - potential coordinates (as if dragged without snapping), and aS - the snapping value.
So if you have abs. snapping set to 0.5, and drag the point from initial position {0.1, 0.1} to {0.7, 0.7}, it will be snapped to {0.5, 0.5}.

To compare to the snapping avaible (relative?), that seems to work like:
vX = floor(pX / rS) * rS + rX
vY = floor(pY / rS) * rS + rY
rX = oX % rS
rY = oY % rS
Where values are same as above, plus {oX, oY} being the initial texture coordinates, and rS being the relative snapping value.

Hopefully I told my thoughts clear enough.
Thanks in advance.
Posted By: Pappenheimer

Re: [MED] 'absolute' texture coordinate snapping - 05/11/11 17:25

I know the answers to earlier requests relating MED, and I fairly doubt that there will be applied any new feature to MED other than importing features.

You can set several vertices at a single point, when selecting them at once and scaling them down 'to zero'.

You can set several vertices into a vertical or horizontal row, when selecting them and scaling them down, while the scaling is restricted to vertical or horizontal.

Hope this helps.

EDIT:
Another suggestion:
You could use Atlas mapping with maximal stretch set to zero.
It doesn't manage to set all rectangular faces rectangular on the uv, but at least the most. And for the rest you could use 6-sided Mapping...?
Posted By: MrGuest

Re: [MED] 'absolute' texture coordinate snapping - 05/11/11 22:05

While scaling them all to zero will give them the same position, it doesn't give them an 'absolute position' which YellowAfterLife was asking for.

Grid snapping is available when moving vertices and polygons on the model but not when moving on UV.

Either allowing position to be edited or grid snapping would be a useful feature (preferably both).
© 2024 lite-C Forums