Texture Coordinates

cat's picture

Is there any way to mess with texture coordinates by using the glsl shader? I'm looking for different wrap methods, border (which is default I think) wrap and mirror. And also a matrix input, basically I'm coming from vvvv and hlsl and all of this is built in... I want to mirror a texture and rotate it on a grid, been trying to do it with image transform's but I don't seem to be able to crop cleanly from the center, and want the texture to repeat or mirror rather than go black. Any suggestions?

Cheers

cat

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

cwright's picture
Re: Texture Coordinates

I know this sucks, but it sounds like you need to RTM on GLSL.

this is all built-in in GLSL as well, but it's perhaps not as well-exposed in QC :/

here's a simple rotation example. It's not quite what you're looking for, but perhaps it will help. I've found that if you multiple the rotation matrix values (the sin and cos values) by some number larger than zero, you'll end up repeating the texture that many times.

PreviewAttachmentSize
glsl texture.qtz5.93 KB

franz's picture
Re: Texture Coordinates

for rotation, scaling, offset, you can use the "Image Texturing Properties " patch. No mirror tho', but flip and repeat. hope this helps.

PreviewAttachmentSize
TextureProp.qtz48.61 KB

cat's picture
Re: Texture Coordinates

Thanks guys I'll check that out, and yeah I probably do need to rtfm, which would you suggest? I bought an opengl book, but it was most unfriendly list of possible keywords, with no suggestion of how to use them :( And then qc uses a subset of all that anyway I believe...

cwright's picture
Re: Texture Coordinates

QC uses all of GLSL, but there are a few features that you can't use because QC doesn't expose them -- for example, you can try to use cube maps, but QC doesn't let you create a port to accept them, so they always end up blank. Similarly, you can't feed in additional vertex attributes, so doing fancy stuff like normal mapping or bump mapping doesn't work either (again, because QC doesn't expose it).

I've heard the "Orange Book" is really good for GLSL. Otherwise, the Lighthouse 3D tutorials are pretty handy as well - you can find them here: http://www.lighthouse3d.com/opengl/glsl/

toneburst's picture
Re: Texture Coordinates

I'd recommend the Orange Book, too. There is some useful background stuff in the OpenGL Red book too. You could try googling it. There's an old version of it freely available in the web somewhere. It's got some good chapters on basic-concept stuff that's glossed-over in the Orange Book. Bear in mind that, as cwright says, some GLSL things can't really be done in QC, and a few examples in the Orange Book fall into this category, for one of other of the reasons already mentioned above.

Once you know some GLSL, you'll be able to tackle Core Image Filters too. CIFilters actually do use a subset of the GLSL language (I suspect this is what you were thinking of earlier). They're essentially GLSL Fragment shaders, with some additional functions, and some stuff taken away.

Good luck!

a|x http://machinesdontcare.wordpress.com

gtoledo3's picture
Re: Texture Coordinates

...and apparently Pixelshox did Cube mapping! That one blows my mind.