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 VivienS · Nov 24, 2010 at 12:03 PM · lookstyle

How would you create look for floating computer interface?

Hi there!

I'd like to create a look for an in-game computer interface, that floats like an object in the level (like in the image below). How would you create an alpha channel like those stripes? Shader? Post Effect? Something else? What do you think is the most easy way?

Thank you for your suggestions!

alt text

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

3 Replies

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

Answer by taoa · Nov 24, 2010 at 01:39 PM

Shader. In the Pixel shader, for a pixel whose x position on screen is odd (or even, doesn't matter), divide the alpha value by whatever you want.

Comment
Add comment · Show 3 · 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 VivienS · Nov 24, 2010 at 02:39 PM 0
Share

thanks for the answer!

and say I want a certain texture ins$$anonymous$$d of the stripes? fi. crosshatches or another pattern. can i do something like a screenspace projection this way?

avatar image leith · Nov 24, 2010 at 04:32 PM 0
Share

still shader based. use screen space coords to do a 2d texture lookup for your alpha, rather than hard coding it to even and odd values.

avatar image taoa · Nov 25, 2010 at 10:48 AM 0
Share

What he said. But since you're looking for a computer interface effect, and since your game renders on... a computer, you might as well make use of said computer's resolution ^^

avatar image
1

Answer by VivienS · Jan 24, 2011 at 01:13 PM

Ok, just in case someone is interested: This is the final shader code I wrote for this effect. It uses a texture for the alpha channel, that is textured in screen coordinates, so you can decide for yourself how the alpha should look like. The Lighting function produces a flat, unlit surface.

Most likely not as performant as taoa's answer, but more flexible and better suited for what I needed.

Only drawback so far: In oder not to stretch the alpha, but tile it across the screen, you have to pass the shader the dimensions of your (quadratic) alpha texture and the screen.

Shader "FX/Computer Display" { Properties { _Color ("Color", Color) = (1,1,1,1) _AlphaTex ("Alpha Texture (R = Transparency)", 2D) = "white" {} _ScreenResW ("Screen Resolution Width", Float) = 1024 _ScreenResH ("Screen Resolution Heigth", Float) = 768 _TexRes ("Quadratic Texture Resolution", Float) = 128 }

SubShader { Tags { "RenderType"="Transparent" "Queue"="Transparent"}

 CGPROGRAM
 #pragma surface surf Unlit alpha 

 struct Input { 
     float4 screenPos;
 };

 float4 _Color;
 sampler2D _AlphaTex;
 float _ScreenResW;
 float _ScreenResH;
 float _TexRes;

 void surf (Input IN, inout SurfaceOutput o) { 

     // calculate pixel-correct screenspace UVs
     float2 screenUV = IN.screenPos.xy/IN.screenPos.w;
     screenUV.x *= _ScreenResW/_TexRes;
     screenUV.y *= _ScreenResH/_TexRes;

     half4 ac = tex2D(_AlphaTex, screenUV);

     o.Alpha = ac.r * _Color.a;
     o.Albedo = _Color.rgb;
 }

 half4 LightingUnlit (SurfaceOutput s, half3 lightDir, half atten) {
     half4 c;
     c.rgb = s.Albedo * 0.2;
     c.a = s.Alpha;
     return c;
 } 

 ENDCG

} Fallback "Transparent/VertexLit" }

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 · Jan 24, 2011 at 02:36 PM 0
Share

Cool, upvote for sharing!

avatar image
0

Answer by sendel76 · Jul 22, 2011 at 12:08 PM

pragma surface surf Unlit alpha

oes not work for iPhone ? It says:Shader error in 'Mobile/Alpha Vertex Color': Surface lighting model 'Unlit' not found. Available models: BlinnPhong, Lambert at line X

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

1 Person is following this question.

avatar image

Related Questions

my character settings are set for joystick how do i make em work with keyboard 0 Answers

first person controller parent move objects along y-axis 1 Answer

Unity Android Movement Problem 0 Answers

Transform.Rotate for Quaternions? 1 Answer

LookAt only when camera position changes 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