1
$\begingroup$

Edit: Thank you @Gorgious, scaling the points to the 2D cursor worked. I hope blender updates Constrain to image bounds to work properly with UDIM tiles.

I'm trying to set the y-coordinate of a bunch of vertices to 0. (Some of my vertices are less than 0 and it causes issues in external software.) I select the vertices, and set all their y-coordinates to 0. I should not have to worry about floating point inaccuracy since 0 has a perfect representation. Yet entering 0 as the y-coordinate does not set them all to 0, most are a bit above or below.

If I try to set them one by one, the first one gets set to 0 properly, but then setting the adjacent one to 0 messes up the previous one again. What on earth is going on? Attached a picture of my UV layout and the vertices I'm trying to set.

UV Editor with y-coordinate of selected UVs.

$\endgroup$
2
  • 1
    $\begingroup$ Can you please upload a blender file so we can see better? $\endgroup$ – 10 Rep Nov 25 '20 at 5:34
  • $\begingroup$ @10Rep Updated the post to include it. $\endgroup$ – vankessel Nov 25 '20 at 20:02
7
$\begingroup$

Like most other fields in blender when you modify this value, you actually modify the mean (not median as sometimes stated in the tooltip...) value of all the vertices, not all their individual values.

You can use the scale transform tool to scale everything along 0. Use the 2D cursor as a pivot point to do it :

enter image description here

$\endgroup$
5
  • $\begingroup$ What do you mean '0 does not have a "perfect" representation in floating point precision'? Isn't 0 in IEEE-754 floating-point binary 00000000000000000000000000000000? Seems perfect to me... When you do math and need to compare to 0 the result of math operations may not be 0 when it should because of binary rounding errors that's why you may not want to compare some result to 0, but 0 representation is fine the way I understand it. Am I missing something? $\endgroup$ – Martynas Žiemys Nov 25 '20 at 8:15
  • $\begingroup$ @MartynasŽiemys In IEEE-754 the sign bit can be 0 or 1, so you have -0 and +0. Of course in comparison the values are the same and since vankessel manually sets the values to 0, floating point precision should not matter... or do I get something wrong? Gorgious: The Zero has two "perfect" representations, the positive and negative zero. I guess what you are referring to is due to the rounding of very small negative numbers to -0.0 and very small positive numbers to +0.0? $\endgroup$ – Gordon Brinkmann Nov 25 '20 at 8:48
  • 1
    $\begingroup$ @Gorgious btw your question "mean or medium?" is a good valid question, since Blender uses the term "Median Point" in the "Transform Pivot Point" menu misunderstandably. In maths, median value is the middle value in a list in numerical order, while mean value is the average of this list. E.g. in (12, 19, 11, 13, 20) the mean value is (12+19+11+13+20)/5 = 15. Median value is the third of five when sorted, so from (11, 12, 13, 19, 20) => 13. If there are two middle values (because of an even number of them), the median is the average of both. Blender uses the mean, not median point as pivot. $\endgroup$ – Gordon Brinkmann Nov 25 '20 at 10:50
  • 1
    $\begingroup$ @GordonBrinkmann Good points. Thanks for the info :) $\endgroup$ – Gorgious Nov 25 '20 at 11:33
  • $\begingroup$ @Gorgious Actually I was referring to the statistical Median which is also used for stacking images etc. There's a Geometric Median (Wikipedia) as well which would make sense here, but if you look at the graphic in the article you can see that Blender uses the "Center of Mass" as Median point. When I recreated the image there I also realized when setting the origin of an object with those points, then "Origin to Geometry" and "Origin to Center of Mass" gave the same result. But now I'm drifting away too far from the topic ;-) $\endgroup$ – Gordon Brinkmann Nov 25 '20 at 14:10
5
$\begingroup$

A different way to align them at the bottom would be, with all respective vertices selected:

  1. Scale them to 0 on the Y-axis by pressing S > Y > 0 > Return
  2. In the UV menu, check Constrain to Image Bounds
  3. Move the vertices down until they hit the bottom with G > Y > Return
$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.