Imported basic unity packages yeehaw

This commit is contained in:
Jan Groß
2021-06-11 23:22:35 +02:00
parent cebcde471d
commit 09c5e64772
312 changed files with 40946 additions and 276 deletions

View File

@@ -0,0 +1,109 @@
Shader "Starter Assets/ArmatureShader"
{
Properties
{
//Maps
_BaseTex("Albedo (RGB)", 2D) = "white" {}
_BumpMap("Normal", 2D) = "bump" {}
_MetallicMap("MetallicMap", 2D) = "black"{}
_MaterialMask("Mask", 2D) = "black" {}
//base - mask texture R
_BaseColor("Base Color", Color) = (1,1,1,1)
_BaseMetallic("Base Metallic", Range(0,1)) = 1
_BaseGlossiness("Base Smoothness", Range(0,1)) = 0.5
//layer 1 - mask texture G
_Layer1Color("Layer1 Color", Color) = (1,1,1,1)
_Layer1Glossiness("Layer1 Smoothness", Range(0,1)) = 0.5
_Layer1Metallic("Layer1 Metallic", Range(0,1)) = 0.0
//layer 2 - mask texture B
_Layer2Color("Layer2 Color", Color) = (1,1,1,1)
_Layer2Glossiness("Layer2 Smoothness", Range(0,1)) = 0.5
_Layer2Metallic("Layer2 Metallic", Range(0,1)) = 0.0
}
SubShader
{
Tags { "RenderType" = "Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _BaseTex;
sampler2D _BumpMap;
sampler2D _MaterialMask;
struct Input
{
float2 uv_BaseTex;
};
half _BaseMetallic;
half _BaseGlossiness;
half _Layer1Glossiness;
half _Layer1Metallic;
half _Layer2Glossiness;
half _Layer2Metallic;
fixed4 _BaseColor;
fixed4 _Layer1Color;
fixed4 _Layer2Color;
// 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)
void surf(Input IN, inout SurfaceOutputStandard o)
{
// Albedo map
fixed4 mainCall = tex2D(_BaseTex, IN.uv_BaseTex);
fixed4 materialMask = tex2D(_MaterialMask, IN.uv_BaseTex);
//setup colors for each layer
fixed4 baseColor = mainCall * _BaseColor;
fixed4 layer1Color = mainCall * _Layer1Color;
fixed4 layer2Color = mainCall * _Layer2Color;
fixed4 color = lerp(lerp( baseColor, layer1Color, materialMask.g), layer2Color ,materialMask.b);
o.Albedo = color.rgb;
// Normal Map
fixed3 normalMap = UnpackNormal (tex2D(_BumpMap, IN.uv_BaseTex));
o.Normal = normalMap;
// Metallic
fixed4 baseMetallic = _BaseMetallic;
fixed4 layer1Metallic = _Layer1Metallic;
fixed4 layer2Metallic = _Layer2Metallic;
fixed4 metallic = lerp(lerp(baseMetallic, layer1Metallic, materialMask.g), layer2Metallic, materialMask.b);
o.Metallic = metallic.r;
// Smoothness
fixed4 g = mainCall.a;
fixed4 baseGlossiness = g * _BaseGlossiness;
fixed4 layer1Glossiness = g * _Layer1Glossiness;
fixed4 layer2Glossiness = g * _Layer2Glossiness;
fixed4 glossiness = lerp(lerp(baseGlossiness, layer1Glossiness, materialMask.g), layer2Glossiness, materialMask.b);
o.Smoothness = glossiness.r;
o.Alpha = color.a;
}
ENDCG
}
FallBack "Diffuse"
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 6d99c6e0a8f8bf44bb8bcb6e5a056d01
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,149 @@
Shader "Starter Assets/Triplanar" {
Properties{
_MainTex("Albedo (RGB)", 2D) = "white" {}
[NoScaleOffset] _BumpMap("Normal Map", 2D) = "bump" {}
_Glossiness("Smoothness", Range(0, 1)) = 0.5
[Gamma] _Metallic("Metallic", Range(0, 1)) = 0
[NoScaleOffset] _OcclusionMap("Occlusion", 2D) = "white" {}
_OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0
}
SubShader{
Tags { "RenderType" = "Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
#include "UnityStandardUtils.cginc"
// flip UVs horizontally to correct for back side projection
#define TRIPLANAR_CORRECT_PROJECTED_U
// offset UVs to prevent obvious mirroring
// #define TRIPLANAR_UV_OFFSET
// Reoriented Normal Mapping
// Altered to take normals (-1 to 1 ranges) rather than unsigned normal maps (0 to 1 ranges)
half3 blend_rnm(half3 n1, half3 n2)
{
n1.z += 1;
n2.xy = -n2.xy;
return n1 * dot(n1, n2) / n1.z - n2;
}
sampler2D _MainTex;
float4 _MainTex_ST;
sampler2D _BumpMap;
sampler2D _OcclusionMap;
half _Glossiness;
half _Metallic;
half _OcclusionStrength;
struct Input {
float3 worldPos;
float3 worldNormal;
INTERNAL_DATA
};
float3 WorldToTangentNormalVector(Input IN, float3 normal) {
float3 t2w0 = WorldNormalVector(IN, float3(1,0,0));
float3 t2w1 = WorldNormalVector(IN, float3(0,1,0));
float3 t2w2 = WorldNormalVector(IN, float3(0,0,1));
float3x3 t2w = float3x3(t2w0, t2w1, t2w2);
return normalize(mul(t2w, normal));
}
void surf(Input IN, inout SurfaceOutputStandard o) {
// work around bug where IN.worldNormal is always (0,0,0)!
IN.worldNormal = WorldNormalVector(IN, float3(0,0,1));
// calculate triplanar blend
half3 triblend = saturate(pow(IN.worldNormal, 4));
triblend /= max(dot(triblend, half3(1,1,1)), 0.0001);
// calculate triplanar uvs
// applying texture scale and offset values ala TRANSFORM_TEX macro
float2 uvX = IN.worldPos.zy * _MainTex_ST.xy + _MainTex_ST.zy;
float2 uvY = IN.worldPos.xz * _MainTex_ST.xy + _MainTex_ST.zy;
float2 uvZ = IN.worldPos.xy * _MainTex_ST.xy + _MainTex_ST.zy;
// offset UVs to prevent obvious mirroring
#if defined(TRIPLANAR_UV_OFFSET)
uvY += 0.33;
uvZ += 0.67;
#endif
// minor optimization of sign(). prevents return value of 0
half3 axisSign = IN.worldNormal < 0 ? -1 : 1;
// flip UVs horizontally to correct for back side projection
#if defined(TRIPLANAR_CORRECT_PROJECTED_U)
uvX.x *= axisSign.x;
uvY.x *= axisSign.y;
uvZ.x *= -axisSign.z;
#endif
// albedo textures
fixed4 colX = tex2D(_MainTex, uvX);
fixed4 colY = tex2D(_MainTex, uvY);
fixed4 colZ = tex2D(_MainTex, uvZ);
fixed4 col = colX * triblend.x + colY * triblend.y + colZ * triblend.z;
// occlusion textures
half occX = tex2D(_OcclusionMap, uvX).g;
half occY = tex2D(_OcclusionMap, uvY).g;
half occZ = tex2D(_OcclusionMap, uvZ).g;
half occ = LerpOneTo(occX * triblend.x + occY * triblend.y + occZ * triblend.z, _OcclusionStrength);
// tangent space normal maps
half3 tnormalX = UnpackNormal(tex2D(_BumpMap, uvX));
half3 tnormalY = UnpackNormal(tex2D(_BumpMap, uvY));
half3 tnormalZ = UnpackNormal(tex2D(_BumpMap, uvZ));
// flip normal maps' x axis to account for flipped UVs
#if defined(TRIPLANAR_CORRECT_PROJECTED_U)
tnormalX.x *= axisSign.x;
tnormalY.x *= axisSign.y;
tnormalZ.x *= -axisSign.z;
#endif
half3 absVertNormal = abs(IN.worldNormal);
// swizzle world normals to match tangent space and apply reoriented normal mapping blend
tnormalX = blend_rnm(half3(IN.worldNormal.zy, absVertNormal.x), tnormalX);
tnormalY = blend_rnm(half3(IN.worldNormal.xz, absVertNormal.y), tnormalY);
tnormalZ = blend_rnm(half3(IN.worldNormal.xy, absVertNormal.z), tnormalZ);
// apply world space sign to tangent space Z
tnormalX.z *= axisSign.x;
tnormalY.z *= axisSign.y;
tnormalZ.z *= axisSign.z;
// sizzle tangent normals to match world normal and blend together
half3 worldNormal = normalize(
tnormalX.zyx * triblend.x +
tnormalY.xzy * triblend.y +
tnormalZ.xyz * triblend.z
);
// set surface ouput properties
o.Albedo = col.rgb;
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Occlusion = occ;
// convert world space normals into tangent normals
o.Normal = WorldToTangentNormalVector(IN, worldNormal);
}
ENDCG
}
FallBack "Diffuse"
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: e61aeb7487ccb5e4fb6d45036e33fb7b
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant: