I am translating a hemisphere into Open Glow 3.2 (Java Y / LWJGL3).
Algorithms already working to generate a spherical magnitude (with GL_TRIANGLE_STRIP primitive) However, I do not know how the texture coordinates & amp; Normal for these headings.
Float angle, angel; Float cos, sin; Float R1, R2; Float H1, H2; For (angela = -90.0 f; angle A & lt; 90.0 f; anga + = SPHERE_STEP) {R1 = (float) mathos (angle * math.pi / 180.0); R2 = (float) Math.cos ((angle + + SPHERE_STEP) * Math.PI / 180.0); H1 = (float) Math.sin (angle * meth .pi / 180.0); H2 = (float) math. ((Angle + SPHERE_STEP) * Math.PI / 180.0); For (Angelbe = 0.0f; angelby & lt; = 360.0 f; angleb + = SPHERE_STEP) {cos = (float) mathos (angle b * monastery. Pi / 180.0); Sin = - (float) math sin (angle b * monastery. Pi / 180.0); Renderer.addVertex (r2 * cos, h2, r2 * sin, s1, t1, n1x, n1y, n1z); Renderer.addVertex (r1 * cos, h1, r1 * sin, s2, t2, n2x, n2y, n2z); }}
My problem is that the texture is unknown along with the coordination of S1, S2, T1 and T2, and Normal N1X, N1A, N2 G, N2X, N2N, N2 SG (in two advertex lines). I do not know what kind of texture I should use - I just want a ball (like a marble or soccer ball). The folving image shows that the way the pigments are produced (I do not have 10 reputation ...):
Is anyone's idea? If your proposal is completely different, it also includes a new algorithm, but texture coordinates & amp; Normal, this is absolutely right!
You can calculate the normal given head as normal. Therefore, if your vertical is located at:
vec3 (r2 * cos, h2, r2 * sin) // and vec3 (r1 * cos, h1, r1 * sin)
... then this would be normal:
normal (vec3 (r2 * cos, h2, r2 * sin) / and normal (vec3 (R1 * cos) , H1, r1 * sin))
They get out of the field at each given point.
Texting, however, is slightly more difficult. I would suggest reading to understand this:
U = ((-Z / | X |) + 1) / 2V = ((-Y / | X |) + 1) / 2
No comments:
Post a Comment