nmdist-log

More decals

This weekend I mainly looked at progressing my decal implementation.

Clipping

Last time, I had some difficulty in applying the Sutherland-Hodgman algorithm in 3D. It turns out that my implementation of the algorithm was fine, the bug was in my plane/ray intersection code. I had a silly typo where I used the plane normal where I should have been using the ray direction. After fixing that, I was able to properly clip level geometry to the decal clipping volume: Two decals rendering in c1a0, one of which has the clipping volume visible.

Triangulation and texturing

After that I was able to build triangles from the clipped vertices and project my test decal texture to the triangles: Two textured decals rendering in c1a0, one of which has the clipping volume visible.

Next steps are to start decoding and utilizing the decal textures from Half-Life’s assets. And that’s it for this week!