isolate texture on surface

   4945   6   1
User Avatar
Member
201 posts
Joined: July 2005
Offline
I'm sure there is an easy way to do this but I haven't had enough coffee today …

I have a surface that has uv's applied in rows & columns and uses a shader to apply stripes. It renders the wonderful attached jpg.

Now, I want to have these stripes only appear in the middle section of the surface … feathering off as the texture approaches each edge. I'm thinking some sort of alpha rolloff based on u. How do I do this inside a vex shader?

I've attached an example hipfile. Much thanks in advance.

Rob

Attachments:
textureSurface.JPG (19.3 KB)
textureTest.hipnc (84.9 KB)

Cheers,
Rob
Digital Supervisor | Stargate Studios Toronto
User Avatar
Member
1390 posts
Joined: July 2005
Offline
Hope this is what you're after!

(I drunk 5 coffees today )


cheers!
Sy.

Attachments:
texturetest_208_skk.hipnc (109.7 KB)

User Avatar
Member
201 posts
Joined: July 2005
Offline
SYmek,

Thanks … it's almost what I need. Only thing is that it stretches the u's causing a smear of the texture. The attached image is a result of substituting the stripes node with default texture node and setting the clamps to .3 & .7 … this shows the result more clearly.

What I'm looking for is something like the decal but without using an actual texture image. Also want the edges to be feathered off.

I have to study your VEX network more to understand some of the other things you were doing in there. Again, thanks Can anyone else help out?

Rob

Attachments:
texSmear.JPG (21.5 KB)

Cheers,
Rob
Digital Supervisor | Stargate Studios Toronto
User Avatar
Member
941 posts
Joined: July 2005
Offline
Assuming the fadeout is happening in the u dimension (also typically inside the range), then you could try:

float weight = 1.0-smooth(ws,ws+fs,2*abs(u-center));

where:
center => center of window, float, range , default 0.5
ws => window size, float, range , default 0.5
fs => fade size, float, range , default 0.5

Those defaults would give you a 0.5-wide window centered at u=0.5 with the two sides fading out over a 0.25 range… filling out the interval in u.

… I think…
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
User Avatar
Member
201 posts
Joined: July 2005
Offline
Mario Marengo
Assuming the fadeout is happening in the u dimension (also typically inside the range), then you could try:

float weight = 1.0-smooth(ws,ws+fs,2*abs(u-center));

where:
center => center of window, float, range , default 0.5
ws => window size, float, range , default 0.5
fs => fade size, float, range , default 0.5

Those defaults would give you a 0.5-wide window centered at u=0.5 with the two sides fading out over a 0.25 range… filling out the interval in u.

Hey Mario! Thanks for the code snippet. I think I was able to convert it to a vex network … see attached image of network. The only thing I'm not sure is if the connection from subtract1 node to the floattovec1 node is the correct way … needed to go from a float to vector on the output.

I attached an image of the result. Now, how would I go about using a texture node in this?

Attachments:
texFade_vex.JPG (62.4 KB)
texFade.JPG (17.7 KB)

Cheers,
Rob
Digital Supervisor | Stargate Studios Toronto
User Avatar
Member
941 posts
Joined: July 2005
Offline
Hey Rob,

Looks almost right… but you kind'a mangled the inputs to the smooth VOP.
The output of multiply1 goes into the “amount” input of the smooth vop, and “roloff” gets no input, so disconnect the output from stripes2 from it. You can replace “constantB” and “subtract1” with a ComplementVOP, and lose “floattovec1”.
With those changes, the output of smooth1 is just a weight – it's meant to multiply the texture pattern, whatever that might be (in this case it's the output of stripes2, but it could just as easily be the output of a TextureVOP or anything else).

I'm attaching a modified version of your hip file with the changes.
HTH.

Attachments:
texturetest_208_b.hipnc (110.2 KB)

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

Looks almost right… but you kind'a mangled the inputs to the smooth VOP.
The output of multiply1 goes into the “amount” input of the smooth vop, and “roloff” gets no input, so disconnect the output from stripes2 from it. You can replace “constantB” and “subtract1” with a ComplementVOP, and lose “floattovec1”.
With those changes, the output of smooth1 is just a weight – it's meant to multiply the texture pattern, whatever that might be (in this case it's the output of stripes2, but it could just as easily be the output of a TextureVOP or anything else).

I'm attaching a modified version of your hip file with the changes.
HTH.

Mario,

Thanks ever so much! Now it makes more sense. Also learned about the multiply constant and complement VOPs

Cheers,
Rob
Cheers,
Rob
Digital Supervisor | Stargate Studios Toronto
  • Quick Links