Results 1 to 5 of 5

Thread: Help with rendering hair? Alpha sorting?

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2013
    Posts
    13

    Help with rendering hair? Alpha sorting?

    hairproblem.jpg

    I want to render hair in my program, however the transparency of each hair strand is overlapping the others. I'm not sure on which kind blending/alpha testing technique to use. I currently using:

    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

    but the result I get is above, the hair is 1 mesh containing many triangulated planes with a transparent texture. I've already tried some methods like transparency sorting shown in http://www.opengl.org/wiki/Transparency_Sorting

    and also other parameters for glBlendFunc() didn't seem to yield any desired results.

    How should I go about this?

  2. #2
    Senior Member Regular Contributor
    Join Date
    May 2013
    Posts
    149
    To me it looks like you still have depth test on.

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2013
    Posts
    13
    Quote Originally Posted by Osbios View Post
    To me it looks like you still have depth test on.
    It seemed to do the trick but I have a new problem. Since I have the actual head drawn before the hair and with depth testing ON, the hair will overlap the head since its drawn with depth testing OFF

    hairproblem2.jpg

    The hair will also be drawn over any of the other opaque objects too.

  4. #4
    Senior Member Regular Contributor
    Join Date
    May 2013
    Posts
    149
    In that case you draw the non alpha blending geometry. Then only disable depth writing with glDepthMask and draw the alpha blending geometry.

  5. #5
    Junior Member Newbie
    Join Date
    Jan 2013
    Posts
    13
    awesome thanks

Similar Threads

  1. Alpha translucency with no depth sorting?
    By keelx in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 04-01-2011, 07:25 AM
  2. Alpha Blending and Sorting - 2D
    By AGlass0fMilk in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 03-23-2011, 10:30 PM
  3. hair rendering
    By andreasMank in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 05-20-2004, 10:18 PM
  4. state sorting and multipass rendering
    By zen in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 03-02-2003, 04:19 PM
  5. Alpha Decal sorting problem
    By El Jefe in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 03-12-2002, 12:55 PM

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