Page 1 of 1

Mirror/Tile option in Translate/Rotate Modules

Posted: Sun May 13, 2018 1:35 am
by vedev
Would be a great help, thank you!

Re: Mirror/Tile option in Translate/Rotate Modules

Posted: Sun May 13, 2018 4:09 pm
by Sadler
For mirror try Kaleidoscope. For tile try array. For reasons as to why it's not a particularly great idea to have them included in the transform modules themselves, consider the order of transforms (e.g rotate before or after a mirror/tile). They're different and both useful.

For many more tile/mirror options look at the IFS modules included. You could edit all of these to include transforms but would you want to?

Re: Mirror/Tile option in Translate/Rotate Modules

Posted: Mon May 14, 2018 7:03 pm
by vedev
Sadler wrote:For mirror try Kaleidoscope. For tile try array. For reasons as to why it's not a particularly great idea to have them included in the transform modules themselves, consider the order of transforms (e.g rotate before or after a mirror/tile). They're different and both useful.

For many more tile/mirror options look at the IFS modules included. You could edit all of these to include transforms but would you want to?
Thanks for the reply! Kaleidoscope and Array don't accomplish the effect that is desired. I should have been more specific about the feature.

Basically, I'm trying to find a way to have the full resolution input tiled in a mirror or repeating pattern with the ability to rotate and shift x or y infinitely.

The module Quad Tile is very close to accomplishing this except that it crops the input into a square and lowers the resolution of the input.

I've been trying to find a way to fix that in the shader but my knowledge of shaders has far to go.

Code: Select all

/*{
	"CREDIT": "by VIDVOX",
	"CATEGORIES": [
		"Tile Effect"
	],
	"INPUTS": [
		{
			"NAME": "inputImage",
			"TYPE": "image"
		},
		{
			"NAME": "size",
			"TYPE": "float",
			"MIN": 0.0,
			"MAX": 4.0,
			"DEFAULT": 0.5
		},
		{
			"NAME": "rotation",
			"TYPE": "float",
			"MIN": 0.0,
			"MAX": 1.0,
			"DEFAULT": 0.0
		},
		{
			"NAME": "angle",
			"TYPE": "float",
			"MIN": 0.0,
			"MAX": 1.0,
			"DEFAULT": 0.0
		},
		{
			"NAME": "slide1",
			"TYPE": "point2D",
			"DEFAULT": [
				0.0,
				0.0
			]
		},
		{
			"NAME": "slide2",
			"TYPE": "point2D",
			"DEFAULT": [
				0.0,
				0.0
			]
		},
		{
			"NAME": "shift",
			"TYPE": "point2D",
			"DEFAULT": [
				0.0,
				0.0
			]
		}
	]
}*/


const float tau = 6.28318530718;


vec2 pattern() {
	float s = sin(tau * rotation);
	float c = cos(tau * rotation);
	vec2 tex = vv_FragNormCoord * RENDERSIZE;
	float scale = 1.0 / max(size,0.001);
	vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale ;
	point = (point - shift) / RENDERSIZE;
	//	do this to repeat
	point = mod(point,1.0);
	if (point.x < 0.5)	{
		point.y = mod(point.y + slide1.y/RENDERSIZE.y, 1.0);
	}
	else	{
		point.y = mod(point.y + slide2.y/RENDERSIZE.y, 1.0);
	}
	if (point.y < 0.5)	{
		point.x = mod(point.x + slide1.x/RENDERSIZE.x, 1.0);
	}
	else	{
		point.x = mod(point.x + slide2.x/RENDERSIZE.x, 1.0);
	}
	//	do this for relections
	point = 1.0-abs(1.0-2.0*point);
	
	//	Now let's do a squish based on angle
	//	convert to polar coordinates
	vec2 center = vec2(0.5,0.5);
	float r = distance(center, point);
	float a = atan ((point.y-center.y),(point.x-center.x));
	
	s = sin(a + tau * angle);
	c = cos(a + tau * angle);
	
	float zoom = RENDERSIZE.x / RENDERSIZE.y;
	
	point.x = (r * c)/zoom + 0.5;
	point.y = (r * s)/zoom + 0.5;
	
	return point;
}


void main() {

	vec2 pat = pattern();

	gl_FragColor = IMG_NORM_PIXEL(inputImage,pat);
}

Re: Mirror/Tile option in Translate/Rotate Modules

Posted: Wed May 16, 2018 6:53 pm
by Sadler
Perhaps you could make a mock-up image of what you're after?

Re: Mirror/Tile option in Translate/Rotate Modules

Posted: Thu May 17, 2018 12:36 am
by vedev
Hehehe, thanks for the reply but I'm not sure if a shot of a tile of images would help convey the idea. :)

All I'm saying is that it'd be nice to have a module that could tile, mirror tile, shift, zoom, and rotate at full resolution.

I'm new to the forums so I apologize if the way I made the request was crappy in any way.

Re: Mirror/Tile option in Translate/Rotate Modules

Posted: Thu May 17, 2018 9:12 am
by Sadler
Yeah, words fail sometimes so it is useful to be able to post video in the forum - that's often the best way to demonstrate what you want to achieve.