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 Sacristan · Apr 02, 2011 at 05:21 PM · textureborderincuttingparts

displaying part of texture

Ive got problem with a texture... There is a constant border around this texture (other object). But the problem is that i dont need to expand a texture within border as i always did, but i need to cut it somehow in parts (show a part of texture, depending of a non constant variable).

For example: if x=10, then show 10 percent of texture; if x=45, then show 45 percent of texture; and so on.

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by KeithK · Apr 02, 2011 at 05:41 PM

The way to show only part of a texture is to change the UV coordinates of the Mesh the object is being applied to.

UVs work from 0 to 1, where 1 is 100%. So if you want to show 45% of the texture on a quad, you would have to change the UVs of the quad to:

Vector2[] UVs = new Vector2[]
{
    Vector2(0.0f,  0.0f),  // Bottom left
    Vector2(0.0f,  0.45f), // Top left
    Vector2(0.45f, 0.45f), // Top right
    Vector2(0.45f, 0.0f)   // Bottom right
};

This is assuming the quad you're applying it to's first vertex is the bottom left and runs clockwise through to the fourth vertex, which would be the bottom right.

Comment
Add comment · Show 2 · Share
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 Sacristan · Apr 02, 2011 at 05:54 PM 0
Share

THX a lot, dude!

avatar image arslanmkhan · Feb 13, 2012 at 07:07 AM 0
Share

thats quite helpfull but cube is 6 sided which means it have 24 vertices and we have to give uvs for all 24 vertices is there an easy approch for doing this

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

1 Person is following this question.

avatar image

Related Questions

Assigning UV Map to model at runtime 0 Answers

I have a GUI element that highlights an onscreen object with a circle. This circle needs to scale according to the object's distance from the camera in order to compensate for perspective, but the thickness of the circle needs to stay the same. 0 Answers

Control UI Panel Border Size 1 Answer

Problem With GUI Circle Thickness 1 Answer

Problem With GUI Circle Thickness 0 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