Sunday, July 24, 2016

Day 69: Swirly

Aha! So it is possible to switch between shaders on the fly! After redoing a bit of code to allow pixel shader re-compilation, I managed to be able to switch between shaders by the hit of a key.

As for more shader research, I managed to figure out a neat swirling effect. If one takes the percent that the texture is from a set radius (within, for example), turns it into an angle and computes a new texture coordinate based on the dot product of the texture coordinate and the sine and cosine of the that angle, one gets a swirling effect:


The tricky part about this shader research is figuring out what takes no real parameters in the calculation; it would be tricky to add other textures and parameters without using them in the other shader functions.

No comments:

Post a Comment