onsdag 31 maj 2017

Fins

We have now implemented fins which will be the last thing we add to our fur shader before we hand in our project tonight. There is definitely some room for improvement regarding the fins (and other aspects of the fur shader as well) but we are very happy with what we have accomplished in this project. Here is what our fur looks like now:
Fins are often added as a complement to shells in fur rendering. As we have mentioned before, shells are just layers of dots which, from most angles, create the illusion of coherent strands of hairs. Viewed from low angels, however, the separate layers can be seen and this can create some unwanted effects. The fins are therefore drawn around the silhouette of the piglet to cover up those areas. 
As you may see, our fins aren't actually drawn on the entire silhouette. Normally, you would find edges between two faces where one is facing towards the viewer and the other is facing away. However, this requires a way to send not just single triangles to the geometry shader, but also their adjacent neighbors. In order to do this we would have to restructure our model loader extensively but since model loading would be an entire project in itself, we decided not to spend more time on that. Instead, we just find faces with normal vectors that are almost perpendicular to the vector between the face and the viewer, or faces that are viewed almost straight from the side. This works pretty well but it's not a perfect solution.

Just like with the shells, the texture for the fins are completely code generated. We just need a hair density and a base color and we then draw hairs with random positions, random lengths, random color (close to the base color) and random curves. This slight curving is pretty nice because it makes the piglet look a bit fuzzier, especially viewed from a distance. Here is a gif of the pig with fins turned on and off to make the difference more obvious.


Inga kommentarer:

Skicka en kommentar