Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Questions about spheres

  1. #1

    Questions about spheres

    Hi everyone

    I am proud to say that i have implemented a sphere creation method in my engine, because i found it hard to set up the index/vertex data for a sphere.
    But this mission is accomplished

    Now.. i have to questions:

    A Sphere creation method normaly has 6 parameters.
    The x,y,z coords for the center of the sphere. Of course the radius and two segment parameters.
    The problem is, that i dont know how to call these last segment parameters. One represents the ammount of horizontal discs in which a sphere can be divided, and one repersents the ammount of segments around the sphere (like pieces of pie).
    What are the common english names for these parameters??

    Now i am looking for a few ways to generate the texture coordinates for a sphere. I have made a simple algorithm wich works OK with even numbers
    but not with odds.
    So does anyone know some good sphere texture mapping routines/algorithms??

    Thanx in advance.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  2. #2

    Questions about spheres

    The problem is, that i dont know how to call these last segment parameters
    I call them sections and slices. Segments are the horizontal rings and slices vertical pieces. You can always look into any 3D modeler and check
    how it calls them.
    So does anyone know some good sphere texture mapping routines/algorithms??
    Take a look here: http://www.codesampler.com/oglsrc/og...extured_sphere

  3. #3

    Questions about spheres

    There are only 10 types of people in this world; those who understand binary and those who don't.

  4. #4

    Questions about spheres

    gluSphere
    :cyclops:

    But I would rather understand the nuts and bolts of the process: constructing the sphere and then texture mapping it. This is the best online article that I have found on the subject. Explore the rest of that guy's site, too, for more 3D algorithms and techniques. A similar site is here.
    [size=10px]"In science one tries to tell people, in such a way as to be understood by everyone, something that no one ever knew before. But in poetry, it's the exact opposite." -- Paul Dirac[/size]

  5. #5

    Questions about spheres

    @grudzio: Thank you for the parameter names.
    I also like that website very much. :razz:

    @Clootie:
    I will not use D3DXCreateSphere in my engine because i make my own primitive/mesh classes.
    I know it's a lot of work, but i am learning very much by doing that myself.

    @Cragwolf:
    Glusphere is not an option because i am using D3D.
    However, the texture-mapping algorithm in that article is quiet good. It will take some time though to implement it because of the differences between the ways of sphere creation.

    Thank you all for your replies.. i will post in this thread when i encounter any problems with sphere texture mapping. If anyone knows other ways to map a texture to a sphere, please post it.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  6. #6

    Questions about spheres

    An additional question on the topic: anyone knows how to create a 3dsMax-like geosphere? That is, a sphere with vertices and faces distributed equally and not squashed at both poles? Seems like a more efficient representation of a sphere with less vertex count and rounder look.

    Look on the following screenshot, both spheres look more or less equally round, but sphere has 482 veritces and 960 faces (x2 tris?), while geosphere on the right has 252 vertices and 500 faces (x1 tris?). Besides, it seems easier to control the LOD of geosphere than the standard sphere. The question is, how to create vertices and triangles for geosphere?


  7. #7

    Questions about spheres

    I looked up Geospheres a while ago, and from what I remember, there was a massive amount of math involved to calculate the positions for all the vertexes!

    But dont quote me on that, my maths skills werent great in those days...
    My site: DelphiTuts.com (coming soon)...

    Download Font Studio 4.21 here.

  8. #8

    Questions about spheres

    Oh right.. while creating the sphere code, i was also thinking of the geosphere. But making a normal sphere was very hard, so i dont know have a clue how to make a geosphere. I am sure it needs tons of math only to generate the vertices. :cry:
    However its a good way to improve performance, so i like to know how to create them. :razz:

    If anyone can give me a link to a page wich handles geospheres, i would be happy.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  9. #9

    Questions about spheres

    This is how I would make a geosphere.

    Code:
    Start with an octahedron (a regular solid with eight triangular faces)
    
    for number of subdivisions do
    
      for each face do
        insert new vertices in the middle in each edge of current face
        create triangle from new vertices. This way face is subdivided in
        four new faces.
        move new vertices outwards so they are on the sphere
      end
    
    end
    It should not be very difficult to implement. The problem I see is that faces can share edges so it should be checked if the edge was already divided.
    Another problem is the texture mapping. I dont know if methods for "normal" sphere will work for geosphere.

  10. #10

    Questions about spheres

    Generating texture coordinates for a octahedron sounds trivial. For each step you would probably just interpolate the texture coordinates based on half the distance to each neighboring vertex?
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •