Création d'un petit party-game anonyme de Build + Bagar sous Unity
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wMaillageShader.shader 1.1KB

123456789101112131415161718192021222324252627282930313233343536
  1. Shader "Custom/wMaillageShader"
  2. {
  3. Properties
  4. {
  5. _InnerColor("Inner Color", Color) = (0.0, 0.0, 0.0, 0.5)
  6. _RimColor("Rim Color", Color) = (1.0,1.0,1.0,0.5)
  7. _RimPower("Rim Power", Range(0.5,8.0)) = 2.47
  8. }
  9. SubShader
  10. {
  11. Tags { "Queue" = "Transparent" }
  12. Cull Off ZWrite Off ZTest Less
  13. //Blend based on output Alpha, not color value
  14. Blend One OneMinusSrcAlpha
  15. CGPROGRAM
  16. #pragma surface surf Lambert alpha:fade
  17. struct Input
  18. {
  19. float3 viewDir;
  20. };
  21. float4 _InnerColor;
  22. float4 _RimColor;
  23. float _RimPower;
  24. void surf(Input IN, inout SurfaceOutput o)
  25. {
  26. half rim = 1.0 - saturate(dot(normalize(IN.viewDir), o.Normal));
  27. rim = pow(rim, _RimPower);
  28. //Shift inner color to rim color by rim value adjusted by _InnerColor transparency to reduce its effect
  29. //on semi-transparent part of rim color the more transparent inner color becomes.
  30. o.Emission = lerp(_InnerColor.rgb, _RimColor.rgb, saturate(rim + (1 - _InnerColor.a) - (1 - _RimColor.a)));
  31. o.Alpha = lerp(_InnerColor.a, _RimColor.a, rim);
  32. }
  33. ENDCG
  34. }
  35. Fallback "Diffuse"
  36. }