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.
91 lines
2.6 KiB
Plaintext
91 lines
2.6 KiB
Plaintext
Shader "Custom/URP_SurfaceShader_VC"
|
|
{
|
|
Properties
|
|
{
|
|
_Color("Color", Color) = (1,1,1,1)
|
|
_MainTex("Albedo (RGB)", 2D) = "white" {}
|
|
_Normal("Normal Map", 2D) = "bump" {}
|
|
}
|
|
SubShader
|
|
{
|
|
Tags { "Queue" = "Transparent" "RenderType" = "Transparent" }
|
|
LOD 200
|
|
Blend One OneMinusSrcAlpha
|
|
|
|
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;
|
|
float2 uv : TEXCOORD0;
|
|
float4 color : COLOR;
|
|
float3 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
};
|
|
|
|
struct Varyings
|
|
{
|
|
float4 positionHCS : SV_POSITION;
|
|
float2 uv : TEXCOORD0;
|
|
float4 color : COLOR;
|
|
float3 normalWS : TEXCOORD1;
|
|
float3 tangentWS : TEXCOORD2;
|
|
float3 bitangentWS : TEXCOORD3;
|
|
float fogFactor : TEXCOORD4;
|
|
};
|
|
|
|
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
|
|
}
|
|
}
|
|
FallBack "Universal Forward"
|
|
} |