DESKTOP-FB72PO8\Administrator 4 日 前
コミット
4d1b5be17d

+ 8 - 0
Assets/Art/ParallaxCloud.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 04a7af59a73055948b4982266af729c6
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Assets/Art/ParallaxCloud/Material.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 5ed033b920bd03040a02b76ce2500c4c
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 56 - 0
Assets/Art/ParallaxCloud/Material/ParallaxCloud.mat

@@ -0,0 +1,56 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+  serializedVersion: 8
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_Name: ParallaxCloud
+  m_Shader: {fileID: 4800000, guid: ab0e748bddb524e478aac18bf213d096, type: 3}
+  m_Parent: {fileID: 0}
+  m_ModifiedSerializedProperties: 0
+  m_ValidKeywords: []
+  m_InvalidKeywords:
+  - _PARALLAXTYPE_POM
+  m_LightmapFlags: 4
+  m_EnableInstancingVariants: 0
+  m_DoubleSidedGI: 0
+  m_CustomRenderQueue: 2950
+  stringTagMap: {}
+  disabledShaderPasses: []
+  m_LockedProperties: 
+  m_SavedProperties:
+    serializedVersion: 3
+    m_TexEnvs:
+    - _MainTex:
+        m_Texture: {fileID: 2800000, guid: 58718a051bb586b42a7dd166d366d188, type: 3}
+        m_Scale: {x: 3, y: 3}
+        m_Offset: {x: 0, y: 0}
+    - _MainTexTex:
+        m_Texture: {fileID: 2800000, guid: 6de99408d93ebf04c818192e09bae949, type: 3}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    - _NormalTex:
+        m_Texture: {fileID: 0}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    - _ParallaxTex:
+        m_Texture: {fileID: 0}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    m_Ints: []
+    m_Floats:
+    - _Alpha: 0.8
+    - _AlphaContrast: 0.5
+    - _AlphaExtent: 5
+    - _MoveSpeed: 0.15
+    - _ParallaxLayers: 35
+    - _ParallaxSize: 0.1
+    - _ParallaxType: 4
+    - _SteepParallax: 1
+    - _ViewOffset: 0
+    m_Colors:
+    - _Color: {r: 1, g: 1, b: 1, a: 1}
+  m_BuildTextureStacks: []

+ 8 - 0
Assets/Art/ParallaxCloud/Material/ParallaxCloud.mat.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 440486496c8724f4aacb57ab6f2cdd03
+NativeFormatImporter:
+  externalObjects: {}
+  mainObjectFileID: 2100000
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Assets/Art/ParallaxCloud/Prefabs.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 32125b751e34ed14396dbf80ee5ff01d
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 108 - 0
Assets/Art/ParallaxCloud/Prefabs/ParallaxCloud.prefab

@@ -0,0 +1,108 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &7608849421738120184
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 3767015184114747861}
+  - component: {fileID: 5843841681508080132}
+  - component: {fileID: 1198436925077352680}
+  - component: {fileID: 4506302662553476746}
+  m_Layer: 0
+  m_Name: ParallaxCloud
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &3767015184114747861
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7608849421738120184}
+  serializedVersion: 2
+  m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 20, y: 20, z: 20}
+  m_ConstrainProportionsScale: 1
+  m_Children: []
+  m_Father: {fileID: 0}
+  m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
+--- !u!33 &5843841681508080132
+MeshFilter:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7608849421738120184}
+  m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!23 &1198436925077352680
+MeshRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7608849421738120184}
+  m_Enabled: 1
+  m_CastShadows: 1
+  m_ReceiveShadows: 1
+  m_DynamicOccludee: 1
+  m_StaticShadowCaster: 0
+  m_MotionVectors: 1
+  m_LightProbeUsage: 1
+  m_ReflectionProbeUsage: 1
+  m_RayTracingMode: 2
+  m_RayTraceProcedural: 0
+  m_RenderingLayerMask: 1
+  m_RendererPriority: 0
+  m_Materials:
+  - {fileID: 2100000, guid: 440486496c8724f4aacb57ab6f2cdd03, type: 2}
+  m_StaticBatchInfo:
+    firstSubMesh: 0
+    subMeshCount: 0
+  m_StaticBatchRoot: {fileID: 0}
+  m_ProbeAnchor: {fileID: 0}
+  m_LightProbeVolumeOverride: {fileID: 0}
+  m_ScaleInLightmap: 1
+  m_ReceiveGI: 1
+  m_PreserveUVs: 0
+  m_IgnoreNormalsForChartDetection: 0
+  m_ImportantGI: 0
+  m_StitchLightmapSeams: 1
+  m_SelectedEditorRenderState: 3
+  m_MinimumChartSize: 4
+  m_AutoUVMaxDistance: 0.5
+  m_AutoUVMaxAngle: 89
+  m_LightmapParameters: {fileID: 0}
+  m_SortingLayerID: 0
+  m_SortingLayer: 0
+  m_SortingOrder: 0
+  m_AdditionalVertexStreams: {fileID: 0}
+--- !u!64 &4506302662553476746
+MeshCollider:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7608849421738120184}
+  m_Material: {fileID: 0}
+  m_IncludeLayers:
+    serializedVersion: 2
+    m_Bits: 0
+  m_ExcludeLayers:
+    serializedVersion: 2
+    m_Bits: 0
+  m_LayerOverridePriority: 0
+  m_IsTrigger: 0
+  m_ProvidesContacts: 0
+  m_Enabled: 1
+  serializedVersion: 5
+  m_Convex: 0
+  m_CookingOptions: 30
+  m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}

+ 7 - 0
Assets/Art/ParallaxCloud/Prefabs/ParallaxCloud.prefab.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: c3fdbd1922dbf5b4dafa882d98c4522e
+PrefabImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Assets/Art/ParallaxCloud/Shader.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 9f4eb090522c84240a339e4756b7edd0
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 118 - 0
Assets/Art/ParallaxCloud/Shader/ParallaxCloud.shader

@@ -0,0 +1,118 @@
+Shader "Custom/ParallaxCloud"
+{
+    Properties
+    {
+        _MainTex        ("BaseMap:基础贴图", 2D) = "white" {}
+        _Color          ("Color:颜色", Color) = (0.0, 0.0, 0.0, 1.0)
+        _ParallaxSize   ("ParallaxSize:视差映射强度", Range(0.0, 0.1)) = 0.0
+        _ParallaxLayers ("ParallaxLayers:视差映射层数",  Range(1.0, 50.0)) = 20
+        _MoveSpeed      ("MoveSpeed:移动速度", Range(-0.5, 0.5)) = 0.1
+        _Alpha          ("Alpha:透明度", Range(0, 1)) = 0.5
+        _AlphaExtent    ("AlphaExtent:透明对比度", Range(0.0, 5.0)) = 5.0
+    }
+    
+    SubShader
+    {
+        Tags       
+        { 
+            "RenderPipeline"="UniversalPipeline"
+            "Queue"="Transparent"
+            "RenderType"="Transparent"
+        }
+
+        Pass
+        {
+            Blend SrcAlpha OneMinusSrcAlpha
+            Cull off
+            
+            HLSLPROGRAM
+            #pragma vertex vert
+            #pragma fragment frag
+            #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
+            #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
+            
+            struct Attributes
+            {
+                float4 positionOS : POSITION;
+                float3 normalOS   : NORMAL;
+                float2 uv         : TEXCOORD0;
+                float4 tangent    : TANGENT;
+            };
+
+            struct Varyings
+            {
+                float4 positionCS : SV_POSITION;
+                float3 positionWS : TEXCOORD0;
+                float4 uv         : TEXCOORD1;
+                float3 nDirWS     : TEXCOORD2;
+                float3 tDirWS     : TEXCOORD3;
+                float3 bDirWS     : TEXCOORD4;
+            };
+
+            CBUFFER_START(UnityPerMaterial)
+            half4 _MainTex_ST;
+            half4 _Color;
+            half _ParallaxSize;
+            half _ParallaxLayers;
+            half _MoveSpeed;
+            half _Alpha;
+            half _AlphaExtent;
+            CBUFFER_END
+            TEXTURE2D(_MainTex); SAMPLER(sampler_MainTex);
+            TEXTURE2D(_NormalTex); SAMPLER(sampler_NormalTex);
+            TEXTURE2D(_ParallaxTex); SAMPLER(sampler_ParallaxTex);
+            
+            Varyings vert (Attributes v)
+            {
+                Varyings o;
+                o.positionCS = TransformObjectToHClip(v.positionOS.xyz);
+                o.positionWS = TransformObjectToWorld(v.positionOS.xyz);
+                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.zw = v.uv;
+                return o;
+            }
+
+            half4 frag (Varyings i) : SV_Target
+            {
+                //Light mylight = GetMainLight();
+                //half3 light = mylight.color;
+                float3x3 TBN = float3x3(i.tDirWS, i.bDirWS, i.nDirWS);
+                float3 vDir = normalize(i.positionWS - _WorldSpaceCameraPos.xyz);
+                float3 vDirTS = mul(TBN, vDir);
+                
+                float3 var_MainTex = SAMPLE_TEXTURE2D(_MainTex,sampler_MainTex,i.uv.zw).rgb;
+                
+                half2 offset = 0.0;
+                half currentDepth = 0.0;
+                half parallaxDepth = 0.0;
+                half preParallaxDepth = 0.0;
+                half heightStep = 1.0 / _ParallaxLayers;
+                half2 offsetTemp = vDirTS.xy / -vDirTS.z * _ParallaxSize;
+                for (int j = 0; j < _ParallaxLayers; j++)
+                {
+                    parallaxDepth = 1.0 - SAMPLE_TEXTURE2D_LOD(_MainTex, sampler_MainTex, i.uv.xy + offset, 0).r * var_MainTex.r;
+                    if (currentDepth > parallaxDepth) break;
+                    preParallaxDepth = parallaxDepth;
+                    currentDepth += heightStep;
+                    offset = offsetTemp * currentDepth;
+                }
+                half preDepth = currentDepth - heightStep;
+                half A_C = preDepth - preParallaxDepth;
+                half D_B = parallaxDepth - currentDepth;
+                half t = A_C / (D_B + A_C);
+                half height = lerp(preDepth, currentDepth, t);
+                offset += offsetTemp * height;
+                i.uv.xy += offset;
+                
+                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;
+                return half4(finalColor * _Color.rgb, alpha);
+            }
+            ENDHLSL
+        }
+    }
+}

+ 9 - 0
Assets/Art/ParallaxCloud/Shader/ParallaxCloud.shader.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ab0e748bddb524e478aac18bf213d096
+ShaderImporter:
+  externalObjects: {}
+  defaultTextures: []
+  nonModifiableTextures: []
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Assets/Art/ParallaxCloud/Texture.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 7bb4d13ee9c302b4dbe4d4e30a0c6673
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/Art/ParallaxCloud/Texture/ParallaxCloud.tga


+ 140 - 0
Assets/Art/ParallaxCloud/Texture/ParallaxCloud.tga.meta

@@ -0,0 +1,140 @@
+fileFormatVersion: 2
+guid: 58718a051bb586b42a7dd166d366d188
+TextureImporter:
+  internalIDToNameTable: []
+  externalObjects: {}
+  serializedVersion: 12
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 1
+    sRGBTexture: 1
+    linearTexture: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapsPreserveCoverage: 0
+    alphaTestReferenceValue: 0.5
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: 0.247
+    normalMapFilter: 1
+    flipGreenChannel: 0
+  isReadable: 0
+  streamingMipmaps: 0
+  streamingMipmapsPriority: 0
+  vTOnly: 0
+  ignoreMipmapLimit: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 6
+  cubemapConvolution: 0
+  seamlessCubemap: 0
+  textureFormat: 1
+  maxTextureSize: 2048
+  textureSettings:
+    serializedVersion: 2
+    filterMode: 1
+    aniso: 1
+    mipBias: 0
+    wrapU: 0
+    wrapV: 0
+    wrapW: 0
+  nPOTScale: 1
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 0
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spritePixelsToUnits: 100
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spriteGenerateFallbackPhysicsShape: 1
+  alphaUsage: 1
+  alphaIsTransparency: 0
+  spriteTessellationDetail: -1
+  textureType: 0
+  textureShape: 1
+  singleChannelComponent: 0
+  flipbookRows: 1
+  flipbookColumns: 1
+  maxTextureSizeSet: 0
+  compressionQualitySet: 0
+  textureFormatSet: 0
+  ignorePngGamma: 0
+  applyGammaDecoding: 0
+  swizzle: 50462976
+  cookieLightType: 0
+  platformSettings:
+  - serializedVersion: 3
+    buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 0
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    ignorePlatformSupport: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 3
+    buildTarget: Standalone
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    ignorePlatformSupport: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 3
+    buildTarget: iPhone
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    ignorePlatformSupport: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 3
+    buildTarget: Android
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    ignorePlatformSupport: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+    physicsShape: []
+    bones: []
+    spriteID: 
+    internalID: 0
+    vertices: []
+    indices: 
+    edges: []
+    weights: []
+    secondaryTextures: []
+    nameFileIdTable: {}
+  mipmapLimitGroupName: 
+  pSDRemoveMatte: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: