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 timcommandeur · Oct 24, 2013 at 09:59 PM · texturerenderereffectfade

Fade mesh material color to texture

Hey all,

I want to have an enemy flash white when hit and then have it's color fade back to it's original texture. Can someone give tips on how to do this?

Thanks

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
1
Best Answer

Answer by Owen-Reynolds · Oct 25, 2013 at 08:01 AM

This is pretty hacky, but, you could oversaturate the main color. You can't do it in the Inspector (diffuse shader uses white 255/255/255 as the color for a normal-looking texture. You can darken that, but can't go any brighter.) But you can brighten it in code:

 enemy1.renderer.material.color = new Color(3,3,3);
 // blast of triple whiteness, which defeats even shading

The only problem is it only multiplies color, so pure black areas stay black, brown areas (like 100/60/0, no blue) will only turn bright yellow... but it might still look cool.

Then fade back to (1,1,1) however (I like coroutines, but a pain to learn.)

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 timcommandeur · Oct 26, 2013 at 10:05 AM 0
Share

Would it also be possible to have it fade between two textures?

avatar image Owen-Reynolds · Oct 26, 2013 at 03:06 PM 0
Share

Anything fancy and you have to, I think, modify a shader.

For example, the current Unity Detail shader takes two textures and always multiples them together (since the second is assumed to be a "white with darker details" texture.) That could be changed to Lerp them by 0.5 (a standard blend.) Then that 0.5 could be changed to a float, which could be set in the material, and changed in a script for the blend. Then another version of the shader could be made with texture#2 replaced by white (which would do exactly what you first asked.)

That's all "easy," if you know simple shaders, which is less easy.

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

16 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

Related Questions

GUI.DrawTexture over screen 2 Answers

How to switch the texture being used by the material of the mesh renderer 1 Answer

Tracing in Unity3D 2 Answers

How to change a value in custom shader through script, C# 1 Answer

Render Transparent Geometry 1 Answer


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