Rotate UV Question

456
2
03-29-2023 12:55 PM
BenHammer1
New Contributor II

I was hoping someone in this community would be able to assist with this. I'm building Hangar Models with Rounded roofs and door storage on the side. Is there a way to keep my texture from rotating? The rounded roof is an inserted .obj and the door storage is just extruded on the left and right side of the building. See the image below so you can get an idea of the question. The yellow highlighted areas need to be rotated. I attached my rule file as well.

CE_MatchUV_Rotation.jpg

0 Kudos
2 Replies
JonasObertuefer
Esri Contributor

Hi @BenHammer1,

Currently you do the setupProtjection() at the end of the chain in your X rule so depending on the face from where you call X the texture will have the right direction or not.

I see two ways to approach this:

  1. Extend your X rule to pass parameter(s) which will control your setupProtection and change accordingly wherever you call X
  2. Do the setupProtecton earlier e.g. after split into different facades (HangarFront, HangarLeft, ...) and then setupProtection again with different direction where needed e.g. after the specific comp(f) split in HangarDoorStorage.

Hope this helps!

Cheers
Jonas

0 Kudos
CherylLau
Esri Regular Contributor

Adding to what Jonas suggested, for option 2, I'd also recommend putting the setupProjection in HangarFront before the facade is split, as shown below.

 

To get the texture alignment so the bricks are horizontal, you could use alignScopeToGeometry to align the scope to the lowest edge (which happens to be horizontal in your case) before using setupProjection.

 

I added a rotateScope after the extrude in HangarDoorStorage just to make it more intuitive to select the appropriate faces in the subsequent comp, but this is optional.

 

Here is what I changed in your code above.

 

const facadeTexWidth = 15
const facadeTexHeight = 15

HangarFront -->
	setupProjection(0, scope.xy, facadeTexWidth, facadeTexHeight)
	split(x) { 4: X
			 | ~3: split(y) { ~10: Door | 5: X }
			 | 4: X }

HangarDoorStorage -->
	extrude(10)
	rotateScope(-90, 0, 0)
	comp(f) { top: setupProjection(0, scope.xy, facadeTexWidth, facadeTexHeight) X
			| side: Wall_AlignToLowestAndTexture }

RoundedRoofComp -->
	comp(f) { object.back: X
			| object.front: Wall_AlignToLowestAndTexture
			| object.top: Y }

Wall_AlignToLowestAndTexture -->
	alignScopeToGeometry(zUp, any, world.lowest)
	setupProjection(0, scope.xy, facadeTexWidth, facadeTexHeight)
	X

X -->
	texture("builtin:uvtest.png")
	projectUV(0)

 

0 Kudos