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

Thread: Slicing 3D Model

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2007
    Posts
    1

    Slicing 3D Model


    I am very new to 3D modeling and OpenGL, Actually just looking arround to find out if OpenGL would solve my problem, I am wondering if OpenGL helps to extract 2D slice data (2D image x,y coordinates) from a 3D computer graphical model, originally the 3D model is imported from a standard file format like 3DS, so in any case I need a plugin which helps importing such file and convert it to OpenGL data srtucture,

    Most importantly, does OpenGL data structure encapsulate x,y,z coordinates, is it possible to extract x,y values at certain cut offs of z for example,

    If not do you suggest any other tools in C++ which helps to achieve that,

    Please advise,

    Hala

  2. #2
    Senior Member OpenGL Pro k_szczech's Avatar
    Join Date
    Feb 2006
    Location
    Poland
    Posts
    1,119

    Re: Slicing 3D Model

    Looks like you're not looking for an API (like OpenGL) - you're looking for an algorithm.

    You can do it in different ways:

    1. Implement on CPU
    You don't use OpenGL nor any other library here.

    2. Using OpenGL's feedback mode
    I do not recommend it - #1 is easier to implement and will work faster.

    3. Using modern GPU's features with OpenGL
    Recommended for advanced programmers. This is more less #1, but implemented on GPU instead of CPU. Will work very fast.

    So, I guess you're interested in #1. It's pretty simple.
    For every polygon in the original 3D model you have 3 possible cases:
    1. polygon is entirely in front of slice plane - ignore this polygon
    2. polygon is entirely behind slice plane - ignore this polygon
    3. polygon is partially in front of slice plane

    In case #3 you look at polygon's edges:
    1. edge is entirely in front of slice plane - ignore this edge
    2. edge is entirely behind slice plane - ignore this edge
    3. edge crosses the slice plane - find exact point of collision

    You should find 2 points for each polygon. These 2 points define an edge of your 2D model.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Jul 2003
    Location
    Bangalore, Karnataka, India
    Posts
    123

    Re: Slicing 3D Model



    How about dividing 3D Model using a uniform 3D grid (each grid element stored similar to a voxel).and then compute the intersection. Intersected points in one iterations can be taken as a slice.

Posting Permissions

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