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,47 +1,91 @@
|
||||
Shader "Custom/SurfaceShader_VC" {
|
||||
Properties{
|
||||
Shader "Custom/URP_SurfaceShader_VC"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Color("Color", Color) = (1,1,1,1)
|
||||
_MainTex("Albedo (RGB)", 2D) = "white" {}
|
||||
_Normal("Normap Map", 2D) = "bump" {}
|
||||
|
||||
_Normal("Normal Map", 2D) = "bump" {}
|
||||
}
|
||||
SubShader{
|
||||
Tags{ "Queue" = "Transparent" "RenderType" = "Transparent" }
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue" = "Transparent" "RenderType" = "Transparent" }
|
||||
LOD 200
|
||||
Blend One OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
// Physically based Standard lighting model, and enable shadows on all light types
|
||||
#pragma surface surf Standard fullforwardshadows vertex:vert alpha:fade
|
||||
Pass
|
||||
{
|
||||
Name "FORWARD"
|
||||
Tags { "LightMode" = "UniversalForward" }
|
||||
|
||||
// Use shader model 3.0 target, to get nicer looking lighting
|
||||
#pragma target 3.0
|
||||
HLSLPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fog
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
sampler2D _MainTex;
|
||||
sampler2D _Normal;
|
||||
struct Attributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
float3 normalOS : NORMAL;
|
||||
float4 tangentOS : TANGENT;
|
||||
};
|
||||
|
||||
struct Input {
|
||||
float2 uv_MainTex;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionHCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
float3 normalWS : TEXCOORD1;
|
||||
float3 tangentWS : TEXCOORD2;
|
||||
float3 bitangentWS : TEXCOORD3;
|
||||
float fogFactor : TEXCOORD4;
|
||||
};
|
||||
|
||||
void vert(inout appdata_full v, out Input o)
|
||||
{
|
||||
UNITY_INITIALIZE_OUTPUT(Input, o);
|
||||
o.color = v.color;
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _Color;
|
||||
CBUFFER_END
|
||||
|
||||
TEXTURE2D(_MainTex); SAMPLER(sampler_MainTex);
|
||||
TEXTURE2D(_Normal); SAMPLER(sampler_Normal);
|
||||
|
||||
Varyings vert(Attributes IN)
|
||||
{
|
||||
Varyings OUT;
|
||||
OUT.positionHCS = TransformObjectToHClip(IN.positionOS.xyz);
|
||||
OUT.uv = IN.uv;
|
||||
OUT.color = IN.color;
|
||||
float3 normalWS = TransformObjectToWorldNormal(IN.normalOS);
|
||||
float3 tangentWS = TransformObjectToWorldDir(IN.tangentOS.xyz);
|
||||
float3 bitangentWS = cross(normalWS, tangentWS) * IN.tangentOS.w;
|
||||
OUT.normalWS = normalWS;
|
||||
OUT.tangentWS = tangentWS;
|
||||
OUT.bitangentWS = bitangentWS;
|
||||
OUT.fogFactor = ComputeFogFactor(OUT.positionHCS.z / OUT.positionHCS.w);
|
||||
return OUT;
|
||||
}
|
||||
|
||||
float4 frag(Varyings IN) : SV_Target
|
||||
{
|
||||
float4 albedo = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, IN.uv) * _Color;
|
||||
float3 normalTS = UnpackNormal(SAMPLE_TEXTURE2D(_Normal, sampler_Normal, IN.uv));
|
||||
float3x3 TBN = float3x3(IN.tangentWS, IN.bitangentWS, IN.normalWS);
|
||||
float3 normalWS = normalize(mul(normalTS, TBN));
|
||||
|
||||
float3 viewDirWS = normalize(_WorldSpaceCameraPos - IN.positionHCS.xyz);
|
||||
float3 lightDirWS = normalize(_MainLightPosition.xyz);
|
||||
float3 lightColor = _MainLightColor.rgb;
|
||||
|
||||
float NdotL = saturate(dot(normalWS, lightDirWS));
|
||||
float3 diffuse = albedo.rgb * lightColor * NdotL * IN.color.rgb;
|
||||
|
||||
float alpha = albedo.a * IN.color.a;
|
||||
diffuse = MixFog(diffuse, IN.fogFactor);
|
||||
return float4(diffuse, alpha);
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
|
||||
fixed4 _Color;
|
||||
|
||||
void surf(Input IN, inout SurfaceOutputStandard o) {
|
||||
// Albedo comes from a texture tinted by color
|
||||
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
|
||||
o.Albedo = c.rgb*IN.color;
|
||||
o.Normal = UnpackNormal(tex2D(_Normal, IN.uv_MainTex));
|
||||
o.Alpha = c.a*IN.color.a;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
FallBack "Universal Forward"
|
||||
}
|
||||
Reference in New Issue
Block a user