5
$\begingroup$

I made this hexagon using a tutorial from erindale: https://www.youtube.com/watch?v=mLRqhcPIjg8&t=334s

enter image description here

I'm trying to make a pattern using this hexagon (the carpet pattern in "the shining") mathematically with nodes. But all my different measurements and equations rely on the hexagon being exactly the height of the square or two units. Just messing around with the less than value It got closer and closer as i approached the value .43333... (6.5/15) but if you look very closely you can see that its a little two big,

enter image description here

so when I tried to recreate the pattern it wasn't perfect.

If there's a way to find the height of the gradient and map it to 1 using map range, or maybe a different way to make a hexagon that defaults to this height, that's what I need.

$\endgroup$
3
  • 2
    $\begingroup$ By Pythagoras, the height of an equilateral triangle with side 1 is sqrt(3)/2. Split your hex into triangles and juggle.. the width of a hex height 2 is sqrt(3). Check out these ways of making a hex grid..? The first download includes a distance-from-edge function. $\endgroup$
    – Robin Betts
    Commented Jan 4, 2021 at 22:23
  • 2
    $\begingroup$ 3**.5/4 is the exact threshold that will match the plane. Dividing the gradient by this number will sort of "normalize" it. $\endgroup$
    – HISEROD
    Commented Jan 5, 2021 at 1:48
  • $\begingroup$ (The actual 2-unit height of your square doesn't make a difference, here.. you're using the Generated texture-space, which will always measure 0-1 along the sides of an object's bounding-box.) $\endgroup$
    – Robin Betts
    Commented Jan 5, 2021 at 10:39

1 Answer 1

5
$\begingroup$

By splitting a hex of height 1 into equilateral triangles, and Pythagoras, we know its side-to-side width is sqrt(3)/2. So, if we just look at the threshold in X, we know that has to be sqrt(3)/4. (And, IMO, that's an easier way to think about it than considering the dot-product branch of your tree)

enter image description here

You would hard-code that value into the Less Than, though, so it doesn't have to be recalculated for every shading-point... (the same goes for your existing sqrt(3). )

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .