Hey folks. I’m currently looking into doing some eyes similar to that found in Twilight Princess. However, I was wondering if it would be possible to just isolate and change the UVs of one specific island on my texture - allowing the pupil to move around independantly of the rest of the face.
In the link above, they’re using a separate layer of geometry, and I also know I could do this with multiple materials… but it would actually be really handy for me to just grab the island that I need and scroll that around independently of the model.
An example of the texture I’m looking at follows - note how clean the eye area is, how easily it would be to turn this into a separate island.
Lemme know if you’ve any ideas on this - or if you can explain why I can’t (or shouldn’t!) do this! (Or if I should have put this thread into ‘shaders’!)
Ah, sorry @neoshaman , I’m not sure if I was being sufficiently clear there. I know how to offset UVs in both C# and shader, I’m just trying to isolate one particular island of UVs to apply that offset to.
Basically, imagine if I just wanted to translate the one highlighted island / face over the character’s eye in the image above. How could I identify that particular face for translation?
Split the model so those triangles are a separate mesh.
Set a vertex color on that triangle in an external application. Check for that color in the vertex shader.
Move the UVs to outside of the usual 0.0 to 1.0 range (ie: if the UV is at (0.2, 0.5), set it to (-0.8, -0.5) by subtracting 1 from both.
Find the triangle indices for those triangles and test them against the SV_PrimitiveID in the fragment shader.
Lots of ways. Most of those make it easy to find in C# too, though the 4th method alone won’t work well there as unlike the first 3 methods it won’t ensure the wanted triangles have unique vertices meaning any manipulation will also cause the rest of the face around it to move too.
Trying not to split the model if I can - it’d be nice to do most of my work within a single material on a skinned renderer.
Hm. I have a feeling that might be the easiest, but I’d worry about that colour bleeding onto nearby vertexes. Of course, I should just detach those vertexes… which is probably your intention. Gotcha.
Ha, excellent idea! Unsure of how I’d talk directly to those vertexes in the shader, but you’ve set me on a useful path there.
I understand - as you point out, that’ll affect neighbouring triangles, which is not the intended outcome.
Righto. I’ll take a look into #3. Thank you muchly, bGolus!