Texturing the side of a cylinder without texture warping

602
2
Jump to solution
11-15-2023 04:07 PM
LR2
by
New Contributor III

I have a cylinder with radius = 1 and height = 1, and a test-texture created in Illustrator at 628mm * 100mm and exported in 72ppi and 600ppi. The cylinder was created with primitiveDisk(20, 1), extrude(1).

I want to texture the side (top+bottom remain blank) of the cylinder with this single texture (i.e. when setting up the projection I use 6.28, 1 for 2*pi*r and 1 for height). Unfortunately, no amount of scope aligning, comping, setting up the projection, etc, has gotten CE to do this. It always repeats the texture wrong, cuts off part of it, or warps it. How do I get it to display it right?

Furthermore, the same rule creates a far worse texture when I use the higher resolution file, as can be seen below. Why is that?

LR2_0-1700092210791.png

 

I attached the texture files, if someone wants to test this. This is the CGA for the above (top and bottom are textured too, but the concern here is the texture quality):

 

@StartRule @InPoint
 Lot --> 
  	primitiveDisk(20, 1)
 	extrude(1)
	setupProjection(0, scope.xy, 6.28, 1)
	texture("/Arsen/data/TestTextures/2pi_600ppi.png")
	projectUV(0)

 

 

0 Kudos
1 Solution

Accepted Solutions
desert
by
New Contributor III

There must be a better way, I tried to make it by disassembling the side of the cylinder with comp(f).

I textured each side of the cylinder with offsetting 

Hope this helps.

 

 

attr Cylinder_resolution = 20
attr Cylinder_radius = 1
attr Cylinder_height = 1
const Cylinder_round = 2 * Cylinder_radius * 3.141592


Lot --> 
  	primitiveDisk(Cylinder_resolution, Cylinder_radius)
  	extrude(Cylinder_height)
  	A
  	
A --> comp(f){side : B | top : NIL | bottom : NIL}

B --> 
	setupProjection(0, scope.xy, Cylinder_round, Cylinder_height, Cylinder_round-(comp.index/comp.total)*Cylinder_round, 0, 1)
	texture("images/2pi_72ppi.png")
	projectUV(0)

 

 

desert_0-1700097661201.png

 

View solution in original post

2 Replies
desert
by
New Contributor III

There must be a better way, I tried to make it by disassembling the side of the cylinder with comp(f).

I textured each side of the cylinder with offsetting 

Hope this helps.

 

 

attr Cylinder_resolution = 20
attr Cylinder_radius = 1
attr Cylinder_height = 1
const Cylinder_round = 2 * Cylinder_radius * 3.141592


Lot --> 
  	primitiveDisk(Cylinder_resolution, Cylinder_radius)
  	extrude(Cylinder_height)
  	A
  	
A --> comp(f){side : B | top : NIL | bottom : NIL}

B --> 
	setupProjection(0, scope.xy, Cylinder_round, Cylinder_height, Cylinder_round-(comp.index/comp.total)*Cylinder_round, 0, 1)
	texture("images/2pi_72ppi.png")
	projectUV(0)

 

 

desert_0-1700097661201.png

 

LR2
by
New Contributor III

That's great, thanks!

0 Kudos