Texture Mapping extension

RE: Texture Mapping extension
#91
(2018-01-28, 0:29)Leonardo Zide Wrote: Basically I project the vertex into p1 and get the atan of that point for u, and then for v it's the angle of the triangle where the opposite side is the distance to plane 1 and the hypotenuse is the distance to the center.

This approach works well except at the north/south poles and at the back where the 2 sides of the projection meet (u jumps from 0 to 1). I only have the vertex positions when I calculate the UVs, I need to change how I do things so that I have triangles instead of points and then these problems will be trivial to fix. Did you run into similar problems?

I do something similar indeed but when the angle results in 0.0 (uv 0 or 1) i look at the previous and next vertices in the mesh to decide on 0 or 1, this is not fool proof because the positional soup of LDraw doesn't guaranteed them o be close by.

But in case of the sphere it works very well. I think in practice part authors should avoid such situations by splitting the texture into two.

Having triangle info on the mapping level would indeed solve it, but like  you I'm working directly on the OpenGL float vector array. I do have the triangle information in the smoothing stage of preparations, but it's a bit messy to preserve that data into this stage. Something to consider for 2.0 I guess

edit: With "longitude and latitude" I meant rotating one of the reference planes along with the angle found on the other before finding an angle on that one.
Code:
```TGLVector3d curDir(false), baseDir(false), curNor(false), altRestDir(false);   double baseAngle;   for (int i=0; i<pntCnt; i++)   {     TGLVector2f &tc=uv[i];     if (doStrict)     {       //Spec methode, geeft problemen by >180       tc.u=calcTexCoord(dPnts, pntCnt, i, horAngle, horNor, restDir, curDir, NULL, baseAngle);       tc.v=calcTexCoord(dPnts, pntCnt, i, verAngle, verNor, restDir, curDir, NULL, baseAngle);     }     else     {       if (verAngle<=M_PI)       {         //horizontaal dominant         tc.u=calcTexCoord(dPnts, pntCnt, i, horAngle, horNor, restDir, altRestDir, &baseDir, baseAngle);         curNor.loadFromCross(horNor, altRestDir);         tc.v=calcTexCoord(dPnts, pntCnt, i, verAngle, curNor, altRestDir, curDir, NULL, baseAngle);       }       else       {         //verticaal dominant         tc.v=calcTexCoord(dPnts, pntCnt, i, verAngle, verNor, restDir, altRestDir, &baseDir, baseAngle);         curNor.loadFromCross(altRestDir, verNor);         tc.u=calcTexCoord(dPnts, pntCnt, i, horAngle, curNor, altRestDir, curDir, NULL, baseAngle);       }     }   }```
« Next Oldest | Next Newest »

 Messages In This Thread Texture Mapping extension - by Orion Pobursky - 2012-04-08, 4:42 Re: Texture Mapping extension - by Travis Cobbs - 2012-04-08, 6:17 Re: Texture Mapping extension - Additional questions - by Nils Schmidt - 2012-04-08, 11:00 Re: Texture Mapping extension - Additional questions - by Roland Melkert - 2012-04-08, 17:45 Re: Texture Mapping extension - Additional questions - by Joshua Delahunty - 2012-04-14, 5:42 Re: Texture Mapping extension - Additional questions - by Travis Cobbs - 2012-04-08, 18:35 Re: Texture Mapping extension - by Orion Pobursky - 2012-04-08, 18:06 Re: Texture Mapping extension - by Allen Smith - 2012-04-08, 23:05 Re: Texture Mapping extension - by Travis Cobbs - 2012-04-08, 23:52 Re: Texture Mapping extension - by Joshua Delahunty - 2012-04-14, 5:50 Re: Texture Mapping extension - by Roland Melkert - 2012-04-09, 17:16 Re: Texture Mapping extension - by Orion Pobursky - 2012-04-09, 17:42 Re: Texture Mapping extension - by Travis Cobbs - 2012-04-10, 1:19 Re: Texture Mapping extension - by Joshua Delahunty - 2012-04-11, 2:49 Re: Texture Mapping extension - by Roland Melkert - 2012-04-12, 19:54 Re: Texture Mapping extension - by Orion Pobursky - 2012-04-12, 21:38 Re: Texture Mapping extension - by Allen Smith - 2012-04-12, 22:37 Re: Texture Mapping extension - by Joshua Delahunty - 2012-04-13, 5:01 Re: Texture Mapping extension - by Travis Cobbs - 2012-04-13, 5:37 Re: Texture Mapping extension - by Travis Cobbs - 2012-04-13, 0:00 Re: Texture Mapping extension - by Orion Pobursky - 2012-04-13, 3:32 Re: Texture Mapping extension - by Roland Melkert - 2012-04-13, 17:07 Re: Texture Mapping extension - by Joshua Delahunty - 2012-04-13, 17:35 Re: Texture Mapping extension - by Orion Pobursky - 2012-04-13, 23:56 Re: Texture Mapping extension - by Willy Tschager - 2012-04-14, 11:22 Re: Texture Mapping extension - by Joshua Delahunty - 2012-04-14, 6:06 Re: Texture Mapping extension - by Tim Gould - 2012-04-14, 7:25 Re: Texture Mapping extension - by Travis Cobbs - 2012-04-14, 21:12 Re: Texture Mapping extension - by Tim Gould - 2012-04-14, 22:08 Re: Texture Mapping extension - by Joshua Delahunty - 2012-04-15, 1:47 Re: Texture Mapping extension - by Joshua Delahunty - 2012-04-18, 2:23 Re: Texture Mapping extension - by Roland Melkert - 2012-04-18, 16:33 Re: Texture Mapping extension - by Joshua Delahunty - 2012-04-18, 20:02 Re: Texture Mapping extension - by Orion Pobursky - 2012-04-21, 14:00 Re: Texture Mapping extension - by Joshua Delahunty - 2012-04-21, 20:16 Re: Texture Mapping extension - by Travis Cobbs - 2012-04-21, 21:47 Re: Texture Mapping extension - by Allen Smith - 2012-04-22, 0:30 Re: Texture Mapping extension - by Joshua Delahunty - 2012-04-22, 1:13 Re: Texture Mapping extension - by Allen Smith - 2012-04-22, 1:43 Re: Texture Mapping extension - by Joshua Delahunty - 2012-10-26, 20:27 Re: Texture Mapping extension - by Joshua Delahunty - 2012-05-23, 4:31 Re: Texture Mapping extension - by Daniel Goerner - 2012-05-23, 6:50 Re: Texture Mapping extension - by Joshua Delahunty - 2012-05-23, 19:32 Re: Texture Mapping extension - by Alex Taylor - 2012-10-23, 17:33 Re: Texture Mapping extension - by Alex Taylor - 2012-10-25, 19:47 Re: Texture Mapping extension - by Allen Smith - 2012-10-25, 21:22 Re: Texture Mapping extension - by Alex Taylor - 2012-10-25, 21:44 Re: Texture Mapping extension - by Allen Smith - 2012-10-26, 2:19 Re: Texture Mapping extension - by Alex Taylor - 2012-10-26, 8:09 Re: Texture Mapping extension - by Travis Cobbs - 2012-10-26, 19:34 Re: Texture Mapping extension - by Alex Taylor - 2012-10-25, 21:58 Re: Texture Mapping extension - by Allen Smith - 2012-10-25, 23:07 Re: Texture Mapping extension - by Alex Taylor - 2012-10-26, 8:05 Re: Texture Mapping extension - by Travis Cobbs - 2012-10-26, 19:31 Re: Texture Mapping extension - by Alex Taylor - 2012-10-26, 19:37 Re: Texture Mapping extension - by Joshua Delahunty - 2012-10-26, 20:12 Re: Texture Mapping extension - by Joshua Delahunty - 2012-05-23, 19:43 Re: Texture Mapping extension - by Daniel Goerner - 2012-05-23, 22:00 Re: Texture Mapping extension - by Travis Cobbs - 2012-05-23, 22:29 Re: Texture Mapping extension - by Joshua Delahunty - 2012-05-24, 4:51 Re: Texture Mapping extension - by Daniel Goerner - 2012-05-01, 9:54 Re: Texture Mapping extension - by Roland Melkert - 2012-05-01, 16:01 Re: Texture Mapping extension - by Daniel Goerner - 2012-05-01, 17:19 Re: Texture Mapping extension - by Roland Melkert - 2012-05-01, 17:24 Re: Texture Mapping extension - by Joshua Delahunty - 2012-05-05, 21:55 Re: Texture Mapping extension - by Orion Pobursky - 2012-05-05, 23:43 Re: Texture Mapping extension - by Travis Cobbs - 2012-05-06, 2:41 Re: Texture Mapping extension - by Tim Gould - 2012-05-07, 5:44 Re: Texture Mapping extension - by Joshua Delahunty - 2012-05-07, 16:23 Re: Texture Mapping extension - by Roland Melkert - 2012-05-07, 17:05 Re: Texture Mapping extension - by Joshua Delahunty - 2012-05-06, 5:26 Re: Texture Mapping extension - by Philippe Hurbain - 2012-05-06, 6:04 Re: Texture Mapping extension - by Orion Pobursky - 2012-05-06, 17:38 Re: Texture Mapping extension - by Willy Tschager - 2012-10-30, 14:09 Re: Texture Mapping extension - by Alex Taylor - 2012-11-10, 18:58 Re: Texture Mapping extension - by Travis Cobbs - 2012-11-12, 18:30 Re: Texture Mapping extension - by Alex Taylor - 2012-11-12, 18:42 Re: Texture Mapping extension - by Philippe Hurbain - 2012-11-15, 9:02 Re: Texture Mapping extension - by Roland Melkert - 2012-11-15, 18:00 Re: Texture Mapping extension - by Philippe Hurbain - 2012-11-15, 18:45 Re: Texture Mapping extension - by Tim Gould - 2012-11-15, 22:51 RE: Texture Mapping extension - by Leonardo Zide - 2018-01-26, 20:23 RE: Texture Mapping extension - by Roland Melkert - 2018-01-26, 21:20 RE: Texture Mapping extension - by Roland Melkert - 2018-01-26, 21:39 RE: Texture Mapping extension - by Leonardo Zide - 2018-01-28, 0:29 RE: Texture Mapping extension - by Roland Melkert - 2018-01-28, 19:13 RE: Texture Mapping extension - by Leonardo Zide - 2018-01-29, 20:01 RE: Texture Mapping extension - by Joshua Delahunty - 2018-01-26, 22:09 Re: Texture Mapping extension - by Philippe Hurbain - 2012-11-30, 9:13 Re: Texture Mapping extension - by Roland Melkert - 2012-11-30, 17:44 Re: Texture Mapping extension - by Philippe Hurbain - 2012-11-30, 18:02 Re: Texture Mapping extension - by Tim Gould - 2012-11-30, 21:55 RE: Texture Mapping extension - by Michael Horvath - 2018-01-30, 1:54 RE: Texture Mapping extension - by Orion Pobursky - 2018-01-30, 2:34 RE: Texture Mapping extension - by Roland Melkert - 2018-01-30, 19:06

Forum Jump:

Users browsing this thread: 1 Guest(s)