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 9 of 9

Thread: Level of detail Question

  1. #1
    Junior Member Regular Contributor
    Join Date
    Feb 2001
    Posts
    136

    Level of detail Question

    Hi,

    I am working on a graphics framwork which includes primitives like cylinders, bends, spheres etc. I want to implement level of detail feature for these primitives so that if in a model(suppose a piping model), if these primitives are near the screen, then they should be rendered with greater details(high number of sides and rings) otherwise they should be displayed with less details (less sides and rings). I tried searching the net but all I could find was LOD for terrain geneation.

    I was thinking of such an algorithm

    - Project the 3D position of the primitive using gluProject and get the z position of the primitive
    - If it is near far clipping plane, decrease the details.

    Is this an efficient way to do this??? if not what other options do I have. Can anyone point me in the right direction???

    Fastian

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,768

    Re: Level of detail Question

    You're talking about implementing LOD for procedurally generated objects.

    I'd just take the distance bewteen the object and the camera and use that value to determine how much detail an object has.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Feb 2001
    Posts
    136

    Re: Level of detail Question

    But I am using simple glRotatef/glTranslatef to move camera not gluLookAt... so do you mean I need to keep track of the cameracoordinates myself. Isn't there a way to extract the current camera coordinates through OpenGL and use them???

    Fastian

  4. #4
    Intern Contributor
    Join Date
    May 2001
    Location
    Cheltenham,Gloucestershire,England
    Posts
    86

    Re: Level of detail Question

    Hi there,

    there's an article by Mark Morley somewhere
    that goes into object culling and has a
    function to return the distance from the
    front clipping plane.

    I cant remeber the link but will post it
    here tonight if you like

    Mark.

  5. #5
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: Level of detail Question


  6. #6
    Junior Member Regular Contributor
    Join Date
    Feb 2001
    Posts
    136

    Re: Level of detail Question

    Thanx for the link. I just read the whole article and it was very informative. My question now is.. Is it faster to extract the frustum and then find the distance from the near and far planes or is it faster to simply GLUproject the point and then calculate the distance. The amount of calculations needed by extracting the frustum seems to be quite a lot while if gluProject calculates the results in hardware(i'm not sure about this either).. then it should be faster...shopuldn't it be???

    Any other approach is also welcome.

    Fastian

  7. #7
    Intern Contributor
    Join Date
    May 2001
    Location
    Cheltenham,Gloucestershire,England
    Posts
    86

    Re: Level of detail Question

    I should use the frustum method as
    you realy need to cull objects as
    well so you kill 2 birds with one stone,
    and as it says it only needs calling once
    per frame (or on camera movement).

    I dont believe glu[Un]Project is HW accelerated
    (could be wrong though),And you would need
    to call this before rendering each object,
    so on scenes with a large amount of objects
    you could end up with more calculations than
    the extract frustum method.

    Cheers

    Mark.

  8. #8
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: Level of detail Question

    The amount of CPU time needed to extract the frustum planes as done in Mark's paper is nothing compared to what is needed to keep a 3D engine going.

    There is no reason for gluProject to use the hardware. It's not much to do, just a few multiplications and additions, and the CPU can do it just as fast as a GPU. And I'm not even counting the time needed to transport the data to the hardware, waiting for the hardware to be ready, and retieve the resul from there. This would slow the operation down even more.

  9. #9
    Junior Member Regular Contributor
    Join Date
    Feb 2001
    Posts
    136

    Re: Level of detail Question

    Thankyou very much for your replies... Its frustum culling algo then for me. I like the idea of killing two birds with one stone....

    Thanks a lot.

    Fastian

Posting Permissions

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