9
$\begingroup$

I've been stuck on how to approach this for a while, so any suggestions would be gratefully appreciated!

I want to map a texture in the form of a lower right euclidean triangle to a hyperbolic triangle on the Poincare Disk.

Here's the texture (the top left triangle of the texture is transparent and unused). You might recognise this as part of Escher's Circle Limit I

Sorry, see the comment as I am not allowed to post more than two links it seems!

And this is what my polygon looks like (it's centred at the origin, which means that two edges are straight lines, however in general all three edges will be circular arcs):

Wireframe Polygon

The centre of the polygon is the incentre of the euclidean triangle formed by its vertices and I'm UV mapping the texture using it's incentre, dividing it into the same number of faces as the polygon has and mapping each face onto the corresponding polygon face. However the the result looks like this:

Textured Polygon

If anybody thinks this is solvable using UV mapping I'd be happy to provide some example code, however I'm beginning to think this might not be possible and I'll have to write my own mapping functions.

SOLVED with some refinement of @Nathan's answer below since the lines AB, AC, BC may actually be arcs not lines.

Method: pick the longest side, say BC, then subdivide this into an even number of parts. Subdivide the other two side into the same number of parts. Then the lines connecting these (DE in the answer below) must actually also be arcs, not straight lines. Subdivide these new arcs as required, add the new triangles as faces then UV map the lower right triangle of the texture to these new faces.

Simple? Not at all. But it worked. Fish 1 Fish 2

$\endgroup$
  • $\begingroup$ Here is the texture I'm using: i.stack.imgur.com/SEi0G.png $\endgroup$ – Lewy Blue Feb 29 '16 at 19:19
  • 1
    $\begingroup$ I assume the issue is the shearing of the image? I see this happens where you have inconsistent spacing between the vertices of the triangular subdivision. My guess is you are using consistent steps for your uv mapping, giving you the shearing effect. $\endgroup$ – Daniel M Gessel Mar 1 '16 at 23:15
  • $\begingroup$ I actually fixed that shortly after posting this by making the subdivisions consistent and smaller, it fixes the shearing somewhat (although not completely). However the texture is still very distorted. I'm working on @nathan suggestion below, which at the very least will allow for a much finer subdivision. $\endgroup$ – Lewy Blue Mar 3 '16 at 0:06
  • 1
    $\begingroup$ @Looeee Could you pass your code please, I'm very interested in this field of graphics $\endgroup$ – x-rw Nov 17 '18 at 15:58
  • $\begingroup$ Yes, you can find my code here: github.com/looeee/blackthread-heroku/tree/master/assets/js/src/… And the live version: blackthread.io/experiments/eschersketch Honestly, it's so long since I looked at this that I can't remember where in the code the functions that solve this are, but if you have trouble making sense of it drop me another comment here and I'll take a look. $\endgroup$ – Lewy Blue Nov 18 '18 at 12:41
8
$\begingroup$

My guess is that to get the texture to look right, you'll have to subdivide the interior of the triangle as well, and approximate the non-linear UV mapping within it.

Currently, it looks like you're subdividing around the edges of the triangle, and forming a fan of smaller triangles between the edge and the incenter. This would be fine if you were just rendering the triangle in a solid color. But when applying a texture, you're getting discontinuities at the boundaries of those subdivisions, because the texture is just stretched linearly across each subdivided triangle and not correctly approximating the hyperbolic mapping along the radial direction.

You'll need to subdivide along both axes, something like this:

enter image description here

and position all the vertices appropriately in screen space and UV space to approximate the hyperbolic coordinates in the interior of the triangle. If you subdivide finely enough, this should produce the illusion of a continuously curving texture mapping.

$\endgroup$
  • 1
    $\begingroup$ Thanks, I'll try this. It was one of my original methods of building the polygon, however much more complex mathematically so I went with the simpler method. I'll give it another shot and report back. $\endgroup$ – Lewy Blue Feb 29 '16 at 20:58
  • $\begingroup$ Thank you. I was able to modify your suggestion into a solution. See my edit above. $\endgroup$ – Lewy Blue Mar 4 '16 at 17:16

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.