Hi all,
I’ve investigated a behaviour which seems peculiar to me, and might benefit from an improvement. A Jsfiddle is included in this topic. The Jsfiddle goes pretty much along the lines of this Demo (geometry / teapot), except for the fact, that I’m using a LatheGeometry instead of the teapot, and a very simple 4-vertex path. You can also modify the # of lathe segments via a UI element. That said:
I’m starting with a decagon (latheSegments = 10) and am mapping the well known “uv_grid_opengl.jpg” onto it. Since this texture has 10 by 10 subdivisions, we arrive at ten nice and straight lines from each of the outer vertivces of the decagon towards the center vertex, when looking at this geometry right from the top, like so:
So far this is all nice and dandy.
But when you change the # of latheSegments to five (5), it looks like this, which is not so dandy anymore:
The vertical white texture lines at the u = 0.0, 0.2, 0.4, 0.6, 0.8 and 1.0 positions are still being rendered nicely as straight lines from the pentagon outer vertices towards the center vertex, but the lines from the 0.1, 0.3, 0.5, 0.7 and 0.9 “u”-positions are being rendered as zig-zag lines.
The zig-zag comes for a reason: each quadrilateral of a lathing band comprises of two triangles, which are being rendered independently of each other. In fact, they don’t even seem to know anything about each other. Which I believe is at the core of the problem. The vertex computation in the LatheGeometry seems impeccable, as does the (u,v) computation and assignment.
This is what appears to be happening (cyan lines added by myself for clarification):
What I would prefer to see is, that any vertical line in the texture is rendered as a straight line from the circumference (of the i.e. pentagon) towards the center vertex.
Can that be done without too much of a performance penalty?
Needless to say: the current behaviour gives really weird results with reflective materials and low path vertex and/or low lathe segment counts.
Btw: knowing what to look out for, this behaviour is also present in the teapot / geometry demo, when you select the smallest number of tessellation subdivisions (i.e: 2). See for instance the outer band of the lid.