GLSL shader with a seamless texture

rybotron's picture

Is there a way to create a GLSL shader that would texture a mesh with a seamless texture. Not a picture that has been made to be seamless, rather taking an image an unfolding it over the mesh so each edge mirrors on all 4 sides each time it is iterated.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

toneburst's picture
Re: GLSL shader with a seamless texture

There are a number of ways of making seamless textures. The simplest method is simply to mirror the input image on both X and Y axes. There are a number of ways this can be achieved. I did a nice little macro do achieve this in different ways (though I've just thought of a new method I need to add to it, so maybe I'll do that, and upload the updated version here).

A more complex method, without mirroring involves overlaying a vignetted portion from the top of the image onto the bottom, and then doing a similar thing with a strip from the left hand side of the image overlaid on the right, then cropping the result.

I don't have an example to hand of this second method, unfortunately. You could achieve the effect with masks and carefully-placed billboards, or (my preference) using a Core Image Filter patch and some judicious coding. Sadly, I don't have time to knock together an example at the moment :(

a|x

usefuldesign.au's picture
Re: GLSL shader with a seamless texture

toneburst wrote:
A more complex method, without mirroring involves overlaying a vignetted portion from the top of the image onto the bottom, and then doing a similar thing with a strip from the left hand side of the image overlaid on the right, then cropping the result.

This method is spelled out in lots of Adobe Illustrator tutorials online and in user guides for making custom patterns if somebody wants it spelled out more slowly. Have to translate to QC context, obviously.

rybotron's picture
Re: GLSL shader with a seamless texture

Thanks toneburst. I'd love to see your example if you have time to post it up. I'm still pretty new to GLSL so I'll take all the help I can get. I did build a multi-billboard/vignetted version but not totally happy with the results. Also worried about performance with doing it that way versus a shader. Mainly want to use rendered movies as the texture so the unfolding method would probably be best.

gtoledo3's picture
Re: GLSL shader with a seamless texture

Maybe you could use some kind of mirror/kaleidoscope/tiling filter to help the process, instead of having to use a render in image.

Also, if you are already using render in image, maybe it might be worthwhile to experiment with multiple Kineme GL Quads, and tweak the U/V values... then you can do your image flips, and warping if desired, which might be cool if you're putting the texture around non-square shapes.

toneburst's picture
Re: GLSL shader with a seamless texture

Re the vignette method, I'm thinking this might be better achieved with a multi-pass Core Image Filter setup, rather than a single GLSL shader, as a single shader might get quiet complicated.

a|x