Advanced POC - portals, dialogue system + floating words, room loading
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 540fac2e6d4ff5542859ea8ac819645a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,78 @@
|
||||
Shader "Custom/Portal_URP"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_InactiveColour ("Inactive Colour", Color) = (1,1,1,1)
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
_DisplayMask ("Display Mask", Float) = 1
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"RenderPipeline"="UniversalPipeline"
|
||||
"RenderType"="Opaque"
|
||||
"Queue"="Geometry+500"
|
||||
}
|
||||
|
||||
Cull Off
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Unlit"
|
||||
Tags { "LightMode"="SRPDefaultUnlit" }
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
TEXTURE2D(_MainTex);
|
||||
SAMPLER(sampler_MainTex);
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _InactiveColour;
|
||||
float _DisplayMask;
|
||||
CBUFFER_END
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float3 positionOS : POSITION;
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionHCS : SV_POSITION;
|
||||
float4 screenPos : TEXCOORD0;
|
||||
};
|
||||
|
||||
Varyings vert (Attributes v)
|
||||
{
|
||||
Varyings o;
|
||||
o.positionHCS = TransformObjectToHClip(v.positionOS);
|
||||
o.screenPos = ComputeScreenPos(o.positionHCS);
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag (Varyings i) : SV_Target
|
||||
{
|
||||
float2 uv = i.screenPos.xy / max(i.screenPos.w, 1e-5);
|
||||
|
||||
half4 portalCol = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv);
|
||||
|
||||
half displayMask = saturate(_DisplayMask);
|
||||
half4 finalCol = lerp(_InactiveColour, portalCol, displayMask);
|
||||
|
||||
if (displayMask > 0.5h && portalCol.a < 0.1h)
|
||||
return _InactiveColour;
|
||||
|
||||
return finalCol;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 670c541ecf09d494896624500a1a3272
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f677934ac95522e44aadde7d71f918de
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||
useAsTemplate: 0
|
||||
exposeTemplateAsShader: 0
|
||||
template:
|
||||
name:
|
||||
category:
|
||||
description:
|
||||
icon: {instanceID: 0}
|
||||
thumbnail: {instanceID: 0}
|
||||
@@ -0,0 +1,62 @@
|
||||
Shader "Custom/Slice"
|
||||
{
|
||||
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
|
||||
|
||||
sliceNormal("normal", Vector) = (0,0,0,0)
|
||||
sliceCentre ("centre", Vector) = (0,0,0,0)
|
||||
sliceOffsetDst("offset", Float) = 0
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue" = "Geometry" "IgnoreProjector" = "True" "RenderType"="Geometry" }
|
||||
LOD 200
|
||||
|
||||
CGPROGRAM
|
||||
// Physically based Standard lighting model, and enable shadows on all light types
|
||||
#pragma surface surf Standard addshadow
|
||||
// Use shader model 3.0 target, to get nicer looking lighting
|
||||
#pragma target 3.0
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
struct Input
|
||||
{
|
||||
float2 uv_MainTex;
|
||||
float3 worldPos;
|
||||
};
|
||||
|
||||
half _Glossiness;
|
||||
half _Metallic;
|
||||
fixed4 _Color;
|
||||
|
||||
// World space normal of slice, anything along this direction from centre will be invisible
|
||||
float3 sliceNormal;
|
||||
// World space centre of slice
|
||||
float3 sliceCentre;
|
||||
// Increasing makes more of the mesh visible, decreasing makes less of the mesh visible
|
||||
float sliceOffsetDst;
|
||||
|
||||
void surf (Input IN, inout SurfaceOutputStandard o)
|
||||
{
|
||||
float3 adjustedCentre = sliceCentre + sliceNormal * sliceOffsetDst;
|
||||
float3 offsetToSliceCentre = adjustedCentre - IN.worldPos;
|
||||
clip (dot(offsetToSliceCentre, sliceNormal));
|
||||
|
||||
// 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 "VertexLit"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fadedb956efeff54fb43f395f97cc677
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user