UV Coordinates on Cylinders

I am currently trying to use cylinders to place labels on a tube wrapped around linear features on the terrain. I have worked out how to place and rotate the cylinders to line up with the features and even how to give the cylinders a transparent texture (the pre-generated label image from the server)… only to find that cylinder geometry only has sensible texture coordinates for the “caps” (i.e. the two circles at either end).

There doesn’t seem to be a way to get the cylinder geometry to wrap the UV space around the “body” of the object as one might generally expect (think wrapping the image around a pipe), nor for that matter any way of excluding the caps (to make the pipe open-ended). Is there a parameter I’m missing to do this - I cannot find anything in the CylinderGraphics or CylinderGeometry documentation for it.


Benjamin Tolputt

So if I understand you correctly, you’ve got a textured cylinder like in this Sandcastle example, and you want the texture to wrap around the body, instead of the way it currently looks, covering the cap, right?

I think you’d have to change how the geometry computes the UVs here:

Either by editing the source or creating a custom geometry class that does it the way you need. It sounds like it might be useful to have an option to pass when creating the cylinder geometry for this, but I’m not sure how common that use case is. Pull requests are definitely always welcome if you have ideas on improving this!

You have my desire correct. From the sounds of it, there is currently no built-in way to do this and I'll need to override/extend the cylinder geometry class to get it working. Was hoping it wasn't going to be so low-level but it is what it is.

I'd be happy to upload the results of my work when done. Just need to understand the low-level code now. Thanks for the info.