Results 1 to 5 of 5

Thread: outline of an object?

  1. #1
    Guest

    outline of an object?

    hi

    please help me out on this:
    1. Is it possible to get the outline of an irregular object in opengl?
    2. Also is it possible to just display part of it?
    3. How do u obtain the corresponding 2d coordinates so that the outline can be plotted out?

    thks.

  2. #2
    Member Contributor
    Join Date
    Feb 2001
    Posts
    89

    Re: outline of an object?

    Get out your mathbook, buddy... you're gonna have to calculate the outline yourself. Don't ask me how though... I don't know and won't know for countless years to come :P
    -pATCheS

  3. #3
    Senior Member Frequent Contributor
    Join Date
    Aug 2000
    Location
    Portsmouth, Hampshire, England
    Posts
    926

    Re: outline of an object?

    There is a simple trick to get all the outlines of the object.

    Simply do a dot product with the view vector, and the normals of the objects. When this value is 0, you have the outline. i.e. the edge of the object. This is where the normals of the poly is exactly 90 degrees to the camera vector.

    Usefull for toon shading that method, but probably very little else..

    Nutty

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Aug 2000
    Location
    Cardiff University
    Posts
    653

    Re: outline of an object?

    Nutty are you sure? Think of a single polygon. All of its edges are the outline. If you rotate it the dot prouct will only be 90 deg when it is 'edge on'. From what I can see. If you are not worried about speed you can render your scene with all poly's say black and the background is white and then check each pixel for it's 4/8 connected neighbours. If there are white pixels then it is a boundary pixel. Or you could render the scene, blur it and then subtract that from the original. Blurring it just increases the size of the image by say a pixel subtracting this from the original will leave the boundary. Look at clip planes for displaying part of it, I think that is what you want. Perhaps there is a better way as these are just image processing algorithms.

  5. #5
    Senior Member Regular Contributor
    Join Date
    Oct 2001
    Location
    Holland
    Posts
    179

    Re: outline of an object?

    Now this is theory for me, I've no experience with it myself, but AFAIK the procedure to generate outlines is as follows:

    - assumption: objects are closed meshes of quads/triangles.

    1. render front-faces of object with depth-testing and depth-writing enabled
    2. disable depth writing (keep depth testing enabled GL_LEQUAL)
    3. set the correct outline color
    4. render back-faces in line mode with a line width > 1

    The outlines should now show.

    Look for the tutorial on cartoon rendering at NeHe (nehe.gamedev.net) for a more in-depth explanation.

    HTH

    Jean-Marc.

Similar Threads

  1. Removing object outline caused by lighting / changing shade color
    By kapitanSurge in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 01-14-2016, 01:03 AM
  2. Outline with GLSL ?
    By artariel in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 06-26-2012, 08:27 AM
  3. Image Outline
    By Tomsi in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 09-27-2011, 03:36 AM
  4. Outline of an object.
    By white skies in forum OpenGL: Advanced Coding
    Replies: 17
    Last Post: 01-01-2006, 11:23 PM
  5. VBO's and outline fonts
    By Vlasko in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-16-2004, 01:33 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