Kaynağa Gözat

修改shader

DESKTOP-FB72PO8\Administrator 5 gün önce
ebeveyn
işleme
578a3426b9

+ 5 - 5
Assets/Art/ParallaxCloud/Material/ParallaxCloud.mat

@@ -46,12 +46,12 @@ Material:
         m_Offset: {x: 0, y: 0}
     m_Ints: []
     m_Floats:
-    - _Alpha: 0.592
+    - _Alpha: 0.753
     - _AlphaContrast: 0.5
-    - _AlphaExtent: 2.92
-    - _MoveSpeed: 0.22
-    - _ParallaxLayers: 50
-    - _ParallaxSize: 0.1
+    - _AlphaExtent: 5
+    - _MoveSpeed: 0.15
+    - _ParallaxLayers: 12.6
+    - _ParallaxSize: 0.0753
     - _ParallaxType: 4
     - _SteepParallax: 1
     - _ViewOffset: 0

+ 7 - 2
Assets/Art/ParallaxCloud/Shader/ParallaxCloud.shader

@@ -77,7 +77,8 @@ Shader "Custom/ParallaxCloud"
                 o.nDirWS = TransformObjectToWorldNormal(v.normalOS);
                 o.tDirWS = normalize(TransformObjectToWorld(v.tangent.xyz));
                 o.bDirWS = normalize(cross(o.nDirWS, o.tDirWS) * v.tangent.w);
-                o.uv.xy = TRANSFORM_TEX(v.uv, _MainTex) + float2(frac(_Time.y * _MoveSpeed), 0.0);
+                // o.uv.xy = TRANSFORM_TEX(v.uv, _MainTex) + float2(frac(_Time.y * _MoveSpeed), 0.0);
+                 o.uv.xy=  o.positionWS.xz*0.06+ float2(frac(_Time.y * _MoveSpeed), 0.0);
                 o.uv.zw = v.uv;
                 o.screenPos = ComputeScreenPos(o.positionCS);
                 return o;
@@ -125,6 +126,10 @@ Shader "Custom/ParallaxCloud"
                 // return half4(dist * 0.1, 0, 0, 1.0);
                 dist = dist * 0.2;
                 dist = clamp(dist, 0, 1);
+
+                float ptcpos=length(i.positionWS-_WorldSpaceCameraPos);
+                ptcpos= 1-(ptcpos-100)/50;
+                ptcpos=clamp(ptcpos,0,1);
                 //Light mylight = GetMainLight();
                 //half3 light = mylight.color;
                 float3x3 TBN = float3x3(i.tDirWS, i.bDirWS, i.nDirWS);
@@ -158,7 +163,7 @@ Shader "Custom/ParallaxCloud"
 
                 half3 finalColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv.xy).rgb * var_MainTex.rgb;
                 float alphaTex = max(var_MainTex.r * finalColor.r, 0.0);
-                half alpha = max(pow(abs(lerp(alphaTex, 1.0, _Alpha)), _AlphaExtent), 0.0) * _Alpha * dist;
+                half alpha = max(pow(abs(lerp(alphaTex, 1.0, _Alpha)), _AlphaExtent), 0.0) * _Alpha * dist*ptcpos;
                 return half4(finalColor * _Color.rgb, alpha);
             }
             ENDHLSL

+ 15 - 11
Assets/Art/cs3.scene

@@ -79114,7 +79114,7 @@ Transform:
   m_GameObject: {fileID: 765246468}
   serializedVersion: 2
   m_LocalRotation: {x: 0.17195824, y: -0.13705875, z: 0.024167152, w: 0.9752237}
-  m_LocalPosition: {x: 3.3, y: 25.3, z: -9.13}
+  m_LocalPosition: {x: 3.3, y: 25.3, z: -16.3}
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children: []
@@ -79938,43 +79938,43 @@ PrefabInstance:
     m_Modifications:
     - target: {fileID: 3767015184114747861, guid: c3fdbd1922dbf5b4dafa882d98c4522e, type: 3}
       propertyPath: m_LocalScale.x
-      value: 179.05717
+      value: 200
       objectReference: {fileID: 0}
     - target: {fileID: 3767015184114747861, guid: c3fdbd1922dbf5b4dafa882d98c4522e, type: 3}
       propertyPath: m_LocalScale.y
-      value: 179.05717
+      value: 448.21585
       objectReference: {fileID: 0}
     - target: {fileID: 3767015184114747861, guid: c3fdbd1922dbf5b4dafa882d98c4522e, type: 3}
       propertyPath: m_LocalScale.z
-      value: 179.05717
+      value: 200
       objectReference: {fileID: 0}
     - target: {fileID: 3767015184114747861, guid: c3fdbd1922dbf5b4dafa882d98c4522e, type: 3}
       propertyPath: m_LocalPosition.x
-      value: -10.4
+      value: -10.399999
       objectReference: {fileID: 0}
     - target: {fileID: 3767015184114747861, guid: c3fdbd1922dbf5b4dafa882d98c4522e, type: 3}
       propertyPath: m_LocalPosition.y
-      value: 4.22
+      value: 2.7
       objectReference: {fileID: 0}
     - target: {fileID: 3767015184114747861, guid: c3fdbd1922dbf5b4dafa882d98c4522e, type: 3}
       propertyPath: m_LocalPosition.z
-      value: 60.65
+      value: 47.379997
       objectReference: {fileID: 0}
     - target: {fileID: 3767015184114747861, guid: c3fdbd1922dbf5b4dafa882d98c4522e, type: 3}
       propertyPath: m_LocalRotation.w
-      value: 0.7071068
+      value: 0.70710677
       objectReference: {fileID: 0}
     - target: {fileID: 3767015184114747861, guid: c3fdbd1922dbf5b4dafa882d98c4522e, type: 3}
       propertyPath: m_LocalRotation.x
-      value: 0.7071068
+      value: 0.7071069
       objectReference: {fileID: 0}
     - target: {fileID: 3767015184114747861, guid: c3fdbd1922dbf5b4dafa882d98c4522e, type: 3}
       propertyPath: m_LocalRotation.y
-      value: -0
+      value: 0.000000014901161
       objectReference: {fileID: 0}
     - target: {fileID: 3767015184114747861, guid: c3fdbd1922dbf5b4dafa882d98c4522e, type: 3}
       propertyPath: m_LocalRotation.z
-      value: -0
+      value: 0.0000000055879354
       objectReference: {fileID: 0}
     - target: {fileID: 3767015184114747861, guid: c3fdbd1922dbf5b4dafa882d98c4522e, type: 3}
       propertyPath: m_LocalEulerAnglesHint.x
@@ -79988,6 +79988,10 @@ PrefabInstance:
       propertyPath: m_LocalEulerAnglesHint.z
       value: 0
       objectReference: {fileID: 0}
+    - target: {fileID: 3767015184114747861, guid: c3fdbd1922dbf5b4dafa882d98c4522e, type: 3}
+      propertyPath: m_ConstrainProportionsScale
+      value: 0
+      objectReference: {fileID: 0}
     - target: {fileID: 7608849421738120184, guid: c3fdbd1922dbf5b4dafa882d98c4522e, type: 3}
       propertyPath: m_Name
       value: yunhai