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 /
  • Help Room /
avatar image
0
Question by kmsjkh · Oct 11, 2018 at 07:36 AM · shadershadersshader programming

i wanna draw inside like outside. shader....

i wanna draw inside like outside this is shader i'm using :

https://www.youtube.com/watch?time_continue=26&v=wbL2FCxlCe4

from inside, color is just white. but i wanna draw color to inside like outside

i dont know about shader. but i have to make this please help.....

 Shader "Unlit/ShieldFX"
 {
 Properties
 {
 _MainColor("MainColor", Color) = (1,1,1,1)
 _MainTex ("Texture", 2D) = "white" {}
 _Fresnel("Fresnel Intensity", Range(0,200)) = 3.0
 _FresnelWidth("Fresnel Width", Range(0,2)) = 3.0
 _Distort("Distort", Range(0, 100)) = 1.0
 _IntersectionThreshold("Highlight of intersection threshold", range(0,1)) = .1 //Max difference for intersections
 _ScrollSpeedU("Scroll U Speed",float) = 2
 _ScrollSpeedV("Scroll V Speed",float) = 0
 [ToggleOff]_CullOff("Cull Front Side Intersection",float) = 1
 }
 SubShader
 { 
 Tags{ "Queue" = "Overlay" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
 
 GrabPass{ "_GrabTexture" }
 Pass
 {
 Lighting Off ZWrite On
 Blend SrcAlpha OneMinusSrcAlpha
 Cull Off
 
 CGPROGRAM
 #pragma vertex vert
 #pragma fragment frag
 #include "UnityCG.cginc"
 
 struct appdata
 {
 fixed4 vertex : POSITION;
 fixed4 normal: NORMAL;
 fixed3 uv : TEXCOORD0;
 };
 
 struct v2f
 {
 fixed2 uv : TEXCOORD0;
 fixed4 vertex : SV_POSITION;
 fixed3 rimColor :TEXCOORD1;
 fixed4 screenPos: TEXCOORD2;
 };
 
 sampler2D _MainTex, _CameraDepthTexture, _GrabTexture;
 fixed4 _MainTex_ST,_MainColor,_GrabTexture_ST, _GrabTexture_TexelSize;
 fixed _Fresnel, _FresnelWidth, _Distort, _IntersectionThreshold, _ScrollSpeedU, _ScrollSpeedV;
 
 v2f vert (appdata v)
 {
 v2f o;
 o.vertex = UnityObjectToClipPos(v.vertex);
 o.uv = TRANSFORM_TEX(v.uv, _MainTex);
 
 //scroll uv
 o.uv.x += _Time * _ScrollSpeedU;
 o.uv.y += _Time * _ScrollSpeedV;
 
 //fresnel 
 fixed3 viewDir = normalize(ObjSpaceViewDir(v.vertex));
 fixed dotProduct = 1 - saturate(dot(v.normal, viewDir));
 o.rimColor = smoothstep(1 - _FresnelWidth, 1.0, dotProduct) * .5f;
 o.screenPos = ComputeScreenPos(o.vertex);
 COMPUTE_EYEDEPTH(o.screenPos.z);//eye space depth of the vertex 
 return o;
 }
 
 fixed4 frag (v2f i,fixed face : VFACE) : SV_Target
 {
 //intersection
 fixed intersect = saturate((abs(LinearEyeDepth(tex2Dproj(_CameraDepthTexture,i.screenPos).r) - i.screenPos.z)) / _IntersectionThreshold);
 
 fixed3 main = tex2D(_MainTex, i.uv);
 //distortion
 i.screenPos.xy += (main.rg * 2 - 1) * _Distort * _GrabTexture_TexelSize.xy;
 fixed3 distortColor = tex2Dproj(_GrabTexture, i.screenPos);
 distortColor *= _MainColor * _MainColor.a + 1;
 
 //intersect hightlight
 i.rimColor *= intersect * clamp(0,1,face);
 main *= _MainColor * pow(_Fresnel,i.rimColor) ;
 
 //lerp distort color & fresnel color
 main = lerp(distortColor, main, i.rimColor.r);
 main += (1 - intersect) * (face > 0 ? .03:.3) * _MainColor * _Fresnel;
 return fixed4(main,.9);
 }
 ENDCG
 }
 }
 }
 


[1]: https://www.youtube.com/watch?time_continue=26&v=wbL2FCxlCe4

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
0

Answer by kmsjkh · Oct 11, 2018 at 08:10 AM

i wanna draw color on back face like front face. now back face color is just white

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

215 People are following this question.

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

Related Questions

Is it possible to set the 'ForceNoShadowCasting' SubShader Tag via shader properties or a custom material editor? 1 Answer

Help Please,Help Pease 0 Answers

Shader error in 'libS/Lit': redefinition of 'SurfaceData' at 0 Answers

Explain me this light-shader please 0 Answers

Sprite2D CG shader: No errors, but not displaying anything 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