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,80 +1,83 @@
|
||||
Shader "Custom/Transparent Diffuse Stipple" {
|
||||
Shader "Custom/URP Transparent Diffuse" {
|
||||
Properties {
|
||||
_MainTex("Base (RGB)", 2D) = "white" { }
|
||||
_Color("Main Color", Color) = (1, 1, 1, 1)
|
||||
_Glossiness ("Smoothness", Range(0,1)) = 0.5
|
||||
_Metallic ("Metallic", Range(0,1)) = 0.0
|
||||
|
||||
_BumpMap ("Normalmap", 2D) = "bump" {}
|
||||
|
||||
_MainTex("Base (RGB)", 2D) = "white" {}
|
||||
_Color("Main Color", Color) = (1,1,1,1)
|
||||
_Glossiness("Smoothness", Range(0,1)) = 0.5
|
||||
_Metallic("Metallic", Range(0,1)) = 0.0
|
||||
_BumpMap("Normalmap", 2D) = "bump" {}
|
||||
_TransparentAmount("Transparent Amount", Float) = 1
|
||||
_StippleSize("Stipple Size", Float) = 1
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="Opaque" }
|
||||
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
|
||||
LOD 200
|
||||
Cull Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
Pass {
|
||||
Name "FORWARD"
|
||||
HLSLPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fog
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma surface surf Standard fullforwardshadows
|
||||
struct Attributes {
|
||||
float4 positionOS : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float2 uv2 : TEXCOORD1;
|
||||
float3 normalOS : NORMAL;
|
||||
float4 tangentOS : TANGENT;
|
||||
};
|
||||
|
||||
#pragma target 3.0
|
||||
struct Varyings {
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float2 uv2 : TEXCOORD1;
|
||||
float3 normalWS : TEXCOORD2;
|
||||
float4 screenPos : TEXCOORD3;
|
||||
float3 tangentWS : TEXCOORD4;
|
||||
float3 bitangentWS : TEXCOORD5;
|
||||
};
|
||||
|
||||
float _TransparentAmount;
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _MainTex_ST;
|
||||
float4 _Color;
|
||||
float _Glossiness;
|
||||
float _Metallic;
|
||||
float _TransparentAmount;
|
||||
float _StippleSize;
|
||||
CBUFFER_END
|
||||
|
||||
sampler2D _MainTex;
|
||||
TEXTURE2D(_MainTex); SAMPLER(sampler_MainTex);
|
||||
TEXTURE2D(_BumpMap); SAMPLER(sampler_BumpMap);
|
||||
|
||||
fixed4 _Color;
|
||||
Varyings vert(Attributes IN) {
|
||||
Varyings OUT;
|
||||
OUT.positionCS = TransformObjectToHClip(IN.positionOS.xyz);
|
||||
OUT.uv = TRANSFORM_TEX(IN.uv, _MainTex);
|
||||
OUT.uv2 = IN.uv2;
|
||||
OUT.normalWS = TransformObjectToWorldNormal(IN.normalOS);
|
||||
OUT.tangentWS = TransformObjectToWorldDir(IN.tangentOS.xyz);
|
||||
OUT.bitangentWS = cross(OUT.normalWS, OUT.tangentWS) * IN.tangentOS.w;
|
||||
OUT.screenPos = ComputeScreenPos(OUT.positionCS);
|
||||
return OUT;
|
||||
}
|
||||
|
||||
sampler2D _BumpMap;
|
||||
float4 frag(Varyings IN) : SV_Target {
|
||||
float4 albedo = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, IN.uv) * _Color;
|
||||
float3 normalTS = UnpackNormal(SAMPLE_TEXTURE2D(_BumpMap, sampler_BumpMap, IN.uv));
|
||||
float3x3 TBN = float3x3(normalize(IN.tangentWS), normalize(IN.bitangentWS), normalize(IN.normalWS));
|
||||
float3 normalWS = mul(normalTS, TBN);
|
||||
|
||||
float _StippleSize;
|
||||
float alpha = albedo.a * _TransparentAmount;
|
||||
if (alpha <= 0.01)
|
||||
discard;
|
||||
|
||||
half _Glossiness;
|
||||
half _Metallic;
|
||||
|
||||
static const float4x4 kThresholdMatrix = {
|
||||
1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
|
||||
13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
|
||||
4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
|
||||
16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
|
||||
};
|
||||
|
||||
static const float4x4 kKernelMatrix = {
|
||||
1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1
|
||||
};
|
||||
|
||||
struct Input {
|
||||
float2 uv_MainTex;
|
||||
float4 screenPos;
|
||||
float3 worldPos;
|
||||
float2 uv_BumpMap;
|
||||
};
|
||||
|
||||
void surf (Input IN, inout SurfaceOutputStandard o) {
|
||||
fixed4 c = tex2D(_MainTex, IN.uv_MainTex)* _Color;
|
||||
o.Albedo = c.rgb;
|
||||
o.Alpha = c.a;
|
||||
o.Metallic = _Metallic;
|
||||
o.Smoothness = _Glossiness;
|
||||
|
||||
o.Normal = UnpackNormal (tex2D (_BumpMap, IN.uv_BumpMap));
|
||||
|
||||
// Unproject the screen pixel coordiante
|
||||
float2 pos = IN.screenPos.xy / IN.screenPos.w;
|
||||
pos *= _ScreenParams.xy * _StippleSize;
|
||||
|
||||
// Clip pixel within [start, end] distance from camera
|
||||
float interpDist = _TransparentAmount;
|
||||
|
||||
clip(interpDist - kThresholdMatrix[fmod(pos.x, 4)] * kKernelMatrix[fmod(pos.y, 4)]);
|
||||
float3 color = albedo.rgb;
|
||||
return float4(color, alpha);
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
FallBack "Universal Forward"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user