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.
2026-02-23 21:47:59 -08:00
|
|
|
|
Shader "Custom/URP_Outline_Lit"
|
|
|
|
|
|
{
|
|
|
|
|
|
Properties
|
|
|
|
|
|
{
|
|
|
|
|
|
[Header(Main)]
|
|
|
|
|
|
_MainTex ("Albedo (RGB)", 2D) = "white" {}
|
|
|
|
|
|
_Color ("Base Color", Color) = (1,1,1,1)
|
2026-02-05 05:07:55 -08:00
|
|
|
|
|
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.
2026-02-23 21:47:59 -08:00
|
|
|
|
[Header(Outline)]
|
|
|
|
|
|
_OutlineColor ("Outline Color", Color) = (0,0,0,1)
|
|
|
|
|
|
_OutlineWidth ("Outline Width", Range(0, 0.2)) = 0.02
|
|
|
|
|
|
}
|
2026-02-05 05:07:55 -08:00
|
|
|
|
|
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.
2026-02-23 21:47:59 -08:00
|
|
|
|
SubShader
|
|
|
|
|
|
{
|
|
|
|
|
|
// CAMBIO 1: Cambiamos a Opaque para que reciba sombras correctamente
|
|
|
|
|
|
Tags
|
|
|
|
|
|
{
|
|
|
|
|
|
"RenderType" = "Opaque"
|
|
|
|
|
|
"RenderPipeline" = "UniversalPipeline"
|
|
|
|
|
|
"Queue" = "Geometry"
|
|
|
|
|
|
}
|
2026-02-05 05:07:55 -08:00
|
|
|
|
|
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.
2026-02-23 21:47:59 -08:00
|
|
|
|
// ─────────────────────────────────────────────────────────────
|
|
|
|
|
|
// 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"
|
2026-02-05 05:07:55 -08:00
|
|
|
|
}
|