[Solved] Scale from middle shader


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.

So this is the pattern and I want this to look like it continually sprouts new copies from the middle… I hope I’m making sense.

Here’s what I have so far

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

This results in this very bad stretch

Any guidance would be very much appresiated.



MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
AddressU = clamp;
AddressV = clamp;

    for(int i=0;i<10;i++)
	float2 scale = (0.2)*i;
	re += tex2D(TextureSampler, input.Coord*(1 + scale) - scale/2);

if not then just ignore…

1 Like

Thanks for giving a try, unfortunately that’s not it, im sad im bad at explaining it :frowning: BUT I just captured from a game that does it

So it’s just the uvs of the texture collapsing towards the center and looping, in my case I want it to go outwards, but same principle.

It was called a tunnel effect!

1 Like