Migrate shaders to URP and add loading screen
Reworks multiple shaders and materials for URP compatibility and adds a Loading screen/scene and a few model imports. Key changes: - Converted ProBuilder standard vertex-color shader and several particle/surface shaders to URP HLSL passes (UniversalForward, ShadowCaster, Depth, DepthNormals) preserving base texture * tint * vertex color, normal map and PBR parameters. - Updated particle SurfaceShader_VC to a URP forward pass and simplified lighting to use URP shader library helpers. - Updated materials (landMark, tile) to point to project textures, adjust keywords/flags (e.g. XRMotionVectorsPass, disable ShadowCaster for one), tweak tiling and base color values. - Added a Loading screen UI (UXML, USS) and LoadingScreenController.cs plus a new Loading scene and scene metadata. - Imported new FBX assets (T-Pose, Untitled) and updated Editor build settings / project settings to include the new Loading scene. These changes migrate rendering code to the Universal Render Pipeline and add a basic loading UI/scene, while updating materials and project settings accordingly.
This commit is contained in:
@@ -1,61 +1,73 @@
|
||||
Shader "Custom/Glow Shader" {
|
||||
Properties {
|
||||
_Color ("Color", Color) = (1,1,1,1)
|
||||
_Size ("Atmosphere Size Multiplier", Range(0,16)) = 4
|
||||
_Rim ("Fade Power", Range(0,8)) = 4
|
||||
_Light ("Lighting Power", Range(0,10)) = 1.4
|
||||
_Ambient ("Ambient Power", Range (0,6)) = 0.8
|
||||
}
|
||||
SubShader {
|
||||
Tags { "RenderType"="Transparent" }
|
||||
LOD 200
|
||||
|
||||
Cull Front
|
||||
|
||||
CGPROGRAM
|
||||
// Physically based Standard lighting model, and enable shadows on all light types
|
||||
#pragma surface surf NegativeLambert fullforwardshadows alpha:fade
|
||||
#pragma vertex vert
|
||||
|
||||
// Use shader model 3.0 target, to get nicer looking lighting
|
||||
#pragma target 3.0
|
||||
|
||||
|
||||
struct Input {
|
||||
float3 viewDir;
|
||||
};
|
||||
|
||||
half _Size;
|
||||
half _Rim;
|
||||
half _Light;
|
||||
half _Ambient;
|
||||
fixed4 _Color;
|
||||
|
||||
void vert (inout appdata_full v) {
|
||||
v.vertex.xyz += v.vertex.xyz * _Size / 10;
|
||||
v.normal *= -1;
|
||||
}
|
||||
|
||||
half4 LightingNegativeLambert (SurfaceOutput s, half3 lightDir, half3 viewDir, half atten) {
|
||||
s.Normal = normalize (s.Normal);
|
||||
|
||||
half diff = max (0, dot (-s.Normal, lightDir)) * _Light + _Ambient;
|
||||
|
||||
half4 c;
|
||||
c.rgb = (s.Albedo * _LightColor0 * diff) * atten;
|
||||
c.a = s.Alpha;
|
||||
return c;
|
||||
}
|
||||
|
||||
void surf (Input IN, inout SurfaceOutput o) {
|
||||
half rim = saturate (dot (normalize (IN.viewDir), o.Normal));
|
||||
|
||||
// Albedo comes from a texture tinted by color
|
||||
fixed4 c = _Color;
|
||||
o.Albedo = c.rgb;
|
||||
o.Alpha = lerp (0, 1, pow (rim, _Rim));
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
Shader "Custom/URP_GlowShader"
|
||||
{
|
||||
Properties {
|
||||
_Color ("Color", Color) = (1,1,1,1)
|
||||
_Size ("Atmosphere Size Multiplier", Range(0,16)) = 4
|
||||
_Rim ("Fade Power", Range(0,8)) = 4
|
||||
_Light ("Lighting Power", Range(0,10)) = 1.4
|
||||
_Ambient ("Ambient Power", Range (0,6)) = 0.8
|
||||
}
|
||||
SubShader {
|
||||
Tags { "RenderType"="Transparent" }
|
||||
LOD 200
|
||||
Cull Front
|
||||
|
||||
Pass {
|
||||
Name "FORWARD"
|
||||
Tags { "LightMode" = "UniversalForward" }
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fog
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
struct Attributes {
|
||||
float4 positionOS : POSITION;
|
||||
float3 normalOS : NORMAL;
|
||||
};
|
||||
|
||||
struct Varyings {
|
||||
float4 positionHCS : SV_POSITION;
|
||||
float3 normalWS : TEXCOORD0;
|
||||
float3 viewDirWS : TEXCOORD1;
|
||||
float fogFactor : TEXCOORD2;
|
||||
};
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _Color;
|
||||
float _Size;
|
||||
float _Rim;
|
||||
float _Light;
|
||||
float _Ambient;
|
||||
CBUFFER_END
|
||||
|
||||
Varyings vert(Attributes IN)
|
||||
{
|
||||
Varyings OUT;
|
||||
float3 scaled = IN.positionOS.xyz + IN.positionOS.xyz * (_Size / 10.0);
|
||||
OUT.positionHCS = TransformObjectToHClip(scaled);
|
||||
float3 normalWS = TransformObjectToWorldNormal(-IN.normalOS); // Invert normal
|
||||
OUT.normalWS = normalWS;
|
||||
OUT.viewDirWS = normalize(_WorldSpaceCameraPos - TransformObjectToWorld(scaled));
|
||||
OUT.fogFactor = ComputeFogFactor(OUT.positionHCS.z / OUT.positionHCS.w);
|
||||
return OUT;
|
||||
}
|
||||
|
||||
float4 frag(Varyings IN) : SV_Target
|
||||
{
|
||||
float rim = saturate(dot(normalize(IN.viewDirWS), IN.normalWS));
|
||||
float alpha = lerp(0, 1, pow(rim, _Rim));
|
||||
|
||||
// Lighting: simple negative lambert
|
||||
float3 lightDir = normalize(_MainLightPosition.xyz);
|
||||
float diff = max(0, dot(-IN.normalWS, lightDir)) * _Light + _Ambient;
|
||||
float3 color = _Color.rgb * _MainLightColor.rgb * diff;
|
||||
color = MixFog(color, IN.fogFactor);
|
||||
return float4(color, alpha * _Color.a);
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
FallBack "Universal Forward"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user