Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by gord0_ · Feb 13, 2014 at 02:24 PM · c#textureuvislandshell

Isolate a UV Island (aka Shell)

Alright, I'm in the middle of making a decal system that paints directly on textures. I also have it doing the legwork on the video card so there's no lag like using a Texture2D.Apply() approach.

Anyway, essentially I'm just stamping the texture with the decal at the specified UV coord. My next step is to isolate the island hit by the raycast so I can limit the decal to that island. So that way when a decal hits near the edge of an island, it doesn't leak into neighboring islands.

What I know:

-UV coord of raycast hit (where I draw)

-triangle index that was hit (how I find the correct texture to draw on)

-an array of all the UVs (not using it yet, but I'm fairly sure it would help in the isolation process)

Can anyone help me figure out how to isolate the island that was hit? I've really scowered this forum, stack overflow, and google...found some similar pleas for help but no answers.

Any help is much appreciated : ]

Edit: I've asked around with some of the artists and I'm told a UV Island is also sometimes refered to as a Shell.

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image nesis · Feb 13, 2014 at 04:00 PM 0
Share

Unfortunately there's no built in solution that does this in Unity, so you'd need to step through tris in the mesh connected to the one the raycast hit and for each untested vertex, test if it forms part of the edge of the island.

The way I see it, it would work somewhat like flood fill logic for paint programs. This could prove pretty expensive for meshes with many tris and few UV islands.

avatar image gord0_ · Feb 13, 2014 at 05:08 PM 0
Share

How would I know when I've hit the border of an island when checking the tris? Also how do I know which vertices belong to each tri? I only have the tri index (int) of the tri that was hit.

avatar image Astiolo · Jun 17, 2018 at 11:07 PM 0
Share

Did you have any luck with this? I'm trying to do something similar.

For my case I could make a texture with a different colour for each island (for each of the meshes I want to use). However, it would be a lot nicer to have something automated.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Assigning UV Map to model at runtime 0 Answers

Mesh texture not properly rendered 0 Answers

How to set the colour of a texture, but only within certain UV Coordinates? 0 Answers

Multiple Cars not working 1 Answer

How to rotate a UV/ texture? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges