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:
Robii Aragon
2026-02-23 21:47:59 -08:00
parent 31ada61565
commit 0e961ba4b1
37 changed files with 2867 additions and 1155 deletions

View File

@@ -1,109 +1,223 @@
Shader "Outlined/Diffuse" {
Properties {
_Color ("Main Color", Color) = (.5,.5,.5,1)
_OutlineColor ("Outline Color", Color) = (0,0,0,1)
_Outline ("Outline width", Range (0, 1)) = .1
_MainTex ("Base (RGB)", 2D) = "white" { }
}
CGINCLUDE
#include "UnityCG.cginc"
struct appdata {
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f {
float4 pos : POSITION;
float4 color : COLOR;
};
uniform float _Outline;
uniform float4 _OutlineColor;
v2f vert(appdata v) {
// just make a copy of incoming vertex data but scaled according to normal direction
v2f o;
Shader "Custom/URP_Outline_Lit"
{
Properties
{
[Header(Main)]
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Color ("Base Color", Color) = (1,1,1,1)
v.vertex *= ( 1 + _Outline);
[Header(Outline)]
_OutlineColor ("Outline Color", Color) = (0,0,0,1)
_OutlineWidth ("Outline Width", Range(0, 0.2)) = 0.02
}
o.pos = UnityObjectToClipPos(v.vertex);
//float3 norm = normalize(mul ((float3x3)UNITY_MATRIX_IT_MV, v.normal));
//float2 offset = TransformViewToProjection(norm.xy);
SubShader
{
// CAMBIO 1: Cambiamos a Opaque para que reciba sombras correctamente
Tags
{
"RenderType" = "Opaque"
"RenderPipeline" = "UniversalPipeline"
"Queue" = "Geometry"
}
o.color = _OutlineColor;
return o;
}
ENDCG
SubShader {
//Tags {"Queue" = "Geometry+100" }
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
fixed4 _Color;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
// note that a vertex shader is specified here but its using the one above
Pass {
Name "OUTLINE"
Tags { "LightMode" = "Always" }
Cull Front
ZWrite On
ColorMask RGB
Blend SrcAlpha OneMinusSrcAlpha
//Offset 50,50
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
half4 frag(v2f i) :COLOR { return i.color; }
ENDCG
}
}
SubShader {
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
fixed4 _Color;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
Pass {
Name "OUTLINE"
Tags { "LightMode" = "Always" }
Cull Front
ZWrite On
ColorMask RGB
Blend SrcAlpha OneMinusSrcAlpha
SetTexture [_MainTex] { combine primary }
}
}
Fallback "Diffuse"
// ─────────────────────────────────────────────────────────────
// PASS 1 Main (Tu código original)
// ─────────────────────────────────────────────────────────────
Pass
{
Name "ForwardLit"
Tags { "LightMode" = "UniversalForward" }
Cull Back
ZWrite On
ZTest LEqual
// CAMBIO 2: Desactivamos la transparencia del material principal
Blend One Zero
// Tu lógica perfecta de Stencil para que el outline no se raye por dentro
Stencil
{
Ref 1
Comp Always
Pass Replace
}
HLSLPROGRAM
#pragma vertex MainVert
#pragma fragment MainFrag
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
#pragma multi_compile_fragment _ _SHADOWS_SOFT
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
TEXTURE2D(_MainTex);
SAMPLER(sampler_MainTex);
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_ST;
float4 _Color;
float4 _OutlineColor;
float _OutlineWidth;
CBUFFER_END
struct Attributes
{
float4 positionOS : POSITION;
float3 normalOS : NORMAL;
float2 uv : TEXCOORD0;
};
struct Varyings
{
float4 positionHCS : SV_POSITION;
float3 positionWS : TEXCOORD1;
float3 normalWS : NORMAL;
float2 uv : TEXCOORD0;
};
Varyings MainVert(Attributes IN)
{
Varyings OUT;
OUT.positionHCS = TransformObjectToHClip(IN.positionOS.xyz);
OUT.positionWS = TransformObjectToWorld(IN.positionOS.xyz);
OUT.normalWS = TransformObjectToWorldNormal(IN.normalOS);
OUT.uv = TRANSFORM_TEX(IN.uv, _MainTex);
return OUT;
}
half4 MainFrag(Varyings IN) : SV_Target
{
half4 albedo = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, IN.uv) * _Color;
float4 shadowCoord = TransformWorldToShadowCoord(IN.positionWS);
Light mainLight = GetMainLight(shadowCoord);
half NdotL = saturate(dot(normalize(IN.normalWS), mainLight.direction));
half3 diffuse = mainLight.color * (NdotL * mainLight.shadowAttenuation);
half3 ambient = SampleSH(IN.normalWS);
half3 finalColor = albedo.rgb * (diffuse + ambient);
return half4(finalColor, albedo.a);
}
ENDHLSL
}
// ─────────────────────────────────────────────────────────────
// PASS 2 ShadowCaster (Para proyectar sombras)
// ─────────────────────────────────────────────────────────────
Pass
{
Name "ShadowCaster"
Tags{"LightMode" = "ShadowCaster"}
ZWrite On
ZTest LEqual
ColorMask 0
Cull Back
HLSLPROGRAM
#pragma vertex ShadowPassVertex
#pragma fragment ShadowPassFragment
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
struct Attributes
{
float4 positionOS : POSITION;
float3 normalOS : NORMAL;
};
struct Varyings
{
float4 positionCS : SV_POSITION;
};
Varyings ShadowPassVertex(Attributes input)
{
Varyings output;
float3 positionWS = TransformObjectToWorld(input.positionOS.xyz);
float3 normalWS = TransformObjectToWorldNormal(input.normalOS);
// CAMBIO 3: Usamos la posición de la luz principal para que no dé errores
float3 lightDir = _MainLightPosition.xyz;
output.positionCS = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDir));
return output;
}
half4 ShadowPassFragment(Varyings input) : SV_TARGET
{
return 0;
}
ENDHLSL
}
// ─────────────────────────────────────────────────────────────
// PASS 3 Outline (Tu código original intacto)
// ─────────────────────────────────────────────────────────────
Pass
{
Name "Outline"
Tags { "LightMode" = "SRPDefaultUnlit" }
Cull Front
ZWrite Off
ZTest LEqual
Blend SrcAlpha OneMinusSrcAlpha
Stencil
{
Ref 1
Comp NotEqual
}
HLSLPROGRAM
#pragma vertex OutlineVert
#pragma fragment OutlineFrag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_ST;
float4 _Color;
float4 _OutlineColor;
float _OutlineWidth;
CBUFFER_END
struct Attributes
{
float4 positionOS : POSITION;
float3 normalOS : NORMAL;
};
struct Varyings
{
float4 positionHCS : SV_POSITION;
};
Varyings OutlineVert(Attributes IN)
{
Varyings OUT;
OUT.positionHCS = TransformObjectToHClip(IN.positionOS.xyz);
float3 normalWS = TransformObjectToWorldNormal(IN.normalOS);
float3 normalCS = mul((float3x3)UNITY_MATRIX_VP, normalWS);
float2 offset = normalize(normalCS.xy) * (_OutlineWidth * OUT.positionHCS.w);
OUT.positionHCS.xy += offset;
return OUT;
}
half4 OutlineFrag(Varyings IN) : SV_Target
{
return _OutlineColor;
}
ENDHLSL
}
}
FallBack "Hidden/Universal Render Pipeline/FallbackError"
}