View Single Post
Old 17th March 2013, 10:08   #14
Flexi
wellspring of milk
Major Dude
 
Flexi's Avatar
 
Join Date: Apr 2007
Location: 54.089866,12.11168,18.75
Posts: 2,058
Send a message via ICQ to Flexi
code:
float2 uv1= uv;
uv1 += GetBlur2(uv.x)+.1*treb;


when you do something like this in the shaders, you must know that GetBlur and GetPixel return a three-component vector: the rgb value at the location uv. uv is a two-component vector for the normalized xy position in a texture, aka "screen space" or "domain map". By the statement above you increment xy by rg, b won't be used. Adding another constant or float value like that at the end, implicitly expands it to a two-component value with the same value for x and y. By the same way, you're also only using the diagonal through blur2: an equivalent statement would have been GetBlur2(uv.xx). you can address the components in a custom order and combination too, xyz and rgb mean the same thing.

In general, if you modify the uv vector, this is called a plane deformation operation. In the simplest case this is a scaling or shift. Rotation is a bit trickier. But if you once got the hang of it, you can even use the gradients in the texture for inflation/deflation effects.

Nice first tries! i hope this helps you further anyhow.

have fun!
Flexi is offline   Reply With Quote