Help with rendering hair? Alpha sorting?


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

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

How should I go about this?

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.

In that case you draw the non alpha blending geometry. Then only disable depth writing with glDepthMask and draw the alpha blending geometry.

awesome thanks