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: Help with rendering hair? Alpha sorting?

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

    Help with rendering hair? Alpha sorting?

    Click image for larger version. 

Name:	hairproblem.jpg 
Views:	146 
Size:	80.9 KB 
ID:	1185

    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
    Intern Newbie
    Join Date
    May 2013
    Posts
    42
    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

    Click image for larger version. 

Name:	hairproblem2.jpg 
Views:	52 
Size:	57.9 KB 
ID:	1186

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

  4. #4
    Intern Newbie
    Join Date
    May 2013
    Posts
    42
    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

Posting Permissions

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