Merge branch 'main' of http://212.24.110.183:3000/IPSEITY/Unheimlich_POC
This commit is contained in:
@@ -37,6 +37,10 @@ Material:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _SampleTexture2D_45427f0cc3994257be048fc580e65bba_Texture_1_Texture2D:
|
||||
m_Texture: {fileID: 2800000, guid: dffef66376be4fa480fb02b19edbe903, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_Lightmaps:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
@@ -54,12 +58,17 @@ Material:
|
||||
- _Debug: 0
|
||||
- _Demo: 0
|
||||
- _IgnoreAtten: 1
|
||||
- _Intendity: 0.828
|
||||
- _Intensity: 1
|
||||
- _Noise: 0.786
|
||||
- _QueueControl: 0
|
||||
- _QueueOffset: 0
|
||||
- _Size: 1
|
||||
- _Speed: 2
|
||||
- _Stop: 1
|
||||
- _UV: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 11.984315, g: 8.690491, b: 3.2428153, a: 0.07058824}
|
||||
- _Color: {r: 2, g: 1.3822709, b: 0.7329843, a: 0.09803922}
|
||||
- _Direction: {r: 0, g: 0, b: 1, a: 0}
|
||||
- _Size: {r: 3, g: 1, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,16 +1,96 @@
|
||||
void Facing_float(float3 ObjectPos, float3 Origin, float3 InUp, uint Orthographic, out float3 FacingWorldPos, out float3 FacingObjectPos, out float3 Right, out float3 Up, out float3 Forward)
|
||||
#include "Assets/_Content/Shaders/Include/Noises.hlsl"
|
||||
|
||||
float2 WorldToScreenUV(float3 posWS)
|
||||
{
|
||||
float3 origin = TransformObjectToWorld(float3(0, 0, 0));
|
||||
float3 view = lerp(normalize(origin - _WorldSpaceCameraPos.xyz), GetViewForwardDir(), Orthographic);
|
||||
|
||||
Up = normalize(InUp);
|
||||
Right = normalize(cross(Up, view));
|
||||
Forward = cross(Right, Up);
|
||||
|
||||
FacingWorldPos = Origin;
|
||||
FacingWorldPos += ObjectPos.x * length(TransformObjectToWorld(float3(1, 0, 0)) - origin) * Right;
|
||||
FacingWorldPos += ObjectPos.y * length(TransformObjectToWorld(float3(0, 1, 0)) - origin) * Up;
|
||||
FacingWorldPos += ObjectPos.z * length(TransformObjectToWorld(float3(0, 0, 1)) - origin) * Forward;
|
||||
|
||||
FacingObjectPos = TransformWorldToObject(FacingWorldPos);
|
||||
float4 clip = TransformWorldToHClip(posWS);
|
||||
float2 ndc = clip.xy / clip.w; // [-1, 1]
|
||||
return ndc * .5 + .5; // [0, 1]
|
||||
}
|
||||
|
||||
float3 GetBillboardPositionWS(float3 PositionOS, float3 PivotWS, float3 ViewDirWS)
|
||||
{
|
||||
float3 upWS = normalize(TransformObjectToWorldDir(float3(0, 1, 0)));
|
||||
|
||||
float3 rightWS = cross(upWS, ViewDirWS);
|
||||
|
||||
if (dot(rightWS, rightWS) < 1e-5)
|
||||
rightWS = normalize(TransformObjectToWorldDir(float3(1, 0, 0)));
|
||||
else
|
||||
rightWS = normalize(rightWS);
|
||||
|
||||
float3 forwardWS = normalize(cross(rightWS, upWS));
|
||||
|
||||
return PivotWS + PositionOS.x * rightWS + PositionOS.y * upWS + PositionOS.z * forwardWS;
|
||||
}
|
||||
|
||||
float3 ApplayerTaperAndScale(float3 PositionOS, float3 Scale)
|
||||
{
|
||||
float taper = lerp(1, Scale.z, saturate(PositionOS.y));
|
||||
|
||||
float3 p = PositionOS;
|
||||
p.xy *= Scale.xy;
|
||||
p.x *= taper;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void Ray_float
|
||||
(
|
||||
float Size,
|
||||
float Speed,
|
||||
float Intensity,
|
||||
float4 Color,
|
||||
float3 PositionOS,
|
||||
float4 ScreenPos,
|
||||
uint Orthographic,
|
||||
float UvDebug,
|
||||
out float3 OutPosition,
|
||||
out float3 OutColor
|
||||
)
|
||||
{
|
||||
float3 pivot = TransformObjectToWorld(float3(0, 0, 0));
|
||||
|
||||
float3 scale = float3
|
||||
(
|
||||
length(TransformObjectToWorld(float3(1, 0, 0)) - pivot),
|
||||
length(TransformObjectToWorld(float3(0, 1, 0)) - pivot),
|
||||
length(TransformObjectToWorld(float3(0, 0, 1)) - pivot)
|
||||
);
|
||||
|
||||
float3 viewDir = lerp(normalize(pivot - _WorldSpaceCameraPos.xyz), GetViewForwardDir(), Orthographic);
|
||||
|
||||
float3 pOS_0 = ApplayerTaperAndScale(PositionOS, scale);
|
||||
float3 pOS_1 = ApplayerTaperAndScale(float3( .5, PositionOS.y, 0), scale);
|
||||
float3 pOS_2 = ApplayerTaperAndScale(float3(-.5, PositionOS.y, 0), scale);
|
||||
|
||||
float3 pWS_0 = GetBillboardPositionWS(pOS_0, pivot, viewDir);
|
||||
float3 pWS_1 = GetBillboardPositionWS(pOS_1, pivot, viewDir);
|
||||
float3 pWS_2 = GetBillboardPositionWS(pOS_2, pivot, viewDir);
|
||||
|
||||
float2 pSC_0 = ScreenPos.xy;
|
||||
float2 pSC_1 = WorldToScreenUV(pWS_1);
|
||||
float2 pSC_2 = WorldToScreenUV(pWS_2);
|
||||
|
||||
float2 uv = float2(distance(pSC_0.x, pSC_2.x) / distance(pSC_1.x, pSC_2.x), pOS_0.y / scale.y);
|
||||
|
||||
float mask = smoothstep(1, .2, abs(uv.x * 2 - 1));
|
||||
mask *= smoothstep(0, .1, uv.y);
|
||||
mask *= pow(smoothstep(1, .3, uv.y * .95), 2);
|
||||
mask *= smoothstep(1, .98, dot(-viewDir, normalize(TransformObjectToWorldDir(float3(0, 1, 0)))));
|
||||
|
||||
float noise = 1;
|
||||
if (Intensity > 0)
|
||||
{
|
||||
float3 noisePos = pivot;
|
||||
noisePos += float3(uv.x - .5, 0 /*uv.y * .05 / scale.x*/, _Time.y / scale.x / scale.z / Size * Speed * .2);
|
||||
|
||||
noise = SimplexNoise3D(noisePos, scale.x * scale.z * Size);
|
||||
noise = lerp(1, noise, Intensity);
|
||||
}
|
||||
|
||||
OutPosition = TransformWorldToObject(pWS_0);
|
||||
OutColor = saturate(noise * mask) * Color.rgb * Color.a;
|
||||
|
||||
if (UvDebug > 0)
|
||||
OutColor = lerp(OutColor, float3(uv, 0), UvDebug);
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user