View Full Version : Help with rendering hair? Alpha sorting?

11-21-2013, 07:30 PM

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:


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?

11-22-2013, 11:44 AM
To me it looks like you still have depth test on.

11-22-2013, 02:35 PM
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


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

11-22-2013, 03:05 PM
In that case you draw the non alpha blending geometry. Then only disable depth writing with glDepthMask and draw the alpha blending geometry.

11-24-2013, 07:04 PM
awesome thanks