Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

How to check overlapped UVW faces in specific map channel?

LayTiger
Participant

How to check overlapped UVW faces in specific map channel?

LayTiger
Participant
Participant

I tried xView "OverlappedUVWFaces.Check" first, but the function will return all overlapped uvw faces throughout all map channels.Then I found that "Select Overlapped Polygons" button in the UVW editor works well, so I tried to use the function to get overlapped uvw faces, but it seems not work in my code. Can somebody please help me?

LayTiger_2-1723085161534.png

LayTiger_3-1723085255626.png

fn CheckOverlappedUVWInSecondUV geo=
(
	local unwrapMod =  geo.modifiers["Unwrap_UVW"]
	local overlappingUVWFaces = #{}
	local uvChannel = 2
	if(classof (unwrapMod) == Unwrap_UVW and unwrapMod.getMapChannel() == UVChannel) then
	(
		unwrapMod.setMapChannel 2

		unwrapMod.selectOverlappedFaces()
		overlappingUVWFaces = unwrapMod.getSelectedFaces()
	)
	else
	(
		addModifier  geo (Unwrap_UVW())
		unwrapMod =  geo.modifiers["Unwrap_UVW"]
		unwrapMod.setMapChannel 2

		unwrapMod.selectOverlappedFaces()
		overlappingUVWFaces = unwrapMod.getSelectedFaces()
	)

	if overlappingUVWFaces.numberSet > 0 then
		return false
	else
		return true
)

 

0 Likes
Reply
Accepted solutions (3)
825 Views
10 Replies
Replies (10)

denisT.MaxDoctor
Advisor
Advisor

Do you need to check just a fact of overlapping, or do you need to know which particular faces are overlapped?

0 Likes

LayTiger
Participant
Participant
I just need a fact of overlapping.
0 Likes

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

so you can use the xView and UVW_Mapping_Clear modifier(s) to temporarily clear unwanted channels.

 

of course, you can use a temp UVW_Unwrap modifier but it's the much heavier solution.

denisT.MaxDoctor
Advisor
Advisor

question #2: How big is your mesh? Large meshes can be critical for the xView

0 Likes

LayTiger
Participant
Participant
Accepted solution

xView and UVW_Mapping_Clear modifier(s) actually works, thank you very much.

fn CheckOverlappedUVWInSecondUV geo=
(
	addModifier geo (UVW_Mapping_Clear())
	uvwClear = geo.modifiers["UVW_Mapping_Clear"]
	uvwClear.mapID = 1
	overlappingUVWFaces = #()
	OverlappedUVWFaces.Check currentTime geo &overlappingUVWFaces
	overlappingUVWFacesCount = overlappingUVWFaces.count
	deleteModifier geo uvwClear
	if(overlappingUVWFacesCount > 0) then
	(
		return false
	)
	return true
)
0 Likes

LayTiger
Participant
Participant
It's a game asset, usually have no more than 10000 faces, maybe it's ok to use xView?
0 Likes

denisT.MaxDoctor
Advisor
Advisor

Give it a try, who knows... 😁
I believe it should work with 100K, but not in real time of course.

0 Likes

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

@LayTiger wrote:

xView and UVW_Mapping_Clear modifier(s) actually works, thank you very much.

 

fn CheckOverlappedUVWInSecondUV geo=
(
	addModifier geo (UVW_Mapping_Clear())
	uvwClear = geo.modifiers["UVW_Mapping_Clear"]
	uvwClear.mapID = 1
	overlappingUVWFaces = #()
	OverlappedUVWFaces.Check currentTime geo &overlappingUVWFaces
	overlappingUVWFacesCount = overlappingUVWFaces.count
	deleteModifier geo uvwClear
	if(overlappingUVWFacesCount > 0) then
	(
		return false
	)
	return true
)

 


 

fn CheckOverlappedUVWInSecondUV geo excludeCh: =
(
	uvwClear = undefined 
	if excludeCh != unsupplied do
	(
		uvwClear = UVW_Mapping_Clear mapid:excludeCh
		addModifier geo uvwClear
	)
	
	overlappingUVWFaces = #()
	OverlappedUVWFaces.Check currentTime geo &overlappingUVWFaces

	if uvwClear != undefined do deleteModifier geo uvwClear

	overlappingUVWFaces.count != 0
)

 



0 Likes

LayTiger
Participant
Participant
wow, thank you for the optimized version!
0 Likes

denisT.MaxDoctor
Advisor
Advisor

It's not an optimization really... yours is good too. Mine is more “mxs stylish”. 😉  

0 Likes