Vop Tile/Mirror texture?

   6260   5   0
User Avatar
Member
60 posts
Joined: July 2005
Offline
Hi all.

I'm attempting to create a shader using Vops that will tile/mirror a texture. I don't know VEX, and am new to Vops in general. Any insight would be greatly appreciated!

Perhaps this is really simple, but I'm not having any luck with it. The idea is that I want to have the image repeat at least twice in U and V, and be able to control how each duplicate image is placed. In other words, I want to have the ability to control the rotational values independently for each copy of the image in each of the four corners of the shader space.

Think of it like four images on a screen, one in each corner. I want to be able to control how each image is rotated and scaled, but they never occupy any more/less screen space than one quarter of the screen. I want this kind of control for my textures. If I scale the entire screen down, I get more copies of those four screens around the edges of the original. The easiest solution would be to create four “texture” vops, scale them down in size, place them in each corner, merge them together, and then pipe that into a single “Texture” Vop, but you can only place a “string” value into a texture vop.

So I went about attempting to build a VOP that will have the image duplicated four times (one in each corner of the UV space). I don't want to have to loose the ability to “Repeat” the “wrap” effect (if I scale down my UV's in a “UV_Texture” sop) because this is crucial for creating more copies of the image.

I've been able to make it tile into four copies of the image by:

1) bringing in a “Shading Layer” Vop and running the UV's into four separate “UV_Transform” Vops, which scale the size of the UV, so that each transform occupies 1/4th (or one of the texture space corners) of the area that will be merged together.

2) Each “UV_Transform” is then piped into the S and T of 4 separate “Texture” Vops that are set to “Decal” for their “Wrap” parameter.

3) So the outputs of these are merged into 2 separate “Color Mix” vops.

4) the 2 “Color Mix” vops are then merged into another “Color Mix” vop, and then the output is multiplied by 4 (to brighten everything back up again), and this gets piped into the main output.

This does not give me what I'm after because I've lost my “Repeat” function (when I scale the UV's in a “UV_Texture” sop) by having to be forced to use a “Decal Wrap” for each “Texture” vop. The “Decal” setting was the only means by which I could find to avoid “pixel smearing” on the edges when initially scaling down the UV's in the “UV_transform” vop.
Also any inversions/rotations of UV for each of “the corners” tends to be rather messy (playing with the pivots here might help this).

Again, what it really seems like I need to be able to do is take my output, and run it as the input of another “Texture” Vop. Condensing four Texture Vops into One! The Final “Texture Vop” could then have it's “Wrap” set to “Repeat”, and all would be great… birds would sing, children would dance… but the input of a “Texture” vop does not allow RGB/RGBA values in… only a “String Values”. Sigh.

I've built a great “Tiling Gadget” for “Touch” (Real-time Houdini like performance tool), but it implemented an “off camera rendering trick” that can only be achieved in “Touch”… or so I believe.

If I get this one figured out (with maybe some help from any of you) I'll post it to the “exchange” page of the Houdini Community.

thanks loads.

Jim Ellis
Jim Ellis
www.emsh.calarts.edu/~jim
User Avatar
Member
7760 posts
Joined: July 2005
Online
I haven't tried what you're doing but some suggestions that may or may not help:
- After the UVTransform VOPs, clamp the results to (0, 0.5) or (0.5, 1) as appropriate. Then change the wrap on your texture back to repeat. The clamping might be able to avoid the smearing.
- Or, wrap the uv values yourself. Before feeding the values to the UVTransform VOPs, pass them through the Fraction VOP first. This should work for positive uv values. If you have negative uv values, you may need to negate them first.

I think doing it in the shader is the right way to do what you want. For a non-VOPs approach, you could have also used COPs. Then you can just refer to the cop using the op:<cop_path> syntax for the texture filename. (eg. opimg/img1/noise1).
User Avatar
Member
60 posts
Joined: July 2005
Offline
Thanks much Edward!

I thought of doing it in Cops, but there are other mad modifications that I want to perform to this that need to be on the Vex level.
I know that Vops/Vex can reference cops, but I'm really trying to build a solid shader that I don't have to enter into Cops every time I need to use it. Seems like it should be easy enough to do.

I'll try out your suggestions.
Since I'm new to Vops I would never have thought of what you suggested.
Sounds like it should work, makes sense to me.
I'll type back and let you know how it goes.

thanks again!!!

Jim Ellis
Jim Ellis
www.emsh.calarts.edu/~jim
User Avatar
Member
60 posts
Joined: July 2005
Offline
Gave it a shot.

The “Clamp” Vop doesn't inhibit the streaking of the pixels (unless I'm missing something).

The other suggestion of the “Fraction” vop didn't really seem to do anything at all when placed either before or after the “UV_transform” vop. I'm not really sure what this particular vop is suppose to do.

In the “help” it says:
“Computes the fractional component of the argument.
This operator computes the fractional component of the argument. This is equivalent to (val - floor(val)).”

Being new to shader writing this leaves me scratching my head. I wish there was a good example of this in use, so I would have a better idea of how it works in application not in theory which is new to me.
You said I could use this to “wrap the UV's” myself. When hooked into the chain (as you suggested) all parameters were grayed-out, and it didn't seem to do anything.

There was my attempt at what your kind suggestions Edward.
Did I miss something?

thanks again

Jim Ellis
Jim Ellis
www.emsh.calarts.edu/~jim
User Avatar
Member
941 posts
Joined: July 2005
Offline
Hey Jim,

It gets complicated if you try to explain these things, so I've posted an example over at the od [odforce.net] forum since I can't add attachments here.

Hope it helps.

Cheers!
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
User Avatar
Member
60 posts
Joined: July 2005
Offline
Hey Mario,

thanks so much!

I checked out your example, pretty cool.
Very kind of you to make that for me…
and you're right, trying to explain that in an email without a actual scene example would have been exceedingly complicated!

It seems as if the main key to making this example work was the “Inline Code” vop, in which the user implements vex code.
It will take me a bit of time to deconstruct exactly what you did (and to decipher the vex code) but once I do that, it seems I could really build off of this “starting structure” that you gave me.

This example will also be really helpful in my education in vops/vex.

thanks again

Jim Ellis
Jim Ellis
www.emsh.calarts.edu/~jim
  • Quick Links