Remapping

Remapping is simple and powerful and there’s one aspect of it quite a few people may not have noticed yet.

A remap image looks something like this:

remap

and the GLSL code to remap (aka the Remap TOP in TouchDesigner) looks something like this:

vec4 remap = texture(sTD2DInputs[1], vUV.st);
vec4 image = texture(sTD2DInputs[0], vec2(remap));
fragColor = image;

What does the above code do? It takes two texture inputs and uses the second textures red and green colour channels as the uv coordinates for the first texture. It’s commonly used by people who use the stoner component as it means they can do their mapping using the stoners render pipeline and then simply remove the whole mapping tool from the system leaving only the remap texture in place.

Whats very useful about the stoner is that inside its render Geometry COMP it actually gives us another GLSL MAT which simply renders out a 3d objects UV coordinates into red and green colour channels. In the stoner it’s only used for perspective corner pinning and grid warping however there’s no reason to use that shader just with the stoner, we can also use it with anything else we like. For example lets take a sphere with noise and apply this material and we end up with:

remap2

…and using our Remap TOP we get the following…

remapsphere

So what can we conclude from this? Quite simply that if you really wanted to you could have the same remap setup you have with the stoner in CamSchnappr, there are some caveats to this but if you can get around them it’s a super powerful setup.

Note: You need to keep your remaps as 32-bit images. 8-bit just isn’t enough to get any kind of smoothness and even with 32 bit you’ll get some jaggies on the edges. To avoid jaggies I tend to add an edge ring into my shader to alias my remappings. If you’re into glitch effects a really cool effect is to take a highly compressed h264 remap image and then use the remap with your video and you get all kinds of datamoshy loveliness.

Leave a Reply

Your email address will not be published. Required fields are marked *

Post Navigation

×