Jump to content

Filtering Texture Maps In Vex


Recommended Posts

No matter how extreme I set the values to, my image doesn't seem to blur. Neither am I seemingly able to change the filter method ("box", "point", etc), so I assume something is wrong with my code despite the fact that I don't get any errors and the shader successfully renders with a texture map:

Cf= texture(texmap, uv.x, uv.y, "filter", filter, "width", width);

Another related question: if I only wanted a specific channel (say the alpha channel), how would I access that?

Link to comment
Share on other sites


You have to convert your image to .rat format for filtering to work.

I don't know the exact answer to your second question off the top of my head but you want to use a vector4 to represent RGBA then convert it to a vector3 (RGB) and a float(A).

Hope the above helps!



Link to comment
Share on other sites

And if anybody knows of a more efficient way to get a specific channel from an image, please let me know as I'm still looking.

I don't know about more efficient, but, AFAIK, in VEX (and in H8), you can access the individual members of a compound type (like vector and vector4) with the "dot" operator. The predefined names for the four members of a vector4 type are {x,y,z,w} or {r,g,b,a}, so something like this should be possible:

// fetch the RGBA texture color
vector4 tx  = texture(...);

// or with an explicit cast, though it shouldn't be necessary 
// in a simple assignment:
// vector4 tx  = vector4(texture(...));

// then do stuff with the elements
vector  RGB = set(tx.r,tx.g,tx.b);
float   R   = tx.r;
float   G   = tx.g;
float   B   = tx.b;
float   A   = tx.a;


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...