Texture Mapping extension

RE: Texture Mapping extension
#90
(2018-01-26, 21:39)Roland Melkert Wrote: I'm very interested in the way you are planning to implement it, In LDCad I decided to use a slightly different approach then the one described in the spec as  it helps with full spheres and doesn't seem to affect other usage (much) visually wise.

Thanks for the test mpd and for explaining the conventions you're using. I hope we can convince Joshua to clarify the spec but if we don't, at least our apps will be consistent.

I also tried following what the spec suggests but I don't think the value of v can be calculated that way. This is what I used, it's probably similar to what you mean by longitude and latitude:

Code:
```lcVector3 VertexDir = Position - Center;              float DotPlane1 = lcDot(lcVector4(Position, 1.0f), Plane1); lcVector3 PointInPlane1 = Position - lcVector3(Plane1) * DotPlane1; float DotFrontPlane = lcDot(lcVector4(PointInPlane1, 1.0f), FrontPlane); float DotPlane2 = lcDot(lcVector4(PointInPlane1, 1.0f), Plane2); float Angle1 = atan2f(DotPlane2, DotFrontPlane) / LC_PI * TextureMap->Angle1; TexCoord.x = 0.5f + 0.5f * Angle1; float Angle2 = asinf(DotPlane1 / lcLength(VertexDir)) / LC_PI * TextureMap->Angle2; TexCoord.y = 0.5f - Angle2;```

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?
« 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)