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
1
Question by dissidently · Dec 27, 2010 at 08:30 AM · shaderperformancetransparentefficiencyadditive

which is the most efficient additive transparent shader?

I can't seem to get decent frame rates with any of them on a couple of large objects in the scene.

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

Answer by Jessy · Dec 27, 2010 at 08:49 AM

I'll assume you just need a texture. Let me know if you need further functionality. Also, please tell us what the target platform is; this one would be ideal for iOS, but a desktop variant could run faster if alpha testing were involved. And if this is for iOS, and your specific target platform is iPad or anything with a retina display, then you might just be out of luck, because the GPUs in those devices don't have the fill rate necessary to run shaders that require overdraw, with a reasonable framerate.

Shader "Additive Texture" {

Properties { _MainTex ("Texture", 2D) = "" }

SubShader { Tags {Queue = Transparent} Blend One One ZWrite Off Pass { SetTexture[_MainTex] } }

}

Comment
Add comment · Show 8 · 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 dissidently · Dec 27, 2010 at 10:46 AM 0
Share

Your a $$anonymous$$e of information. Yes, this is for iOS. And during testing had some abysmal frame rates in webplayer as well. From what you're saying I should try avoid big objects with alpha textures used for additive effects on iOS? Is there any difference how I bring the alpha'd textures in? eg PNG, PSD, Tiff etc? 2... I think I'll move this to Forums, you think there's an advantage to structuring multiple planes in a grid so that screen culling gets rid of overdraw on large objects? Or is the cost of more objects going to negate the gains?

avatar image Jessy · Dec 28, 2010 at 11:29 AM 0
Share

An alpha channel can be useful on the desktop, because you can choose to only conditionally render pixels to the color buffer (which takes time), based on alpha testing. But this interferes with the way the POWERVR GPUs "want" to render things, which involves collecting everything in the scene and THEN deciding what not to render. So, although you can alpha test on iOS, this is not a good case for it; just additively blending black should be faster.

avatar image Jessy · Dec 28, 2010 at 11:35 AM 0
Share

Let me know if you experience a speedup with this; it should be noticeably faster than "$$anonymous$$obile/Particles/Additive Culled", which uses an alpha test, and "Color$$anonymous$$ask RGB", both of which are no-nos on iOS (at least currently).

File format doesn't matter at all; I use PSDs for Photoshop files, because Unity can import them directly, and PNGs, generally, from Illustrator, because they are uncompressed, and still small. Use whatever is easiest for you, but you should not need alpha at all, with this additive shader.

I'm not sure what you mean about this "grid". Please do link to a forum post.

avatar image dissidently · Dec 29, 2010 at 01:47 PM 0
Share

will do. Your tip on using additive and black backgrounds without alpha may be the single best thing I've learned this year! Certainly about Unity shaders at any rate. Sensational tip. Where's the sticky for that tip and your shader code? Oh, that's right, it's Unity.Answers... not Unity.Helpful.Resource I'll start another question explicitly so you can answer with this feature regarding your shader and black background images as textures in additive.

avatar image kariwmklawm · Jul 07, 2011 at 01:25 PM 0
Share

This is god - like, thank you so much for this!

Show more comments

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

Transparency issue on iOS 1 Answer

Transparent Shader performance, intermediate-advanced question? 0 Answers

Rendering a plane is dropping 10 fps 0 Answers

transparent shader 0 Answers

Semitransparent shader not visible in front of objects 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