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 zandegran · Aug 23, 2012 at 08:21 PM · texturematerialtexture2dalphapixel

Texture2D: pixel Specific alpha not working?

 **Hi I basically want a texture with different pixels having different alpha values and this is not working..**

` public var alpha:float; function Start () {

     // Create a new 2x2 texture ARGB32 (32 bit with alpha) and no mipmaps
     var texture = new Texture2D(2, 2, TextureFormat.ARGB32, false);
  
     texture.SetPixel(1, 0, Color(1.0, 0, 0, alpha));  
     texture.SetPixel(1, 0, Color.white);
     texture.SetPixel(0, 1, Color.green);
     texture.SetPixel(1, 1, Color(0,0,1,0.7));
     // Apply all SetPixel calls
     texture.Apply();
 
     // connect texture to material of GameObject this script is attached to
     renderer.material.mainTexture = texture;
 
 } 

`

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

4 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by ScroodgeM · Aug 23, 2012 at 08:23 PM

methinks your shader that you use for testing doesn't use alpha.

select Transparent-Diffuse shader in material to see alpha effect.

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

Answer by zandegran · Aug 24, 2012 at 01:37 PM

Thank you but it is not working alt text

I want different pixels with different alpha....


texture.png (21.1 kB)
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 ScroodgeM · Aug 25, 2012 at 01:59 PM 0
Share

hmmm... r u sure on your texture alpha is ignored? i see some different alphas on it... how do you check that alpha is ignored and what effect do you want to achieve... also try to create some really different alpha pixels - 0.1 and 0.9 for example... and set alpha-value in color setting from material to 1.0 to use only alpha value from texture.

avatar image
0

Answer by zandegran · Aug 27, 2012 at 08:20 AM

This is a Hexagon on a rectangular plane the hexagon has a alpha value of 1(RGBA : 1,1,1,1) and the remaining area has value of .001 (RGBA : 0,0,0,0.001) I want the hexagon to be real opaque but it is not. alt text transparent/diffuse I've also uploaded the texture (.js)

Texture File .js


texture.png (40.6 kB)
tex.txt (3.0 kB)
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 ScroodgeM · Aug 27, 2012 at 08:40 AM 0
Share

set color in material with transparent/diffuse also to 1,1,1,1

avatar image
0

Answer by zandegran · Aug 27, 2012 at 09:07 AM

I got what I want... The right mode is Unlit/Transparent alt text


texture.png (45.7 kB)
Comment
Add comment · 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

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

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Merging Textures At Runtime - Not Correct? 1 Answer

How to fill texture that would be avaliable to ither shaders? 1 Answer

Boat wake/foam 0 Answers

Shader with two textures separated by an alpha channel? 1 Answer

What's the most effecient way to rotate a texture? 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