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.

23 lines
433 B

  1. Shader "Hidden/WorldPosInputsNode"
  2. {
  3. SubShader
  4. {
  5. Pass
  6. {
  7. CGPROGRAM
  8. #pragma vertex vert_img
  9. #pragma fragment frag
  10. #include "UnityCG.cginc"
  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 vertexPos = float3(xy, z);
  16. float3 worldPos = mul(unity_ObjectToWorld, vertexPos).xyz;
  17. return float4 (worldPos, 1);
  18. }
  19. ENDCG
  20. }
  21. }
  22. }