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.

22 lines
375 B

  1. Shader "Hidden/NormalVertexDataNode"
  2. {
  3. SubShader
  4. {
  5. Pass
  6. {
  7. CGPROGRAM
  8. #include "UnityCG.cginc"
  9. #pragma vertex vert_img
  10. #pragma fragment frag
  11. float4 frag(v2f_img i) : SV_Target
  12. {
  13. float2 xy = 2 * i.uv - 1;
  14. float z = -sqrt(1-saturate(dot(xy,xy)));
  15. float3 normal = normalize(float3(xy, z));
  16. return float4(normal, 1);
  17. }
  18. ENDCG
  19. }
  20. }
  21. }