add some extra assets FX and SFX
This commit is contained in:
@@ -1,55 +1,112 @@
|
||||
// Upgrade NOTE: upgraded instancing buffer 'Props' to new syntax.
|
||||
Shader "Custom/URP/SeeThroughSurfaces2"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_BaseColor ("Color", Color) = (1,1,1,1)
|
||||
_BaseMap ("Albedo", 2D) = "white" {}
|
||||
|
||||
Shader "Custom/See Through Surfaces 2" {
|
||||
Properties {
|
||||
_Color ("Color", Color) = (1,1,1,1)
|
||||
_MainTex ("Albedo (RGB)", 2D) = "white" {}
|
||||
_Glossiness ("Smoothness", Range(0,1)) = 0.5
|
||||
_Metallic ("Metallic", Range(0,1)) = 0.0
|
||||
}
|
||||
SubShader {
|
||||
Tags { "RenderType"="Opaque" "Queue"="Geometry+2"}
|
||||
_Smoothness ("Smoothness", Range(0,1)) = 0.5
|
||||
_Metallic ("Metallic", Range(0,1)) = 0.0
|
||||
}
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref 1
|
||||
Comp notequal
|
||||
}
|
||||
|
||||
CGPROGRAM
|
||||
// Physically based Standard lighting model, and enable shadows on all light types
|
||||
#pragma surface surf Standard fullforwardshadows
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"RenderPipeline"="UniversalRenderPipeline"
|
||||
"RenderType"="Opaque"
|
||||
"Queue"="Geometry+2"
|
||||
}
|
||||
|
||||
// Use shader model 3.0 target, to get nicer looking lighting
|
||||
#pragma target 3.0
|
||||
Stencil
|
||||
{
|
||||
Ref 1
|
||||
Comp NotEqual
|
||||
}
|
||||
|
||||
sampler2D _MainTex;
|
||||
Pass
|
||||
{
|
||||
Name "ForwardLit"
|
||||
Tags { "LightMode"="UniversalForward" }
|
||||
|
||||
struct Input {
|
||||
float2 uv_MainTex;
|
||||
};
|
||||
HLSLPROGRAM
|
||||
|
||||
half _Glossiness;
|
||||
half _Metallic;
|
||||
fixed4 _Color;
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
|
||||
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
|
||||
// #pragma instancing_options assumeuniformscaling
|
||||
UNITY_INSTANCING_BUFFER_START(Props)
|
||||
// put more per-instance properties here
|
||||
UNITY_INSTANCING_BUFFER_END(Props)
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
|
||||
#pragma multi_compile _ _ADDITIONAL_LIGHTS
|
||||
|
||||
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;
|
||||
// Metallic and smoothness come from slider variables
|
||||
o.Metallic = _Metallic;
|
||||
o.Smoothness = _Glossiness;
|
||||
o.Alpha = c.a;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
}
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
float3 normalOS : NORMAL;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionHCS : SV_POSITION;
|
||||
float3 positionWS : TEXCOORD0;
|
||||
float3 normalWS : TEXCOORD1;
|
||||
float2 uv : TEXCOORD2;
|
||||
};
|
||||
|
||||
TEXTURE2D(_BaseMap);
|
||||
SAMPLER(sampler_BaseMap);
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _BaseColor;
|
||||
float _Metallic;
|
||||
float _Smoothness;
|
||||
CBUFFER_END
|
||||
|
||||
Varyings vert (Attributes IN)
|
||||
{
|
||||
Varyings OUT;
|
||||
|
||||
OUT.positionWS = TransformObjectToWorld(IN.positionOS.xyz);
|
||||
OUT.positionHCS = TransformWorldToHClip(OUT.positionWS);
|
||||
|
||||
OUT.normalWS = TransformObjectToWorldNormal(IN.normalOS);
|
||||
OUT.uv = IN.uv;
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
||||
half4 frag (Varyings IN) : SV_Target
|
||||
{
|
||||
float4 tex = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, IN.uv);
|
||||
|
||||
float3 albedo = tex.rgb * _BaseColor.rgb;
|
||||
float alpha = tex.a * _BaseColor.a;
|
||||
|
||||
float3 normal = normalize(IN.normalWS);
|
||||
|
||||
SurfaceData surfaceData = (SurfaceData)0;
|
||||
surfaceData.albedo = albedo;
|
||||
surfaceData.alpha = alpha;
|
||||
surfaceData.metallic = _Metallic;
|
||||
surfaceData.smoothness = _Smoothness;
|
||||
surfaceData.normalTS = float3(0,0,1);
|
||||
surfaceData.occlusion = 1;
|
||||
surfaceData.emission = 0;
|
||||
surfaceData.specular = 0;
|
||||
|
||||
InputData inputData = (InputData)0;
|
||||
inputData.positionWS = IN.positionWS;
|
||||
inputData.normalWS = normal;
|
||||
inputData.viewDirectionWS = GetWorldSpaceViewDir(IN.positionWS);
|
||||
inputData.shadowCoord = TransformWorldToShadowCoord(IN.positionWS);
|
||||
inputData.bakedGI = SampleSH(normal);
|
||||
|
||||
return UniversalFragmentPBR(inputData, surfaceData);
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user