增加传送门
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:yousandi.cn,2023:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: AbyssGlowParticle
|
||||
m_Shader: {fileID: 4800000, guid: c62986c87719ae348afc32aa8dfe400e, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs: []
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _Intensity: 1
|
||||
- _Softness: 0.5
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 0.85, b: 0.39999998, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: XXIbty//BX1SAgTqAU97n/nAu+Rz/In1iGyMIA/9ERz7UbZw7vJKAx8=
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -31,7 +31,7 @@ Material:
|
||||
- _EchoRadius: 39.41617
|
||||
- _EchoWidth: 2.5
|
||||
- _LightSoftness: 1
|
||||
- _MinBrightness: 0
|
||||
- _MinBrightness: 1
|
||||
m_Colors:
|
||||
- _DarknessColor: {r: 0.01, g: 0.01, b: 0.02, a: 1}
|
||||
- _EchoCenter: {r: -2.4399998, g: -1.5000057, b: 0, a: 0}
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
Shader "IndianOcean/PortalVortex"
|
||||
{
|
||||
// 传送门旋涡 Shader
|
||||
// 顺时针旋转 + 中心扭曲 + 发光效果
|
||||
// 基于 URP 管线
|
||||
Properties
|
||||
{
|
||||
_MainTex ("主贴图", 2D) = "white" {}
|
||||
_RotationSpeed ("旋转速度", Range(-5.0, 5.0)) = 1.5
|
||||
_VortexStrength ("扭曲强度", Range(0.0, 3.0)) = 1.0
|
||||
_CenterGlow ("中心发光强度", Range(0.0, 3.0)) = 1.5
|
||||
_Color ("色调", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"RenderType" = "Transparent"
|
||||
"Queue" = "Transparent"
|
||||
"RenderPipeline" = "UniversalPipeline"
|
||||
}
|
||||
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ZWrite Off
|
||||
ZTest LEqual
|
||||
Cull Off
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "PortalVortex"
|
||||
HLSLPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _MainTex_ST;
|
||||
float _RotationSpeed;
|
||||
float _VortexStrength;
|
||||
float _CenterGlow;
|
||||
float4 _Color;
|
||||
CBUFFER_END
|
||||
|
||||
TEXTURE2D(_MainTex);
|
||||
SAMPLER(sampler_MainTex);
|
||||
|
||||
Varyings vert(Attributes input)
|
||||
{
|
||||
Varyings output;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_TRANSFER_INSTANCE_ID(input, output);
|
||||
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
|
||||
output.uv = TRANSFORM_TEX(input.uv, _MainTex);
|
||||
return output;
|
||||
}
|
||||
|
||||
half4 frag(Varyings input) : SV_Target
|
||||
{
|
||||
// UV 中心点
|
||||
float2 center = float2(0.5, 0.5);
|
||||
float2 uvOffset = input.uv - center;
|
||||
|
||||
// 极坐标:距离和角度
|
||||
float dist = length(uvOffset);
|
||||
float angle = atan2(uvOffset.y, uvOffset.x);
|
||||
|
||||
// 顺时针旋转:角度减去时间 * 速度
|
||||
float rotation = _Time.y * _RotationSpeed;
|
||||
|
||||
// 扭曲强度随距离减小(中心扭曲更大)
|
||||
float twist = _VortexStrength * (1.0 - dist * 2.0);
|
||||
twist = max(twist, 0.0);
|
||||
|
||||
// 应用旋转 + 扭曲
|
||||
float finalAngle = angle - rotation - twist * 3.14159;
|
||||
|
||||
// 转换回 UV 坐标
|
||||
float2 vortexUV = center + float2(
|
||||
cos(finalAngle) * dist,
|
||||
sin(finalAngle) * dist
|
||||
);
|
||||
|
||||
// 采样主贴图
|
||||
half4 texColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, vortexUV);
|
||||
|
||||
// 中心发光:距离中心越近越亮
|
||||
float glow = _CenterGlow * (1.0 - dist * 2.0);
|
||||
glow = max(glow, 0.0);
|
||||
|
||||
// 边缘柔和过渡
|
||||
float edgeFade = 1.0 - smoothstep(0.35, 0.5, dist);
|
||||
|
||||
// 最终颜色 = 贴图色 + 中心发光 * 蓝色调
|
||||
float3 glowColor = float3(0.2, 0.6, 1.0) * glow;
|
||||
float3 finalColor = texColor.rgb * _Color.rgb + glowColor;
|
||||
|
||||
float alpha = texColor.a * edgeFade;
|
||||
|
||||
return half4(finalColor, alpha);
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
FallBack Off
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: W3gaty2qUX7f0tL/iyOZSNUdavcJjntKwh1MTVvBLW4v8vv/iuAopOE=
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user