Spellcaster Studios

Make it happen…

More shadery flow!

Quite happy today with my shader work…

The shader I had worked fine, but it looked terrible adjacent squares that had slightly different vectors:

screen479

It gave the scene some charm, but it wasn’t very pretty looking…

Then I had an idea! Basically, the problem was that the new UV that I used on the animation was computed with something like “uv_new=uv_base+uv_disp*t”. As “t” grew, the more different the vicinity would look, so I decided to clamp t so it didn’t drift too much, like “uv_new=uv_base+uv_disp*fract( t)”. The more attentive amongst you would notice this would create a stuttering (since t is time in seconds, we’d see a pop every second)… Here’s where my idea came alive! By computing two UVs, offset by half a second or so and interpolating between them, I’d hide the popping… It’s there, but you just don’t see it because when it’s time for it to happen, I will be showing the effect of the other displacement, and so on…

This limits the speed of the current, and you can see the error a bit if you pay attention, but it’s almost invisible unless you’re looking for it…

Then I had to play around with the texture until I got a good result, but this is the result:

screen480

And in GIF form:

water_flow

I still need to cleanup the shader and add the code to handle the vertical walls of the voxels and the lakes, but we’re going the right way now!

Going to Brussels tomorrow, so I’ll probably take a “writing day” instead of working on code… Smile

Now listening to “Ultra” by “Depeche Mode”

Comment