(2019-12-16, 23:50)Travis Cobbs Wrote: I'm not sure I fully understand. I think perhaps the existing wording is ambiguous, but not necessarily wrong. P1 has an infinite number of normals. Unless I'm misremembering, the intent is to take one of those normals that originates along the line between p1 and p2, move along that normal some arbitrary distance, and use that point (along with p1 and p2) as the third point for P2. So, for example, add the normal vector for P1 to p1 to obtain the third point to construct P2.
That is also how I understand it. However. It doesn't matter which normal of P1 we take, P2 will still be well-defined based on this choice. This is the current content of the spec:
Quote:Code:
x1 y1 z1 x2 y2 z2 x3 y3 z3 a b
The first point represents the center of the sphere. The second point represents a point on the sphere where the center of the texture map will touch. The third point is used to form a plane (P1) that is perpendicular to the texture and bisects it horizontally. An additional plane (P2) can be computed by using points 1 and 2 and generating a 3rd point along the normal of P1. P2 will be perpendicular to both P1 and the texture and will bisect the texture vertically. The two angles indicate the extents of the sphere that get mapped to. These are –a/2 to a/2 and –b/2 to b/2 as measured relative to the vector from point 1 to point 2 and within the planes P1 and P2 respectively.
Now to map world coordinates to texture coordinates, U is given by the angle between the vector formed by points 1 and 2 and the vector formed by point 1 and a world point that has been projected to the plane P1. The angle is divided by "a" to normalize it to between 0 and 1. V is given by the angle between the vector formed by points 1 and 2 and the vector formed by point 1 and a world point that has been projected to the plane P2. The angle is divided by "b" to normalize it.
As I understand it we have the three points p1, p2 and p3 and the two planes P1 and P2:
- p1 is the center of the sphere.
- p2 is the point on the surface on the sphere from where the center of the texture will be mapped.
- p3 is used to define P1 by having p1, p2 and p3 lie on P1. We thus get U for a point p by taking the projection point q1 of p onto P1 and compute the angle between p1p2 and p1q1 before normalising by dividing with the factor a. Furthermore, I can compute a normal of P1 as the cross product between p1p2 and p1p3. Let's call such a normal N1. P1 can thus be defined by N1 and a point on it (any of p1, p2 and p3).
- P2 is constructed similarly by having p1 and p2 on it, but the third point is taken along a (non-zero) normal of P1. Since "P2 will be perpendicular to both P1 and the texture and will bisect the texture vertically", P2 is well defined: You can compute a normal N2 as the cross product between p1p2 and N1.
- Given a point p, we let q2 be its projection onto P2. The value V is then computed as the angle between p1p2 and p1q2 divided by the scaling factor b.
If we follow the logic above, the vertical lines of the texture on the sphere will move downward as we move from the middle toward the red dot. In order to get the screenshots posted here, we will have to place P2 so that p1, p and q1 lie on it. However. According to the specification, P2 should be placed independently of p.