|
From: Samuel C. <sam...@gm...> - 2020-09-04 16:51:08
|
On Thu, 03 Sep 2020 19:40:37 +0200 Sascha Reißner <rei...@no...> wrote: > Am Donnerstag, den 03.09.2020, 18:49 +0200 schrieb Samuel CUELLA: > > On Thu, 03 Sep 2020 17:53:07 +0200 > > Sascha Reißner <rei...@no...> wrote: > > > All vertecies are *relative* to the center of the bounding sphere. > > > So the *absolute* coordinate of a vertex is the center of the > > > bounding > > > sphere plus the vertex coordinate. > > Yep, that's what I have. > > Okay, thats what i want to make sure. > > > > Your first movie looks not only like shaking, if you look at the > > > white > > > marking lines it looks more as the vertecies of the mesh are > > > jumping > > > around. Maybe a precition problem? > > > > Here is another video: https://vimeo.com/454441049. The "shaking" > > only > > occurs when I'm close of the mesh and I when I change the values of > > roll or pitch. > > Here also, if i look close to the white line straight the runway edge, > its bending. It look like the vertex beside the line is jumping > left/right and bend the texture. Ok, so there is another problem. Might be caused by the float/double as answered by James. > > > My main problem is: I can load the mesh and render it. I can move > > it using rotations and translations on OpenGL axis X,Y,Z by binding > > these > > movements to keys on the keyboard. Everything gets fun beyond this. > > > > Now how could I render a terrain tile like if I was flying over it > > at say the center, a given altitude with 0 roll (parallel to the > > earth), 0 > > pitch (parallel to the earth) and heading north ? I couldn't find > > how FlightGear is doing it. > > You must calculate the local coordinate system of that location where > X (pointing east) and Y (pointing north) build the horizontal plane > and Z is vertical (straight up in the sky). > > > The code I have to translate lat,lon alt to X,Y,Z (ECEF) seems to > > work > > (I get the right tile) but then I'm struggling with how position the > > "camera" to render the tile as if I was flying as said earlier. > > > That means your code give you the correct location. > But you need also the correct orientation. > Because your code is also C, have a look at > > https://github.com/reiszner/btgchk > > I stalled my developement of btgchk, but the code calculate: > - X/Y/Z to lat/lon/msl > - lat/lon/msl to X/Y/Z location That's a very nice piece of code. I wish I had known that existed before I started up I would have saved some time. Nevertheless thank you for that I'll see if I can make use of it. > > I dont know if it calculate also the local orientation, but thats not > difficult to do. I remember some matrix calculation in the code, so i > have played with rotated coordinate systems. > I couldn't find it yet. I used a PDF document that explained the math to go from a cartesian ECEF to local NED (North East Down) vectors which gave me some results but not perfect. I'm going to try (again) reproducing exactly what FlightGear is doing by "porting" SGQuat to C. |