гигантский ассет
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 999ff84feab59ad449040c1a6140f8c4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,85 @@
|
||||
%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: FearTentancles
|
||||
m_Shader: {fileID: 4800000, guid: 459ad7c08933e13408b64afd43c39890, 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:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: 8bde43d20b7e0c7459bf9cc43756e3f0, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
- _effectTim: 0
|
||||
- _effectTime: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a62baac1b3ccbb846bbf097579dbe395
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d504bce528fad9d4f875df206e27ccc1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,22 @@
|
||||
using UnityEngine.Rendering.Universal;
|
||||
using UnityEngine.Rendering;
|
||||
using System;
|
||||
|
||||
namespace UHFPS.Rendering
|
||||
{
|
||||
[Serializable, VolumeComponentMenu("UHFPS Post-Processing/Fear Tentacles")]
|
||||
public class FearTentancles : VolumeComponent, IPostProcessComponent
|
||||
{
|
||||
public ClampedFloatParameter EffectFade = new(0, 0f, 1f);
|
||||
public ClampedFloatParameter TentaclesPosition = new(0, -0.2f, 0.2f);
|
||||
public ClampedFloatParameter LayerPosition = new(0, -2f, 2f);
|
||||
public ClampedFloatParameter VignetteStrength = new(0, 0f, 1f);
|
||||
public ClampedFloatParameter TentaclesSpeed = new(1f, 0.1f, 3f);
|
||||
public ClampedIntParameter Tentacles = new(20, 10, 50);
|
||||
public BoolParameter TopLayer = new(false);
|
||||
|
||||
private bool State => active && EffectFade.overrideState;
|
||||
public bool IsActive() => State && EffectFade.value > 0f;
|
||||
public bool IsTileCompatible() => false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae89e52999c1da34594c7c0d00bc7512
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
using UnityEngine.Rendering.Universal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UHFPS.Rendering
|
||||
{
|
||||
public class FearTentanclesFeature : EffectFeature
|
||||
{
|
||||
public override string Name => "Fear Tentancles";
|
||||
|
||||
public RenderPassEvent RenderPassEvent = RenderPassEvent.AfterRenderingTransparents;
|
||||
public Material EffectMaterial;
|
||||
|
||||
public override void OnCreate()
|
||||
{
|
||||
RenderPass = new FearTentanclesPass(RenderPassEvent, EffectMaterial);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a127b1df1611524290014a7fdc35577
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,73 @@
|
||||
using UnityEngine.Rendering.Universal;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UHFPS.Rendering
|
||||
{
|
||||
public class FearTentanclesPass : ScriptableRenderPass
|
||||
{
|
||||
private static readonly int EffectTime = Shader.PropertyToID("_EffectTime");
|
||||
private static readonly int EffectFade = Shader.PropertyToID("_EffectFade");
|
||||
private static readonly int TentaclesPosition = Shader.PropertyToID("_TentaclesPosition");
|
||||
private static readonly int LayerPosition = Shader.PropertyToID("_LayerPosition");
|
||||
private static readonly int VignetteStrength = Shader.PropertyToID("_VignetteStrength");
|
||||
private static readonly int TentaclesNum = Shader.PropertyToID("_NumOfTentacles");
|
||||
private static readonly int TopLayer = Shader.PropertyToID("_ShowLayer");
|
||||
|
||||
private readonly Material m_Material;
|
||||
private RTHandle m_CameraTempColor;
|
||||
private float effectTime;
|
||||
|
||||
public FearTentanclesPass(RenderPassEvent renderPassEvent, Material material)
|
||||
{
|
||||
this.renderPassEvent = renderPassEvent;
|
||||
m_Material = material;
|
||||
}
|
||||
|
||||
public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
|
||||
{
|
||||
var colorDesc = renderingData.cameraData.cameraTargetDescriptor;
|
||||
colorDesc.depthBufferBits = 0;
|
||||
|
||||
RenderingUtils.ReAllocateIfNeeded(ref m_CameraTempColor, colorDesc, name: "_TemporaryColorTexture");
|
||||
}
|
||||
|
||||
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
|
||||
{
|
||||
if (m_Material == null) return;
|
||||
if (renderingData.cameraData.isSceneViewCamera) return;
|
||||
if (!renderingData.cameraData.postProcessEnabled) return;
|
||||
|
||||
VolumeStack stack = VolumeManager.instance.stack;
|
||||
FearTentancles fearTent = stack.GetComponent<FearTentancles>();
|
||||
|
||||
if (!fearTent.IsActive())
|
||||
{
|
||||
effectTime = 0f;
|
||||
return;
|
||||
}
|
||||
|
||||
m_Material.SetFloat(EffectTime, effectTime);
|
||||
m_Material.SetFloat(EffectFade, fearTent.EffectFade.value);
|
||||
m_Material.SetFloat(TentaclesPosition, fearTent.TentaclesPosition.value);
|
||||
m_Material.SetFloat(LayerPosition, fearTent.LayerPosition.value);
|
||||
m_Material.SetFloat(VignetteStrength, fearTent.VignetteStrength.value);
|
||||
m_Material.SetFloat(TentaclesNum, fearTent.Tentacles.value);
|
||||
m_Material.SetInteger(TopLayer, fearTent.TopLayer.value ? 1 : 0);
|
||||
effectTime += Time.deltaTime * fearTent.TentaclesSpeed.value;
|
||||
|
||||
var cmd = CommandBufferPool.Get();
|
||||
using (new ProfilingScope(cmd, new ProfilingSampler("FearTentacles")))
|
||||
{
|
||||
RTHandle camTarget = renderingData.cameraData.renderer.cameraColorTargetHandle;
|
||||
Blitter.BlitCameraTexture(cmd, camTarget, m_CameraTempColor, m_Material, 0);
|
||||
Blitter.BlitCameraTexture(cmd, m_CameraTempColor, camTarget);
|
||||
}
|
||||
|
||||
context.ExecuteCommandBuffer(cmd);
|
||||
cmd.Clear();
|
||||
|
||||
CommandBufferPool.Release(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd2fd2805e518414d91e081e875ca684
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b5b3de0a1f62fa4098e303586e1cbc1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,95 @@
|
||||
Shader "UHFPS/FearTentacles"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
ZWrite Off
|
||||
ZTest Always
|
||||
Blend Off
|
||||
Cull Off
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "FearTentacles"
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex Vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
|
||||
|
||||
TEXTURE2D(_CameraColorTexture);
|
||||
SAMPLER(sampler_CameraColorTexture);
|
||||
|
||||
float _EffectTime;
|
||||
float _EffectFade;
|
||||
float _TentaclesPosition;
|
||||
float _LayerPosition;
|
||||
float _VignetteStrength;
|
||||
int _NumOfTentacles;
|
||||
int _ShowLayer;
|
||||
|
||||
float rand(float2 n)
|
||||
{
|
||||
return frac(sin(dot(n, float2(12.9898, 4.1414))) * 43758.5453);
|
||||
}
|
||||
|
||||
float tent(float2 uv, float id)
|
||||
{
|
||||
float iTime = _EffectTime;
|
||||
float tentPos = clamp(_TentaclesPosition, -0.2, 0.2);
|
||||
float offset = tentPos * sign(uv.y - 0.5);
|
||||
float rv = rand(float2(id + sign(uv.y - 0.5), id));
|
||||
float2 st = uv;
|
||||
|
||||
uv.y += offset;
|
||||
uv.x += rv * 0.1;
|
||||
uv.y += 0.05;
|
||||
|
||||
float r = min(0.45 + _EffectFade * 0.02, 0.48) + (rv - 0.5) * 0.0;
|
||||
r += abs(uv.y - 0.5) * (0.1 + (rv - 0.5) * 0.05);
|
||||
|
||||
uv.x += sin(uv.y * (3.0 + rv) + iTime * rv * 2.0 + rv * 3.0 + id * 20.0) * (0.1 + (sin(rv) * 0.1) * 0.1);
|
||||
uv.x += uv.y * (rv - 0.5) * 0.4;
|
||||
uv.y += 0.05;
|
||||
uv.y += sin(uv.x * 20.0) * 0.05;
|
||||
uv.y += sin(st.x * rv * rv * 120.0 + iTime + rv + id) * 0.05 * rv;
|
||||
|
||||
float lay = 1.0;
|
||||
if (_ShowLayer)
|
||||
{
|
||||
uv.y -= offset;
|
||||
uv.y += _LayerPosition * sign(uv.y - 0.5);
|
||||
lay = lerp(1., 0.82, smoothstep(0.57, 0.6, abs(uv.y - 0.5)));
|
||||
}
|
||||
|
||||
return (1.0 - smoothstep(r, r - 0.05, abs(uv.x - 0.5) + 0.5)) * lay;
|
||||
}
|
||||
|
||||
half4 frag(Varyings input) : SV_Target
|
||||
{
|
||||
float4 color = SAMPLE_TEXTURE2D(_CameraColorTexture, sampler_CameraColorTexture, input.texcoord);
|
||||
float2 uv = input.texcoord;
|
||||
float s = 1.0;
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
if (i >= _NumOfTentacles) break;
|
||||
float2 randValue = float2(rand(float2(float(i), 0.0)) - 0.5, 0.01);
|
||||
s *= tent(uv + randValue, sin(float(i) * 200.0) * 2003.0);
|
||||
}
|
||||
|
||||
uv *= 1.0 - uv.yx;
|
||||
float vig = uv.x * uv.y * 5.0;
|
||||
vig = pow(vig, _EffectFade * _VignetteStrength);
|
||||
|
||||
s = lerp(1.0, s, _EffectFade);
|
||||
s *= vig;
|
||||
|
||||
return color * half4(s, s, s, 1.);
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 459ad7c08933e13408b64afd43c39890
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user