0
\$\begingroup\$

I am trying to apply texture along the ring by using shaders. I am trying to avoid unnecessary mesh creation. I am trying to achieve it by using Shader Graph in Unity however I couldn't make it work by modifying Vertex position. I assume that it has to be done by changing vertices since the texture should appear in a circular shape.

To be more clear; I am trying to create this line by only using Checkerboard or checkboard-looking assets.

What I tried was to create the x,y positions with sin(x) and cos(y) with a time to create circular vertices however wasn't successful.

Does anyone have any idea how to achieve this shader?

\$\endgroup\$
1
  • \$\begingroup\$ You could create a mesh for the ring, with texture coordinates, where the vertices in the inner side of the ring point to the right side of the texture, and the vertices in the outer side of the ring point to the left side of the texture. That way when you draw that mesh, it would draw the texture in a ring, without messing around with shaders. Have you tried that? \$\endgroup\$
    – TomTsagk
    Aug 22 at 11:14

1 Answer 1

1
\$\begingroup\$

How about this? enter image description here enter image description here

I'm assuming you want this on a quad. Of course, for a different mesh it would be a different story. To answer what I think is the deeper question here, when you are trying to map a texture to your mesh in a weird way, you don't want to modify the vertices' positions, but instead the UV coordinates.

\$\endgroup\$
1
  • \$\begingroup\$ Yes, indeed that what I was trying to achieve. I got close by doing the upper part what you did here but was not able to come up how to remove the center part. What I understood bottom part of the logic is remapping and creating a ring instead of endless circles. That is pretty cool \$\endgroup\$
    – jazz
    Aug 24 at 1:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .