Texture infinite zoom

Hi,

I’m new to shaders and having trouble with one that I’m sure must be quite simple. I want a texture that grows from the center continually, half my problem is I don’t know what to call this, so it’s hard to google it.

Here’s a video of a similar the effect, only difference is I want it to go outwards.

This is what I was trying, but this just zooms out, I expected % to make it loop, but clearly I was wrong

    float4 color = tex2D(TextureSampler, input.TexCoords) * input.Color;
    float2 center = float2(.5, .5);
    Zoom = (AutoZoom * Time);
    float2 deltaCenter = center - input.TexCoords;
    float2 patternCoords = float2((center.x + (deltaCenter.x * Zoom)) % 1, (center.y + (deltaCenter.y * Zoom)) % 1);
    float4 color2 = tex2D(PatternTextureSampler, patternCoords);
    color2 *= color.a;
    color += color2 * Intensity;
    return color;

Any guidance would be greatly appreciated.

This particular effect is a little more complicated than you’re thinking it is. It’s not so much zooming in on the texture over and over, though with some careful texture work it could be done.

What it’s doing is called a tunnel or warp shader. It’s calculating the inside surface of an infinitely long cylinder and mapping a texture to that. The amount of code you need for that isn’t too much, but it is more complicated than just scaling a texture up. :slight_smile:

Oh wow, I wasn’t even close :slight_smile:

Thanks a lot, the code you linked worked out great.