Flipping a Projector texture

So I have been searching forums, reading ShaderLab references and haven’t found the answer to my question. (Either that or I have gone full retard and missed the answer).

I am looking to flip a Projector’s texture (X axis) in the shader. I am creating eyes for a avatar, we would like to use one eye texture, just flip it to cut back on files, video memory, and the likes. Is there an easy way to do this or am I digging into shader code to write it myself? Thanks for your time…anyone who reads :slight_smile:

  • Mike

Hi, welcome to the forum!

You can use the tiling setting in the projector’s material to flip the texture around. Just set the X value to -1.

Projectors (the shader) don’t use the tiling or offset properties :). If you wan’t to tile of offset textures, you need to define your own projector matrices, either in the shader, or by script and passing it to the shader.

If you want to just flip the texture, I think you can make the “Aspect ratio” of the projector a negative value…

1 Like

Thanks for the welcome and quick response. I tried changing the tiling from 1 to -1 but no change. So here is some more information on what I am using and such. I have a sphere loaded from a Maya file, plain white texture, nothing fancy there. I am using the Shadow Blob projector material as the test for this, just with a test eye texture.

The eye texture is clamped and imported just about the say way the shadow blob is. Not sure if the material I am using has a setting that is not allowing me to flip this texture, or I am missing something.

Any more insight would be very appreciated.

  • Mike

Read my post, please… :wink:

Thanks Kragh, that worked wonderfully.

Sorry I missed your first post, wasn’t mashing F5 enough I think.

Again thanks andeee and Kragh

  • Mike

Hi guys, like you mentioned above last year on this thread, you could simply go into the inspector and change the tiling to -1 to flip the texture.

Is there a way to do this in code, instead? I find when I mirror an animation, the texture is backwards, so I need to be able to set it in the code because I don’t always mirror the animations.

Any help would be much appreciated. Thanks!

No, as said the tiling wasn’t a solution, as this factor (and the offset factor) isn’t used by the shader. Read the posts again for details :wink:

As for setting the aspect ratio by code, yes, that is possible:

gameObject.GetComponent<Projector>().aspectRatio = -1;