Projection and distortion

· by Steve · Read in about 2 min · (214 Words)

I’ve been playing with texture projection and distortion these past couple of days, in preparation for a new water effect. I abstracted a Frustum class out of Camera in order to provide a good way to get a view / projection matrix out for use in texture projection, and that’s worked well - I have a bit of tidying up to do in Camera so I can make it a Frustum subclass, but that can wait for the moment. I unfortunately lost a lot of time trying to get projection working because, as I found to my horror after2 hours picking over my code, the ‘tex2Dproj’ method does not work in ps_1_1. It still compiles, it just fails to divide the s/t texture coordinates by the q. Just changing the profile to ps_2_0 made it work. I could have cried. 😥

I’m now playing with using a 3D perlin noise texture to distort textures so I can combine render-to-texture, texture projection, and noise distortion to make a nice water refraction effect. Take a look at an early shot. After playing with this I realised I needed a more convenient way of updating some program parameters so I could add time-relative parameters directly in the .material script, so I’m extending ControllerValue to do that now.