Page 1 of 3 123 LastLast
Results 1 to 10 of 28

Thread: ? Curved surface - overlay a surface on a sphere ?

  1. #1
    Member Contributor
    Join Date
    Jul 2008
    Posts
    99

    ? Curved surface - overlay a surface on a sphere ?

    Given a 3D earth and a vehicle flying overhead I want to draw the ground coverage zone that the vehicle is currently over. I want to represent this by a filled, colored circle.

    I sort of want this kind of view:



    The above image is not exactly the solution...the colored regions are really 3D cones and not projected on the surface. In my case, I have the latitude/longitude coordinates of the circle on the surface so I can draw the circle representing the boundary but I want to also fill in the circle with some transparent color so it sorts of looks like the image above...does anyone have suggestions?

    Effectively I sort of want to do what glutSolidSphere() does but only for a small section of surface, instead of an entire sphere. The worst case solution would be to figure out a triangulator for a curved surface section and draw the triangles each myself but if anyone has a better solution or suggestion, I'll take it. Thanks.

  2. #2
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: ? Curved surface - overlay a surface on a sphere ?

    I am not sure to understand your problem here... is it that you don't know how to generate yellow or red surfaces and fill them in with a translucent color?

  3. #3
    Member Contributor
    Join Date
    Jul 2008
    Posts
    99

    Re: ? Curved surface - overlay a surface on a sphere ?

    no...I know how to do it, but I need the surfaces to be curved.

    Basically imagine taking an ball and you draw a circle on the ball and fill it in with some color. So you've basically put a thin film of ink on the surface of the ball...I want to do the same with some polygon (right now just a colored circle for which I have the coordinates of the boundary of the circle. The ball is curved and so if I just drew a normal filled in circle, the filled in part would be inside the ball...ie you wouldn't see it, so you have to curve it up to be slightly above the surface of the ball.

    Does that make sense?

  4. #4
    Senior Member Regular Contributor
    Join Date
    Mar 2003
    Location
    Los Angeles
    Posts
    374

    Re: ? Curved surface - overlay a surface on a sphere ?

    What's wrong with the cones? They look good to me.

    A quick and dirty cheat is to make one poly from the circle vertices you already have. The poly will cut through the earth's surface, UNLESS you turn off depth buffering before drawing the filled circle. The problem with this approach is that it won't look right when the circles are on the horizon.

    Otherwise you're going to have to tessellate your original circle (as you mention). It's not that hard. I've done similar things in about 50 lines of code.
    Am I doing your homework for you?

  5. #5
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: ? Curved surface - overlay a surface on a sphere ?

    no...I know how to do it, but I need the surfaces to be curved.
    Ok, so that was what I was asking for. My question must been badly formulated.

    The 1st idea I have is considering a point x on the earth, I assume that x is in the field of view of a satellite if:

    |x - satellite_position| <= Rmax

    Where Rmax, is the satellite range.

    You can express points on the earth in spherical coordinates with the earth center as origin and with a vertical axis toward the satellite. With physicians conventions (theta is colatitude), you have to know the theta_max value from which the point x is out of range:



    You can compute theta_max transforming point x spherical coordinates to cartesian coordinates. Then calculate the difference between x and the satellite position and compare with Rmax.
    This is easy since you have just one unknown variable: theta_max.

    Then you can generate red surface points taking theta values in the range [0 theta_max] and Phi values in the range [0 2Pi] with a custom step for theta and Phi values, depending of how many slices and rings you want.

  6. #6
    Member Contributor
    Join Date
    Jul 2008
    Posts
    99

    Re: ? Curved surface - overlay a surface on a sphere ?

    This is one solution for the "simple" case of a circular projection...I understand it. It requires that I basically do the triangulation (for example, Delaunay Triangulation) of the region (ie slices/rings) and use primitive calls to fill in polygons or triangles as I go...great for a circle case.

    In the case of an irregular shapes it gets harder...for example, say I had the boundaries of the countries and I wanted to fill in the boundary of the united states with the color white then this would be a much tougher solution because I would have to use triangulation to figure out the triangles in the region and then I would have to figure out the radius at the triangle vertices so that they would be properly raised above the sphere boundary.

    Sigh...I think I'm making this harder than is done in real life...I figure the example I just gave (coloring in a country boundary) has been done by others, I can't be the only one trying this.

    Thanks for all of the help.

  7. #7
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: ? Curved surface - overlay a surface on a sphere ?

    If I understand you, you want that the ground coverage area shape fits countries borders?? You are asking to much here and is that useful indeed? Anyway you should explain clearly from the beginning what you want to do, that was not, the idea you exposed in your first post and we would not suggest you solutions that doesn't answer your real problem!

  8. #8
    Member Contributor
    Join Date
    Jul 2008
    Posts
    99

    Re: ? Curved surface - overlay a surface on a sphere ?

    well it sort of was...I was just trying to be as simplistic as possible. I figured it would be easier to understand if I used a circle for the object and I was hoping the attached image explained better than I could in words.

    My ultimate goal is to be able to map a 2D polygon onto a 3D surface. I want to be able to do multiple things with this...first is I want to show the circular ground coverage of a vehicle flying overhead - hence the circle. I would also want to be able to draw a ground station coverage zone that represents what a ground station on the surface can see - given that there are buildings/mountains etc that could obstruct its view - in which case the ground coverage zone would be an irregular circle with cutouts in it and that's not too much different that the irregular shapes of countries.

    In all of these cases I have the coordinates (latitude/longitude) of the boundary - be it the circle boundary or the boundary of some irregular shape. I can draw the boundary that connects these coordinates and I would see the shape but I want to be able to now use a fill inside the region of the boundary. Say a solid or transparent fill - whatever, it doesn't matter as long as I can fill it.

    So the question is how do I fill in this region while making sure that the area is curved so that it touches the surface of the planet and doesn't cut into it....basically, I need to figure out how to curve the area inside the boundary that I have and then use triangulation to calculate the triangles that make up that curve. This solution seems kind of hard and if I have to do this a lot because the vehicle moves or something changed, it seems like this would be very expensive to do repetitive triangulation and drawing of the surface.

    This is supremely easy to do in Java2D - for obvious reasons, but when you go into 3D you have to be able to curve the surface up so that it looks like it is on top of the ground.

    Thanks for taking the time to decipher my messages.

  9. #9
    Member Contributor
    Join Date
    Jul 2008
    Posts
    99

    Re: ? Curved surface - overlay a surface on a sphere ?

    Clearly one option is to draw on the texture that I wrap around the earth, but I have moving vehicles and that would require me changing the texture each time the vehicle moves and that seems very costly do keep doing.

  10. #10
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: ? Curved surface - overlay a surface on a sphere ?

    It seems very complicated to realize this effect building the shape geometry... Maybe it is not applicable in your case but, I suggest you to use an an algorithm similar to shadow mapping combined with a shader that renders every objects on earth and earth itself in the coverage area.
    The idea is, basing on the shadow map, to see what earth/object rendered fragment are visible or not from the satellite. If you are familiar with shadow mapping, you should see what I mean. This way, if you detect that some part of the earth or objects on this one is inside coverage area, you can blend its texture with the area color inside a fragment shader.

Page 1 of 3 123 LastLast

Similar Threads

  1. Curved surface
    By gui24a in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 08-11-2008, 05:19 AM
  2. normals for a curved surface?
    By coda in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 01-11-2004, 11:09 PM
  3. an arrow on a curved surface
    By jyoung77 in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 04-01-2003, 02:43 PM
  4. Texture mapping onto a curved surface
    By abhinav_80 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-06-2002, 09:29 AM
  5. Texture mapping onto a curved surface
    By abhinav_80 in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 08-06-2002, 05:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean