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
0
Question by Kiloblargh · May 24, 2011 at 09:20 PM · shaderblendingcutoutanimated-texture

How to control Alpha Cutoff across the length of an object, is that even possible?

I'm starting to understand what's the deal with transparency depth sorting, ie. why it doesn't work right in Unity, or anywhere else, no matter what and that it's a royal pain in the butt and makes me want to throw my laptop through the window...

So now I am looking at the cutout shaders, which apparently don't have these problems. I know I can animate the alpha cutoff value from a script, which is a good start. My gloss map is basically the same as my bump map, so animating the alpha cutoff value makes it disappear from its creases outward, which actually looks cooler than a 'real' alpha fade.

But can I map gray values of an image file to alpha cutoff values in the shader- or more usefully, two separate images that I can blend between?

"/!\ No results found for 'alpha cutoff map'." —The Google

I want to make the object appear and disappear from one end to the other rather than all at once, so I want to map alpha cutoff value A to one end of the U or V axis, and alpha cutoff value B to the other end. Maybe blending ramp images is the way to do it, or maybe scripting within the shader- a prospect which still fills me with dread. Or, does the alpha cutoff value simply Not Work That Way?

Comment
Add comment · Show 3
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 Kiloblargh · May 24, 2011 at 10:19 PM 0
Share

The "DebugUV" shader copied and pasted straight from the manual gives three errors , which is not encouraging. And I am looking at the code of the AlphaTest-BumpSpec.shader from the builtin shaders packages and I'm not seeing anything in there that actually implements the alpha cutoff value. It's just declared as a #pragma after the CGPROGRA$$anonymous$$ line- so it's a 'canned' effect that is not open to editing...?

avatar image flaviusxvii · May 24, 2011 at 10:34 PM 0
Share

I'm pretty confident what you're trying to do is possible. It'll probably take a shader though.

avatar image Kiloblargh · May 25, 2011 at 12:58 AM 0
Share

Well, I've figured out that much, but how to expose the workings of the alpha cutoff in the shader so that I can map either UV coords or a texture file to it has me stumped. There's no place in the code for the builtin cutoff shaders for such a script to go as far as I can tell. Just #pragma surface surf BlinnPhong alphatest:_Cutoff and that's it.

2 Replies

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

Answer by Kiloblargh · May 25, 2011 at 10:16 AM

I think I figured out the answer, but I don't like it much...

• Open the compiled shader (all 5365 lines of it.)

• Find all instances of "_Cutoff"

• Add a _NewCutoff variable after it

• Change all the "x = (tmpvar_6 - _Cutoff);" lines to something cleverly incorporating '_NewCutoff' and 'texcoord'

• Realize that most of the dozens of SubPrograms don't have anything resembling that line because they are written in various equally illegible dialects of assembly language

• Hate life

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

Answer by Kiloblargh · Jun 03, 2011 at 10:24 PM

6 letters: SSE FTW.

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 Chris D · Jun 03, 2011 at 11:08 PM 0
Share

What does this even mean?

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

2 People are following this question.

avatar image avatar image

Related Questions

Possible to pause a shader? 1 Answer

Cutout + Specularmask-shader error: "Material doesn't have a color property" 0 Answers

"Blend SrcFactor DstFactor, SrcFactorA DstFactorA" Does not work 2 Answers

Shader: Add one image's alpha to the other while keeping it unlit 1 Answer

Shader Depth Mask - Shadows with cutouts 2 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