Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Easy Questioning, Centering a Model Upon Creation.

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2018
    Posts
    5

    Easy Questioning, Centering a Model Upon Creation.

    I wanted to place this post in the general forum but the, "post new thread" button is not visible there right now. I have a world that is made up of triangles, to be able to rotate this world and also a ball model, do I need to center these objects upon creation of the models? Keep it easy please.

    Thanks,

    Josheir

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,542
    If by center them, you mean place the coordinate origin (0,0,0) at or near the object when modeling, then yes, that makes them easier to place in your scene later. However, this is not strictly required.

    If you don't do this, then somehow you've got to communicate to the program later what the origin point of your object is, because it's not (0,0,0).

    For similar reasons, it helps to orient your model in a standard orientation w.r.t. the axes when modeling it.

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2018
    Posts
    5
    I'm new at this. What I mean is that when I create the world object (with for loops) the center of the object must be at its (0,0,0.) Otherwise when I rotate I get some lopsided effect. By communicating later what do you mean exactly? Alter all the points with a for loop, or something? I thought I understood this but I am also confused with "at or near the object." How it would be effective to be closer to a center?

    Thank you,

    Josheir


    "Comprehending what's needed results in the most gain and understanding."
    Last edited by Josheir; 11-03-2018 at 11:02 AM.

  4. #4
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,542
    Quote Originally Posted by Josheir View Post
    I'm new at this. What I mean is that when I create the world object (with for loops) the center of the object must be at its (0,0,0.) Otherwise when I rotate I get some lopsided effect.
    Right. That's exactly what I meant.

    By communicating later what do you mean exactly?
    That is, along with the model, you'd have to provide the special point (e.g. (3,5,10), or whatever) that should be used as the rotation center for the object, if not (0,0,0). The program loading the model could then rotate the object about this point rather than (0,0,0).

    But if you just pre-position the model so that the desired rotation center is (0,0,0), then there's no need to provide this point, or for the program to do anything special when rotating the object.

    I thought I understood this but I am also confused with "at or near the object." How it would be effective to be closer to a center?
    Nothing complicated here. All I meant by "at or near the object" is that you don't have to position the coordinate origin (0,0,0) at the exact center of your object. It might be useful for it to be elsewhere in some cases.

    For instance, suppose you had a model for a 3D pointer. Perhaps you'd want to position it so that the tail of the 3D pointer is at the origin. Then when you load it into a program and rotate it about the origin, its tail stays at the origin and it just points a different direction.

  5. #5
    Newbie Newbie
    Join Date
    Nov 2018
    Posts
    2
    If you have access to the vertices you can go through them all and figure out what the AABB for the model is.
    Then you can calculate the center of the AABB and remove that from all vertices, this will center it on it's extents.

Tags for this Thread

Posting Permissions

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