Finally starting to get things moving in the area of effects for the hair. It may not look like much progress but the problem in implementing it was probably due to the early z-test in the graphics pipeline. What seemed to be happening was akin to the problems before Alpha to Coverage(basically a method for multi sampling pixels in terms of depth to get the final blended colour) was introduced and the colours of most back pixels were not being alpha blended into the final result. After looking around and seeing some hints it seemed that even with Alpha to Coverage implemented it remains wise to implement a pre-z pass also to prevent geometry being removed by the early z-test.
Due to the fact that back objects must be drawn they had to be ordered to drawn in a back-to-front order. The sort method selected to use was stl sort as it is unlikely that I could make a faster algorithm given the time in particular. The initial pre z pass was too slow at first, so slow you could see the objects being arranged. This was mainly due to the fact that it was rearranging whole classes which of course are large sections of memory. A slight rethink and rearrange later had the classes being stored as pointers, which then makes rearranging with a compare function handed to stl sort almost as fast as arranging a list of intergers.
No comments:
Post a Comment