Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
2
Question by Ardan · Jul 11, 2011 at 06:07 PM · texturetexture2druntimegradient

Make a Texture2D gradient during run-time

I'm wondering if it is possible to create a gradient based on several colors without using shaders? What I want is to generate it during runtime and have it be a 2*256 texture. The reason I don't just make a few gradients in photoshop and import them is that i want to randomize their looks from a few parameters.

Since these gradients never will be applied to a mesh i cant use shaders to get this effect. What would be the easiest way to do this, if it's even possible?

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 Fattie · Apr 30, 2013 at 06:40 AM 0
Share

Arden, Eric has a superb explanation of this here:

http://answers.unity3d.com/questions/445898/how-to-gradeintly-fill-a-bitmap-programmically.html

it may help

1 Reply

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

Answer by Eric5h5 · Jul 11, 2011 at 06:23 PM

Everything is possible, you just code it. Make an appropriate texture by creating a Color array, then use SetPixels and Apply. (Although you don't need 2x256, since 1x2 is sufficient due to bilinear filtering creating a gradient for you from two colors. You still need a Color array, but it only really needs two entries.)

Comment
Add comment · Show 4 · 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 Fattie · Apr 30, 2013 at 06:43 AM 0
Share

say @Eric!

Let me ask you something. Did you recently change the spelling of your screen-name from Eric5x5 to Eric5h5 ? ("X" becomes "H")

For two years ... I could swear it was Eric5x5.

(ie, it's a reference to the military aviation slang "5x5" -- "received with great clarity" "all clear")

If not, i..e if I "mis-saw" it for two years, thousands of times ... that is freaky :O

Cheers :)

avatar image Eric5h5 · Apr 30, 2013 at 05:42 PM 0
Share

$$anonymous$$y screen name has remained unchanged for untold eons. In the beginning, there was Eric5h5, and it has been so ever since.

avatar image Fattie · Apr 30, 2013 at 05:49 PM 0
Share

That is amazing. I can only apologise for all the times I typed "5x5". (I have eye problems.)

I'm truly sorry!

As I say I read it as "5x5" - military jargon for "perfect reception, clarity." (Which seemed very apt!) Again, sorry!!! $$anonymous$$akes me think of that website, cantbeunseen.com

Eric5h5 !

avatar image Eric5h5 · Apr 30, 2013 at 06:00 PM 0
Share

I don't remember you typing "5x5" actually. If the Google search I did just now is accurate, you only did it twice. So, I suppose I can forgive that. Possibly. $$anonymous$$aybe.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Create a custom texture from code? 1 Answer

Changing Part Of Texture/Material 1 Answer

Changing terrain texture at runtime 1 Answer

Raycast project to texture at runtime 1 Answer

Difficulty loading alpha textures at runtime 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