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 chartinboy · Apr 25, 2014 at 05:31 PM · animationtexturecolorproceduralsine

Set the procedural color texture script to a set pattern?

I'm talking about the script listed here: http://wiki.unity3d.com/index.php/Animated_Color_Procedural_Texture

I'm trying to create something along the lines of the third or fifth examples in the image, however mine are always coming out as animated lines instead. could someone with more experience with sine waves and graphs help me out here?

Many 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
0

Answer by robertbu · Apr 25, 2014 at 06:17 PM

The patterns are changing because the code uses Time.time. Remove Time.time from the following two lines and replace it with a constant, and the pattern will remain fixed:

 var green = Mathf.Sin(x*.5+Time.time+Mathf.Sin(y*.23)*.8)/5+.5;
 var blue = Mathf.Sin(x*.3+Time.time+Mathf.Sin(x*.43)*.4)/5+.5;

You may want to run the app as-is and output Time.time each frame. When you get a pattern you like, you can then replace Time.time with the output value.

Note once you have the constant you want, you only need to call Calculate() once (perhaps in Start()), not every frame in Update().

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 chartinboy · Apr 26, 2014 at 09:09 AM 0
Share

Thank you; but I'm not looking for it to be static - but rather animated, but for the colours to be softer and "cloudier" like the third and fifth examples.

avatar image robertbu · Apr 26, 2014 at 02:30 PM 0
Share

I don't think experience with waves and graphs would be much help here...just a willingness to play with the parameters. Here is something that may be in the direction you indicate. At the top of the file reduce the texture size:

 private var width = 64;
 private var height = 64;

And here is some mods to the equations. Note I added a calculation for 'red' just to see what it would look like. You can set 'red' back to 0 if you don't want red in your calc.

 var red = 0.4*$$anonymous$$athf.Sin(x*.5+Time.time+$$anonymous$$athf.Sin(y*.13)*.8)/5+.5;
 var green = 0.2*$$anonymous$$athf.Sin(x*.8+Time.time+$$anonymous$$athf.Sin(y*.23)*.8)/5+.5;
 var blue = .25*$$anonymous$$athf.Sin(y*.3+Time.time+$$anonymous$$athf.Sin(x*.43)*.4)/5+.5;

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

How to constantly animate thousands of cubes 1 Answer

Can't find a way to simplify this code... any help appreciated... 0 Answers

how to draw simple coloured objects 1 Answer

Pixel Color Issue 1 Answer

Can't add texture to procedurally generated plane 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