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 Kioku · Dec 10, 2012 at 10:09 AM · shadertexturecombine

Change between 2 textures based on a variable

Hi, I'm just starting to try to figure out shaders. This is for a game I am making as a class project. I saw how to set a color variable in a shader from another script: renderer.material.SetColor(); but what I really need is a way to switch between two textures, with blended versions in between. In the game the player is supposed to change to a different texture to indicate that they are closer to the time limit. (The player is infected and turning into a mutant creature over time unless they stop it) There are items that can give them more time. I have a variable that tracks the percent of the time bar remaining. I sort of saw a few ways to blend two textures but I played around for a while and could not figure out how to have a larger percent of one texture or another, never mind a way to externally set the percent of each being used. I hope my situation is clear and I'd be glad to clarify. Could you please help my out. Thank you a bunch!

Comment
Add comment · Show 1
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 AlucardJay · Dec 11, 2012 at 06:21 AM 0
Share

Unless some guru on this 'site knows of a command I really don't think it is possible. The best you could do is have 2 textures, one placed just infront of the other, and modify the alpha of the front texture. If you are not using planes/flat surfaces, there could be a problem with z-sorting if you dont get the distance between the 2 textures set right.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Maulik2208 · Dec 10, 2012 at 10:31 AM

For changing texture use Gameobject.material.maintexture = Texturename; for more info on scripting have a look on this link link text

Hope this will work for you.....Enjoy and don't forget to Accept as a correct answer if works fine for you.....

Comment
Add comment · Show 1 · 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 Kioku · Dec 11, 2012 at 01:07 AM 0
Share

I'm sorry but that's not what I wanted. I wanted a way to shift between two textures mixing them at different percents in between. So I wanted to go from fully one texture to fully another (with the percent of each based on a variale). So what I really want to know is how to combine two textures such that thereis more of one than another and how to set the weight of each. Thanks.

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

11 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

Related Questions

How can I combine a color texture with a b&w texture and get color? 2 Answers

Combine Shaders 0 Answers

wood embers shader/texture 0 Answers

How do I build A texture from decals? 0 Answers

Cutout Material is not showing texture transparency? 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