Forum

Problem connecting two separate homography nodes to a quad

i have connected one homograpy node to the transform of a quad to alter its shape and a secondary homograpy node to the texture transform of the same quad to alter its texture shape.

This does not work. The secondary homography is overridden by the first one.

The quad has a video file texture.

any ideas why this one does not work?

a quad has only 4 vertices (points) for the four corners of the quad, which are used to define a rectangular mesh. when a texture is applied to a mesh (like the quad), the texture is stretched according to the texture coordinates of each vertex. since the quad has only 4 vertices, the homography can only influence the texture coordinates of those, and that might not be enough to properly distort the texture.

try using a Grid (DX9) with a resolution higher than 2 for each dimension (e.g. 16x16). this results in more vertices, which gives you more texture coordinates, and should result in a more appropriate stretching of the texture.

(if that does not do the trick, please post the smallest portion of your patch that still shows these troubles so we can have a look.)

here it is. In this patch i have the grid changing position with the switch node. However I want this to act like a ‘window or spotlight’ to the texture.

As you can see in the patch when the grid changes shape the texture also becomes warped ( I want it to stay in its original form whilst having seperate control of the texture transform).

TO explain it differently: I want individual control of the grid transform and the texture transform…

BTW sorry you will need to load a video texture to see what i mean…

vvvvorum.v4p (20.5 kB)

I guess what i really want to do is be able to ‘mask’ the texture but with the same type of system as with the homography points.

i think your setup is correct. i guess the homography node breaks the ‘FrontProjected_XY’ mode of the ‘Texture Coord Mapping’. i can’t estimate if this is a bug or expected behavior; @tonfilm should know.

you should post a bug report anyway :)

in the meantime, if the masking is what you’re after, the same thing could possibly be accomplished using my 2DGridDistort module. i’ve attached an alternate helpfile similar to your setup …

2DGridDistort (Transform Grid) help 2.v4p (10.3 kB)

yea, i guess the grid distort is more what you are looking for…

about homography, i would say, its not a bug. homography appears to be a 2-dimensinal transformation, but on the contrary:

the usual transforms we know (scale, rotate, translate, …) are called affine transforms. they are applied to 4d-vectors in homogeneous space (x, y, z, 1), where the 4th component w is always 1. the w component dissapears for the user.

then there are so called perspective transforms like the perspective or vertigo node. this class of transforms alters the w component. after the transformation, the vector is somewhere in 4d-sapce and has to be divided by w, to put it back into our space.
perspective transforms should only be applied to the perspective pin of the renderer, because there the graphics card does the division by w to project the points on the screen.

so if perspective transforms are applied somwhere else, the result should be divided by w.

homography actually is a perspective transform and therefore alters the w component. when applied to texture coordinates it gets even more complicated, because usualy they live in 2d-space…

and a note. there is no affine transform, that can distort a shape irregular, like homography (perspective), or the GridDistort (linear interpolation) does.

here a small patch:

affine_vs_perspective.v4p (10.5 kB)

as tonfilm pointed out texture coordinates need to be projected back into their 2d space.
to get that i only needed to comment out one line in the pixel shader of the constant_2.0 effect, which divides the texture coordinates by w.

the tricky part was to recall the fact that the corners of a standard grid are at -0.5 … 0.5 and not at -1 … 1. after remembering that everything worked as expected.

homography.zip (3.1 kB)

is it possible to have this system but also have independent control of the textures persective?

here is the scenario: I have large a white cube in a room and I am projecting imagery over that cube with vvvv. As the beamer is only on one side of the cube, it illuminates only 3 faces (top and two sides).

Therefor I create 3 grids and use homography to stretch each point to each face of the cube, and of course 3 separate textures to beam onto each side

The reason I want to use the homography to ‘mask’ the texture is because it looks interesting and creates an effect that seems to ‘reveal’ a section the texture over the cube, so the beamer mimics some sort of scanning device over the cube.

The problem I run into with that however is that I lose control over the perspective of the texture, so I cannot compensate for the off axis perspective of the cube faces…

In saying that, would is be possible to regain control of the textures perspective, whilst also having control of the homography ‘masking’ effect?

Or even more appropriately, be able to render a single texture over the cube that seamlessly runs over all 3 faces, and a masking effect that ‘scans’ over the entire cube (rather than having to configure 3 independent sides of the cube).

Hope this makes sense, please let me know if I am being incoherent.

is it possible to use the homography but change the amount of points, as to be able to create triangles and other shapes?