Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "WorldUV/Diffuse" {
- Properties {
- _Color ("Main Color", Color) = (1,1,1,1)
- _MainTex ("Base (RGB)", 2D) = "white" {}
- _Scale ("Texture Scale", Float) = 1
- }
- SubShader {
- Tags { "RenderType"="Opaque" }
- LOD 200
- CGPROGRAM
- #pragma surface surf Lambert
- sampler2D _MainTex;
- fixed4 _Color;
- float _Scale;
- struct Input {
- float3 worldNormal;
- float3 worldPos;
- };
- void surf (Input IN, inout SurfaceOutput o) {
- float2 uv;
- if (abs(IN.worldNormal.x) > 0.5) {
- uv = IN.worldPos.yz;
- } else if (abs(IN.worldNormal.z) > 0.5) {
- uv = IN.worldPos.xy;
- } else {
- uv = IN.worldPos.xz;
- }
- fixed4 c = tex2D(_MainTex, uv * _Scale) * _Color;
- o.Albedo = c.rgb;
- o.Alpha = c.a;
- }
- ENDCG
- }
- Fallback "VertexLit"
- }
Advertisement
Add Comment
Please, Sign In to add comment