Grass Cutters Together: the project as of moon-sweepers f3666f0
A clean start for the shared repository: the Unity project (Assets, Packages, ProjectSettings), ArtSource, Docs and Tools as they stood at f3666f0 in the old local repository, with its generated prefabs and scene brought up to date. Images, audio, models and binaries go through Git LFS (.gitattributes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
64
Assets/Shaders/Beam.shader
Normal file
64
Assets/Shaders/Beam.shader
Normal file
@ -0,0 +1,64 @@
|
||||
// The saucer's tractor beam: a see-through cone, bright at its edges, with rings of light climbing it toward the ship.
|
||||
// Additive, no depth: what's being lifted shows inside it.
|
||||
Shader "GrassCutter/Beam"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_BaseColor ("Colour", Color) = (0.45, 1, 0.8, 0.3)
|
||||
_Power ("Power", Float) = 1
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType" = "Transparent" "Queue" = "Transparent+10" "RenderPipeline" = "UniversalPipeline" "IgnoreProjector" = "True" }
|
||||
Pass
|
||||
{
|
||||
Name "Beam"
|
||||
Tags { "LightMode" = "UniversalForward" }
|
||||
Blend SrcAlpha One
|
||||
ZWrite Off
|
||||
Cull Off
|
||||
HLSLPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _BaseColor;
|
||||
float _Power;
|
||||
CBUFFER_END
|
||||
|
||||
struct Attributes { float4 positionOS : POSITION; float3 normalOS : NORMAL; float2 uv : TEXCOORD0; };
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionCS : SV_POSITION;
|
||||
float3 normalWS : TEXCOORD0;
|
||||
float3 positionWS : TEXCOORD1;
|
||||
float2 uv : TEXCOORD2;
|
||||
};
|
||||
|
||||
Varyings vert(Attributes v)
|
||||
{
|
||||
Varyings o;
|
||||
o.positionWS = TransformObjectToWorld(v.positionOS.xyz);
|
||||
o.positionCS = TransformWorldToHClip(o.positionWS);
|
||||
o.normalWS = TransformObjectToWorldNormal(v.normalOS);
|
||||
o.uv = v.uv;
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag(Varyings i) : SV_Target
|
||||
{
|
||||
float3 view = normalize(GetCameraPositionWS() - i.positionWS);
|
||||
float facing = abs(dot(normalize(i.normalWS), view));
|
||||
float rim = pow(1 - facing, 1.6);
|
||||
// v runs 0 at the ground to 1 at the ship
|
||||
float v = i.uv.y;
|
||||
float climb = smoothstep(0.75, 1, frac(v * 7 - _Time.y * 1.1));
|
||||
float streak = 0.5 + 0.5 * sin(i.uv.x * 6.2831 * 9 + _Time.y * 2.0);
|
||||
float fadeEnds = smoothstep(0, 0.12, v) * smoothstep(1, 0.85, v);
|
||||
float a = (_BaseColor.a * (0.35 + rim * 0.9) + climb * 0.35 + streak * 0.06) * fadeEnds * _Power;
|
||||
return float4(_BaseColor.rgb * (1 + climb), saturate(a));
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user