Added Unity project files
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 580398998d568c84d922e2ac05833283
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,371 @@
|
||||
// Standard Lite GUI. Based on StandardShaderGUI in the built-in Unity shaders, licenced:
|
||||
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using System.Reflection;
|
||||
|
||||
namespace UnityEditor
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
internal class StandardLiteShaderGUI: ShaderGUI
|
||||
{
|
||||
public enum LightmapType
|
||||
{
|
||||
Default,
|
||||
MonoSH,
|
||||
MonoSHNoSpecular
|
||||
}
|
||||
|
||||
private static class Styles
|
||||
{
|
||||
public static GUIContent uvSetLabel = EditorGUIUtility.TrTextContent("UV Set");
|
||||
|
||||
public static GUIContent albedoText = EditorGUIUtility.TrTextContent("Albedo", "Albedo (RGB) and Transparency (A)");
|
||||
public static GUIContent alphaCutoffText = EditorGUIUtility.TrTextContent("Alpha Cutoff", "Threshold for alpha cutoff");
|
||||
public static GUIContent metallicMapText = EditorGUIUtility.TrTextContent("Metallic", "Metallic (R) and Smoothness (A)");
|
||||
public static GUIContent smoothnessText = EditorGUIUtility.TrTextContent("Smoothness", "Smoothness value");
|
||||
public static GUIContent highlightsText = EditorGUIUtility.TrTextContent("Specular Lightprobe Hack", "Use Lightprobes as lights for specularity");
|
||||
public static GUIContent reflectionsText = EditorGUIUtility.TrTextContent("Reflections", "Glossy Reflections");
|
||||
public static GUIContent normalMapText = EditorGUIUtility.TrTextContent("Normal Map", "Normal Map");
|
||||
public static GUIContent occlusionText = EditorGUIUtility.TrTextContent("Occlusion", "Occlusion (G)");
|
||||
public static GUIContent emissionText = EditorGUIUtility.TrTextContent("Color", "Emission (RGB)");
|
||||
public static GUIContent detailMaskText = EditorGUIUtility.TrTextContent("Detail Mask", "Mask for Secondary Maps (A)");
|
||||
public static GUIContent detailAlbedoText = EditorGUIUtility.TrTextContent("Detail Albedo x2", "Albedo (RGB) multiplied by 2");
|
||||
public static GUIContent detailNormalMapText = EditorGUIUtility.TrTextContent("Normal Map", "Normal Map");
|
||||
public static GUIContent lightmapTypeText = EditorGUIUtility.TrTextContent("Lightmap Type", "Lightmap Type");
|
||||
public static GUIContent specularAAText = EditorGUIUtility.TrTextContent("Specular Anti-Aliasing", "Screenspace Specular Anti-Aliasing");
|
||||
public static GUIContent specularAAVarianceText = EditorGUIUtility.TrTextContent("Variance", "Screenspace Specular Anti-Aliasing Variance");
|
||||
public static GUIContent specularAAThresholdText = EditorGUIUtility.TrTextContent("Threshold", "Screenspace Specular Anti-Aliasing Threshold");
|
||||
|
||||
public static string primaryMapsText = "Main Maps";
|
||||
public static string secondaryMapsText = "Secondary Maps";
|
||||
public static string forwardText = "Forward Rendering Options";
|
||||
public static string renderingMode = "Rendering Mode";
|
||||
public static string advancedText = "Advanced Options";
|
||||
}
|
||||
|
||||
MaterialProperty albedoMap = null;
|
||||
MaterialProperty albedoColor = null;
|
||||
MaterialProperty cutoff = null;
|
||||
MaterialProperty metallicMap = null;
|
||||
MaterialProperty metallic = null;
|
||||
MaterialProperty smoothness = null;
|
||||
MaterialProperty highlights = null;
|
||||
MaterialProperty reflections = null;
|
||||
MaterialProperty bumpScale = null;
|
||||
MaterialProperty bumpMap = null;
|
||||
MaterialProperty occlusionStrength = null;
|
||||
MaterialProperty occlusionMap = null;
|
||||
MaterialProperty emissionColorForRendering = null;
|
||||
MaterialProperty emissionMap = null;
|
||||
MaterialProperty detailMask = null;
|
||||
MaterialProperty detailAlbedoMap = null;
|
||||
MaterialProperty detailNormalMapScale = null;
|
||||
MaterialProperty detailNormalMap = null;
|
||||
MaterialProperty uvSetSecondary = null;
|
||||
MaterialProperty lightmapType = null;
|
||||
MaterialProperty specularAA = null;
|
||||
MaterialProperty specularAAVariance = null;
|
||||
MaterialProperty specularAAThreshold = null;
|
||||
|
||||
MaterialEditor m_MaterialEditor;
|
||||
|
||||
bool m_FirstTimeApply = true;
|
||||
|
||||
public void FindProperties(MaterialProperty[] props)
|
||||
{
|
||||
albedoMap = FindProperty("_MainTex", props);
|
||||
albedoColor = FindProperty("_Color", props);
|
||||
|
||||
try
|
||||
{
|
||||
cutoff = FindProperty("_Cutoff", props);
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
cutoff = null;
|
||||
}
|
||||
|
||||
metallicMap = FindProperty("_MetallicGlossMap", props, false);
|
||||
metallic = FindProperty("_Metallic", props, false);
|
||||
smoothness = FindProperty("_Glossiness", props);
|
||||
highlights = FindProperty("_SpecularHighlights", props, false);
|
||||
reflections = FindProperty("_GlossyReflections", props, false);
|
||||
bumpScale = FindProperty("_BumpScale", props);
|
||||
bumpMap = FindProperty("_BumpMap", props);
|
||||
occlusionStrength = FindProperty("_OcclusionStrength", props);
|
||||
occlusionMap = FindProperty("_OcclusionMap", props);
|
||||
emissionColorForRendering = FindProperty("_EmissionColor", props);
|
||||
emissionMap = FindProperty("_EmissionMap", props);
|
||||
detailMask = FindProperty("_DetailMask", props);
|
||||
detailAlbedoMap = FindProperty("_DetailAlbedoMap", props);
|
||||
detailNormalMapScale = FindProperty("_DetailNormalMapScale", props);
|
||||
detailNormalMap = FindProperty("_DetailNormalMap", props);
|
||||
uvSetSecondary = FindProperty("_UVSec", props);
|
||||
lightmapType = FindProperty("_LightmapType", props, false);
|
||||
specularAA = FindProperty("_EnableGeometricSpecularAA", props, true);
|
||||
specularAAVariance = FindProperty("_SpecularAAScreenSpaceVariance", props);
|
||||
specularAAThreshold = FindProperty("_SpecularAAThreshold", props);
|
||||
}
|
||||
|
||||
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
|
||||
{
|
||||
FindProperties(props); // MaterialProperties can be animated so we do not cache them but fetch them every event to ensure animated values are updated correctly
|
||||
m_MaterialEditor = materialEditor;
|
||||
Material material = materialEditor.target as Material;
|
||||
|
||||
// Make sure that needed setup (ie keywords/renderqueue) are set up if we're switching some existing
|
||||
// material to a standard shader.
|
||||
// Do this before any GUI code has been issued to prevent layout issues in subsequent GUILayout statements (case 780071)
|
||||
if (m_FirstTimeApply)
|
||||
{
|
||||
MaterialChanged(material);
|
||||
m_FirstTimeApply = false;
|
||||
}
|
||||
|
||||
ShaderPropertiesGUI(material);
|
||||
}
|
||||
|
||||
public void ShaderPropertiesGUI(Material material)
|
||||
{
|
||||
// Use default labelWidth
|
||||
EditorGUIUtility.labelWidth = 0f;
|
||||
|
||||
// Detect any changes to the material
|
||||
EditorGUI.BeginChangeCheck();
|
||||
{
|
||||
// Primary properties
|
||||
GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
|
||||
DoAlbedoArea(material);
|
||||
DoSpecularMetallicArea();
|
||||
DoNormalArea();
|
||||
m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
|
||||
if (occlusionMap.textureValue != null &&
|
||||
metallicMap.textureValue &&
|
||||
occlusionMap.textureValue != metallicMap.textureValue)
|
||||
{
|
||||
EditorGUILayout.HelpBox(EditorGUIUtility.TrTextContent("It's highly reccomended to pack your Occlusion(G) into your Metallic(R) Smoothness(A) map. You can then drop it in both texture slots."));
|
||||
}
|
||||
m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
|
||||
if ((detailMask.textureValue != null && albedoMap.textureValue && detailMask.textureValue != albedoMap.textureValue) ||
|
||||
(detailMask.textureValue != null && emissionMap.textureValue && detailMask.textureValue != emissionMap.textureValue) ||
|
||||
(detailMask.textureValue != null && detailAlbedoMap.textureValue && detailMask.textureValue != detailAlbedoMap.textureValue) ||
|
||||
(detailMask.textureValue != null && occlusionMap.textureValue && detailMask.textureValue != occlusionMap.textureValue) ||
|
||||
(detailMask.textureValue != null && metallicMap.textureValue && detailMask.textureValue != metallicMap.textureValue))
|
||||
{
|
||||
EditorGUILayout.HelpBox(EditorGUIUtility.TrTextContent("It's highly reccomended to pack your Detail Mask(A) into your Albedo(RGB) or Emission(RGB) maps. You can then drop it in both texture slots."));
|
||||
}
|
||||
DoEmissionArea(material);
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
// Secondary properties
|
||||
GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
|
||||
m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
|
||||
m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
|
||||
m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
|
||||
m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);
|
||||
|
||||
// Third properties
|
||||
GUILayout.Label(Styles.forwardText, EditorStyles.boldLabel);
|
||||
if (highlights != null)
|
||||
m_MaterialEditor.ShaderProperty(highlights, Styles.highlightsText);
|
||||
if (reflections != null)
|
||||
m_MaterialEditor.ShaderProperty(reflections, Styles.reflectionsText);
|
||||
|
||||
if (lightmapType != null)
|
||||
{
|
||||
m_MaterialEditor.ShaderProperty(lightmapType, Styles.lightmapTypeText);
|
||||
|
||||
bool hasBakery = true;
|
||||
bool bakeryUsingMonoSH = false;
|
||||
try {
|
||||
// Conditionally retrieve info from Bakery assembly, using reflection. Reflection is always cursed, it's fine.
|
||||
Assembly bakeryAsm = Assembly.Load("BakeryEditorAssembly");
|
||||
Type RenderDirModeType = bakeryAsm.GetType("ftRenderLightmap+RenderDirMode");
|
||||
FieldInfo renderDirModeField = bakeryAsm.GetType("ftRenderLightmap").GetField("renderDirMode");
|
||||
object renderDirMode = renderDirModeField.GetValue(null);
|
||||
object monoshMode = Enum.Parse(RenderDirModeType, "MonoSH");
|
||||
|
||||
bakeryUsingMonoSH = renderDirMode.Equals(monoshMode);
|
||||
}
|
||||
catch (BadImageFormatException) {
|
||||
hasBakery = false;
|
||||
}
|
||||
catch (FileNotFoundException) {
|
||||
hasBakery = false;
|
||||
}
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// Debug.LogError("Failed to get MonoSH mode from Bakery: " + e);
|
||||
// }
|
||||
|
||||
if (GetLightmapType(material) == LightmapType.MonoSH ||
|
||||
GetLightmapType(material) == LightmapType.MonoSHNoSpecular)
|
||||
{
|
||||
if (!hasBakery) {
|
||||
EditorGUILayout.HelpBox(EditorGUIUtility.TrTextContent("MonoSH type mode selected, but Bakery does not appear to be installed."));
|
||||
} else if (!bakeryUsingMonoSH)
|
||||
{
|
||||
EditorGUILayout.HelpBox(EditorGUIUtility.TrTextContent("MonoSH type mode selected, but Bakery is not set to use MonoSH."));
|
||||
}
|
||||
} else {
|
||||
if (hasBakery && bakeryUsingMonoSH)
|
||||
{
|
||||
EditorGUILayout.HelpBox(EditorGUIUtility.TrTextContent("Default lightmap mode selected, but Bakery is set to use MonoSH."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (specularAA != null)
|
||||
{
|
||||
m_MaterialEditor.ShaderProperty(specularAA, Styles.specularAAText);
|
||||
if((int)material.GetFloat("_EnableGeometricSpecularAA") > 0)
|
||||
{
|
||||
int indentation = 2; // align with labels of texture properties
|
||||
if (specularAAVariance != null)
|
||||
m_MaterialEditor.ShaderProperty(specularAAVariance, Styles.specularAAVarianceText, indentation);
|
||||
if (specularAAThreshold != null)
|
||||
m_MaterialEditor.ShaderProperty(specularAAThreshold, Styles.specularAAThresholdText, indentation);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
MaterialChanged(material);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
// NB renderqueue editor is not shown on purpose: we want to override it based on blend mode
|
||||
GUILayout.Label(Styles.advancedText, EditorStyles.boldLabel);
|
||||
m_MaterialEditor.EnableInstancingField();
|
||||
m_MaterialEditor.DoubleSidedGIField();
|
||||
}
|
||||
|
||||
public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
|
||||
{
|
||||
// _Emission property is lost after assigning Standard shader to the material
|
||||
// thus transfer it before assigning the new shader
|
||||
if (material.HasProperty("_Emission"))
|
||||
{
|
||||
material.SetColor("_EmissionColor", material.GetColor("_Emission"));
|
||||
}
|
||||
|
||||
base.AssignNewShaderToMaterial(material, oldShader, newShader);
|
||||
|
||||
MaterialChanged(material);
|
||||
}
|
||||
|
||||
void DoNormalArea()
|
||||
{
|
||||
m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
|
||||
//if (bumpScale.floatValue != 1
|
||||
//&& BuildTargetDiscovery.PlatformHasFlag(EditorUserBuildSettings.activeBuildTarget, TargetAttributes.HasIntegratedGPU))
|
||||
//if (m_MaterialEditor.HelpBoxWithButton(
|
||||
//EditorGUIUtility.TrTextContent("Bump scale is not supported on mobile platforms"),
|
||||
//EditorGUIUtility.TrTextContent("Fix Now")))
|
||||
//{
|
||||
//bumpScale.floatValue = 1;
|
||||
//}
|
||||
}
|
||||
|
||||
void DoAlbedoArea(Material material)
|
||||
{
|
||||
m_MaterialEditor.TexturePropertySingleLine(Styles.albedoText, albedoMap, albedoColor);
|
||||
|
||||
int indentation = 2;
|
||||
if(cutoff != null)
|
||||
{
|
||||
m_MaterialEditor.ShaderProperty(cutoff, Styles.alphaCutoffText.text, indentation);
|
||||
}
|
||||
}
|
||||
|
||||
void DoEmissionArea(Material material)
|
||||
{
|
||||
// Emission for GI?
|
||||
if (m_MaterialEditor.EmissionEnabledProperty())
|
||||
{
|
||||
bool hadEmissionTexture = emissionMap.textureValue != null;
|
||||
|
||||
// Texture and HDR color controls
|
||||
m_MaterialEditor.TexturePropertyWithHDRColor(Styles.emissionText, emissionMap, emissionColorForRendering, false);
|
||||
|
||||
// If texture was assigned and color was black set color to white
|
||||
float brightness = emissionColorForRendering.colorValue.maxColorComponent;
|
||||
if (emissionMap.textureValue != null && !hadEmissionTexture && brightness <= 0f)
|
||||
emissionColorForRendering.colorValue = Color.white;
|
||||
|
||||
// change the GI flag and fix it up with emissive as black if necessary
|
||||
m_MaterialEditor.LightmapEmissionFlagsProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel, true);
|
||||
}
|
||||
}
|
||||
|
||||
void DoSpecularMetallicArea()
|
||||
{
|
||||
bool hasGlossMap = false;
|
||||
hasGlossMap = metallicMap.textureValue != null;
|
||||
m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapText, metallicMap, metallic);
|
||||
|
||||
int indentation = 2; // align with labels of texture properties
|
||||
m_MaterialEditor.ShaderProperty(smoothness, Styles.smoothnessText, indentation);
|
||||
|
||||
++indentation;
|
||||
}
|
||||
|
||||
static LightmapType GetLightmapType(Material material)
|
||||
{
|
||||
int ch = (int)material.GetFloat("_LightmapType");
|
||||
return (LightmapType)(int)ch;
|
||||
}
|
||||
|
||||
static void SetMaterialKeywords(Material material)
|
||||
{
|
||||
// Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation
|
||||
// (MaterialProperty value might come from renderer material property block)
|
||||
SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap") || material.GetTexture("_DetailNormalMap"));
|
||||
SetKeyword(material, "_METALLICGLOSSMAP", material.GetTexture("_MetallicGlossMap"));
|
||||
SetKeyword(material, "_DETAIL", material.GetTexture("_DetailAlbedoMap") || material.GetTexture("_DetailNormalMap"));
|
||||
|
||||
// A material's GI flag internally keeps track of whether emission is enabled at all, it's enabled but has no effect
|
||||
// or is enabled and may be modified at runtime. This state depends on the values of the current flag and emissive color.
|
||||
// The fixup routine makes sure that the material is in the correct state if/when changes are made to the mode or color.
|
||||
MaterialEditor.FixupEmissiveFlag(material);
|
||||
bool shouldEmissionBeEnabled = (material.globalIlluminationFlags & MaterialGlobalIlluminationFlags.EmissiveIsBlack) == 0;
|
||||
SetKeyword(material, "_EMISSION", shouldEmissionBeEnabled);
|
||||
|
||||
if (material.HasProperty("_LightmapType"))
|
||||
{
|
||||
SetKeyword(material, "_MONOSH_SPECULAR", GetLightmapType(material) == LightmapType.MonoSH);
|
||||
SetKeyword(material, "_MONOSH_NOSPECULAR", GetLightmapType(material) == LightmapType.MonoSHNoSpecular);
|
||||
}
|
||||
|
||||
if (material.HasProperty("_EnableGeometricSpecularAA"))
|
||||
{
|
||||
SetKeyword(material, "_ENABLE_GEOMETRIC_SPECULAR_AA", material.GetFloat("_EnableGeometricSpecularAA") > 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void MaterialChanged(Material material)
|
||||
{
|
||||
SetMaterialKeywords(material);
|
||||
}
|
||||
|
||||
static void SetKeyword(Material m, string keyword, bool state)
|
||||
{
|
||||
if (state)
|
||||
m.EnableKeyword(keyword);
|
||||
else
|
||||
m.DisableKeyword(keyword);
|
||||
}
|
||||
}
|
||||
#else // if !UNITY_EDITOR
|
||||
internal class StandardLiteShaderGUI {}
|
||||
#endif // if UNITY_EDITOR
|
||||
} // namespace UnityEditor
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26e3f17a75ecd1e42ac3dda3053ae988
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3efb46ed449a3ae499f293f52a52e343
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0ddcef6e88453b41ae266e355063dbc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc0291dab65abd3469d9bde663254303
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,96 @@
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half3 normal : NORMAL;
|
||||
half4 tangent : TANGENT;
|
||||
float2 uv : TEXCOORD0;
|
||||
float2 uv1 : TEXCOORD1;
|
||||
half3 color : COLOR;
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
VRCHAT_ATLAS_VERTEX_INPUT
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float4 uv : TEXCOORD0;
|
||||
float3 worldPos : TEXCOORD1;
|
||||
half3 normal : TEXCOORD2;
|
||||
half4 tangent : TEXCOORD3;
|
||||
half3 viewDir : TEXCOORD4;
|
||||
half3 color : COLOR;
|
||||
|
||||
#if !defined(UNITY_PASS_SHADOWCASTER)
|
||||
UNITY_LIGHTING_COORDS(5, 6)
|
||||
UNITY_FOG_COORDS(7)
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
VRCHAT_ATLAS_VERTEX_OUTPUT
|
||||
};
|
||||
|
||||
struct LightVectors
|
||||
{
|
||||
bool lightEnv;
|
||||
half3 lightDir;
|
||||
half3 lightCol;
|
||||
half3 viewDir;
|
||||
half3 stereoViewDir;
|
||||
half3 fixedVector;
|
||||
half3 reflViewDir;
|
||||
half3 reflLightDir;
|
||||
};
|
||||
|
||||
struct Surface
|
||||
{
|
||||
half4 albedoMap;
|
||||
half3 emissionMap;
|
||||
half occlusionMap;
|
||||
half matcapMask;
|
||||
uint matcapType;
|
||||
half matcapStrength;
|
||||
|
||||
uint detailMode;
|
||||
half detailMaskMap;
|
||||
half4 detailAlbedoMap;
|
||||
|
||||
half3 normalMap;
|
||||
#if defined(USE_NORMAL_MAPS) && defined(USE_DETAIL_MAPS)
|
||||
half3 detailNormalMap;
|
||||
#endif
|
||||
|
||||
half alpha;
|
||||
half shadowBoost;
|
||||
half shadowAlbedo;
|
||||
half minBrightness;
|
||||
bool limitBrightness;
|
||||
|
||||
float roughness;
|
||||
half metallic;
|
||||
|
||||
half specularSharpness;
|
||||
half reflectance;
|
||||
half3 rimColor;
|
||||
half rimAlbedoTint;
|
||||
half rimIntensity;
|
||||
half rimRange;
|
||||
half rimSharpness;
|
||||
bool rimEnvironmental;
|
||||
//half cutoff;
|
||||
};
|
||||
|
||||
struct DotProducts {
|
||||
half ndl; // Surface Normal . Light Direction -1 to 1 "raw"
|
||||
half ndl01; // Surface Normal . Light Direction 0 to 1 remapped "lambert wrapped"
|
||||
half clampedNdl; // Surface Normal . Light Direction 0 to 1 clamped "lambert"
|
||||
half vdn; // View Direction . Light Direction
|
||||
half svdn; // Stereo View Direction . Light Direction, used for things that need to be "stereo convergent" for VR
|
||||
half vdh; // View Direction . halfway Direction
|
||||
half ndh; // Surface Normal . halfway Direction
|
||||
};
|
||||
|
||||
struct VertexLightInformation {
|
||||
half3 Direction[4];
|
||||
half3 ColorFalloff[4];
|
||||
};
|
||||
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0870a6b2d2db6db4d988d61ccf544270
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,170 @@
|
||||
// Samplers
|
||||
sampler2D _MainTex,
|
||||
#if defined(USE_EMISSION_MAP)
|
||||
_EmissionMap,
|
||||
#endif
|
||||
#if defined(USE_OCCLUSION_MAP)
|
||||
_OcclusionMap,
|
||||
#endif
|
||||
#if defined(USE_NORMAL_MAPS)
|
||||
_BumpMap,
|
||||
#endif
|
||||
#if defined(USE_SPECULAR)
|
||||
_MetallicMap,
|
||||
_GlossMap,
|
||||
#endif
|
||||
#if defined(USE_DETAIL_MAPS)
|
||||
_DetailAlbedoMap,
|
||||
_DetailMask,
|
||||
#if defined(USE_NORMAL_MAPS)
|
||||
_DetailNormalMap,
|
||||
#endif
|
||||
#endif
|
||||
#if defined(USE_MATCAP)
|
||||
_Matcap,
|
||||
_MatcapMask,
|
||||
#endif
|
||||
_HueShiftMask,
|
||||
_Ramp,
|
||||
_ColorMask;
|
||||
|
||||
// Properties
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _MainTex_ST);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _Ramp_ST);
|
||||
|
||||
#if defined(USE_EMISSION_MAP)
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _EmissionMap_ST);
|
||||
#endif
|
||||
|
||||
#if defined(USE_OCCLUSION_MAP)
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _OcclusionMap_ST);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(uint, _OcclusionMapChannel);
|
||||
#endif
|
||||
|
||||
#if defined(USE_NORMAL_MAPS)
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _BumpMap_ST);
|
||||
#endif
|
||||
|
||||
#if defined(USE_SPECULAR)
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _MetallicMap_ST);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(uint, _MetallicMapChannel);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _GlossMap_ST);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(uint, _GlossMapChannel);
|
||||
#endif
|
||||
|
||||
#if defined(USE_DETAIL_MAPS)
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _DetailMask_ST);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(uint, _DetailMaskChannel);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _DetailAlbedoMap_ST);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _DetailMode);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(uint, _DetailUV);
|
||||
#if defined(USE_NORMAL_MAPS)
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _DetailNormalMap_ST);
|
||||
#endif
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _DetailHueShift);
|
||||
#endif
|
||||
|
||||
#if defined(USE_MATCAP)
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _MatcapMask_ST);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(uint, _MatcapMaskChannel);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(uint, _MatcapType);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _MatcapStrength);
|
||||
#endif
|
||||
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _ColorMask_ST);
|
||||
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _HueShiftMask_ST);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(uint, _HueShiftMaskChannel);
|
||||
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _Color);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _BumpScale);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _VertexColor);
|
||||
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _ShadowBoost);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _ShadowAlbedo);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _MinBrightness);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _LimitBrightness);
|
||||
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _HueShift);
|
||||
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half3, _RimColor);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _RimAlbedoTint);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _RimIntensity);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _RimRange);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _RimSharpness);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _RimEnvironmental);
|
||||
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _ColorMaskColor1);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _ColorMaskEmissionStrength1);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _ColorMaskColor2);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _ColorMaskEmissionStrength2);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _ColorMaskColor3);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _ColorMaskEmissionStrength3);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _ColorMaskColor4);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _ColorMaskEmissionStrength4);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(uint, _ColorMaskBlendMode);
|
||||
|
||||
#define COLORMASK_BLEND_MULTIPLY 0
|
||||
#define COLORMASK_BLEND_ADDITIVE 1
|
||||
|
||||
//VRCHAT_DEFINE_ATLAS_PROPERTY(half, _Cutoff);
|
||||
//VRCHAT_DEFINE_ATLAS_PROPERTY(half, _AlphaToMask);
|
||||
|
||||
#if defined(USE_EMISSION_MAP)
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _EmissionColor);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _EmissionStrength);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(uint, _EmissionUV);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _EmissionHueShift);
|
||||
#endif
|
||||
|
||||
#if defined(USE_OCCLUSION_MAP)
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _OcclusionStrength);
|
||||
#endif
|
||||
|
||||
#if defined(USE_SPECULAR)
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _MetallicStrength);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _GlossStrength);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _SpecularSharpness);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _Reflectance);
|
||||
#endif
|
||||
|
||||
#if defined(USE_DETAIL_MAPS)
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _DetailNormalMapScale);
|
||||
#endif
|
||||
|
||||
// Atlas Texture Modes
|
||||
#if defined(VRCHAT_ATLASING_ENABLED)
|
||||
VRCHAT_DEFINE_ATLAS_TEXTUREMODE(_MainTex);
|
||||
VRCHAT_DEFINE_ATLAS_TEXTUREMODE(_Ramp);
|
||||
|
||||
#if defined(USE_EMISSION_MAP)
|
||||
VRCHAT_DEFINE_ATLAS_TEXTUREMODE(_EmissionMap);
|
||||
#endif
|
||||
|
||||
#if defined(USE_OCCLUSION_MAP)
|
||||
VRCHAT_DEFINE_ATLAS_TEXTUREMODE(_OcclusionMap);
|
||||
#endif
|
||||
|
||||
#if defined(USE_NORMAL_MAPS)
|
||||
VRCHAT_DEFINE_ATLAS_TEXTUREMODE(_BumpMap);
|
||||
#endif
|
||||
|
||||
#if defined(USE_SPECULAR)
|
||||
VRCHAT_DEFINE_ATLAS_TEXTUREMODE(_MetallicMap);
|
||||
VRCHAT_DEFINE_ATLAS_TEXTUREMODE(_GlossMap);
|
||||
#endif
|
||||
|
||||
#if defined(USE_DETAIL_MAPS)
|
||||
VRCHAT_DEFINE_ATLAS_TEXTUREMODE(_DetailAlbedoMap);
|
||||
VRCHAT_DEFINE_ATLAS_TEXTUREMODE(_DetailMask);
|
||||
#if defined(USE_NORMAL_MAPS)
|
||||
VRCHAT_DEFINE_ATLAS_TEXTUREMODE(_DetailNormalMap);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(USE_MATCAP)
|
||||
VRCHAT_DEFINE_ATLAS_TEXTUREMODE(_MatcapMask);
|
||||
#endif
|
||||
|
||||
VRCHAT_DEFINE_ATLAS_TEXTUREMODE(_HueShiftMask);
|
||||
#endif
|
||||
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fbbab985bea92fc48b01b6760c828d8b
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,581 @@
|
||||
float2 SelectUV(float4 fullUV, uint idx)
|
||||
{
|
||||
return idx == 0 ? fullUV.xy : fullUV.zw;
|
||||
}
|
||||
|
||||
half3 MaybeSaturate(half3 value, bool apply)
|
||||
{
|
||||
return apply ? saturate(value) : value;
|
||||
}
|
||||
|
||||
#define SAMPLE_MASK(texName, uv) \
|
||||
(tex2D(texName, VRCHAT_TRANSFORM_ATLAS_TEX_MODE(uv, texName))[VRCHAT_GET_ATLAS_PROPERTY(texName##Channel)])
|
||||
|
||||
#define SAMPLE_MASK_GRAD(texName, uv, ddx, ddy) \
|
||||
(tex2Dgrad(texName, VRCHAT_TRANSFORM_ATLAS_TEX_MODE(uv, texName), ddx, ddy)[VRCHAT_GET_ATLAS_PROPERTY(texName##Channel)])
|
||||
|
||||
half3 F_Schlick(half3 f0, half vdh, half vdn)
|
||||
{
|
||||
return f0 + (1.0 - f0) * pow((1.0 - vdh) * (1-vdn), 5.0);
|
||||
}
|
||||
|
||||
half V_SmithGGXCorrelated(half NoV, half NoL, half roughness)
|
||||
{
|
||||
half v = 0.5 / lerp(2 * NoL * NoV, NoL + NoV, roughness);
|
||||
return saturate(v);
|
||||
}
|
||||
|
||||
#if defined(SHADER_API_MOBILE)
|
||||
#define FLOAT_MIN (1e-4 * 0.2f)
|
||||
#else
|
||||
#define FLOAT_MIN 1e-6
|
||||
#endif
|
||||
|
||||
// adapted from UnityStandardBRDF.cginc, but with a better epsilon to prevent precision issues on mobile
|
||||
float VRC_GGXTerm(float NdotH, float roughness)
|
||||
{
|
||||
float a2 = roughness * roughness;
|
||||
float d = (NdotH * a2 - NdotH) * NdotH + 1.0f;
|
||||
return UNITY_INV_PI * a2 / (d * d + FLOAT_MIN);
|
||||
}
|
||||
|
||||
void GetSurfaceNormals(Surface surface, inout half3 bitangent, inout half3 tangent, inout half3 normal)
|
||||
{
|
||||
#if defined(USE_DETAIL_MAPS) && defined(USE_NORMAL_MAPS)
|
||||
half3 blendedNormal = BlendNormals(surface.normalMap, surface.detailNormalMap);
|
||||
#else
|
||||
half3 blendedNormal = surface.normalMap;
|
||||
#endif
|
||||
half3 calcedNormal = normalize(blendedNormal.x * tangent + blendedNormal.y * bitangent + blendedNormal.z * normal);
|
||||
|
||||
half3 bumpedTangent = cross(bitangent, calcedNormal);
|
||||
half3 bumpedBitangent = cross(calcedNormal, bumpedTangent);
|
||||
|
||||
normal = calcedNormal;
|
||||
tangent = bumpedTangent;
|
||||
bitangent = bumpedBitangent;
|
||||
}
|
||||
|
||||
// From Valve's whitepaper on VR Rendering
|
||||
// https://media.steampowered.com/apps/valve/2015/Alex_Vlachos_Advanced_VR_Rendering_GDC2015.pdf
|
||||
float GetGeometricSpecularAA(half3 normal)
|
||||
{
|
||||
half3 vNormalWsDdx = ddx(normal.xyz);
|
||||
half3 vNormalWsDdy = ddy(normal.xyz);
|
||||
float flGeometricRoughnessFactor = pow(saturate(max(dot(vNormalWsDdx.xyz,vNormalWsDdx.xyz), dot(vNormalWsDdy.xyz,vNormalWsDdy.xyz))), 0.333);
|
||||
return max(0, flGeometricRoughnessFactor);
|
||||
}
|
||||
|
||||
// stolen^Wadapted from VRChat-Mobile-StandardLite
|
||||
half shEvaluateDiffuseL1Geomerics(half L0, half3 L1, half3 n)
|
||||
{
|
||||
// avg direction of incoming light and directional brightness
|
||||
half3 R1 = 0.5f * L1;
|
||||
half lenR1 = length(R1);
|
||||
|
||||
// linear angle between normal and direction 0-1, saturate fix from filamented
|
||||
half q = dot(Unity_SafeNormalize(R1), n) * 0.5 + 0.5;
|
||||
q = isnan(q) ? 1 : q;
|
||||
q = saturate(q);
|
||||
|
||||
return (L0 <= 0.f) ? 0.f : ( 4. * lenR1 * pow(q, (2 * lenR1) / L0 + 1) + ( L0 * (L0 - lenR1) )/(L0 + lenR1));
|
||||
}
|
||||
|
||||
half3 shEvalFull(half3 normal)
|
||||
{
|
||||
return half3(
|
||||
shEvaluateDiffuseL1Geomerics(unity_SHAr.w, unity_SHAr.xyz, normal),
|
||||
shEvaluateDiffuseL1Geomerics(unity_SHAg.w, unity_SHAg.xyz, normal),
|
||||
shEvaluateDiffuseL1Geomerics(unity_SHAb.w, unity_SHAb.xyz, normal)
|
||||
);
|
||||
}
|
||||
|
||||
// Get the most intense light Dir from probes OR from a light source
|
||||
half3 GetLightDir(const bool lightEnv, float3 worldPos)
|
||||
{
|
||||
// switch between using probes or actual light direction
|
||||
float3 lightDir = lightEnv ? UnityWorldSpaceLightDir(worldPos) : unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
|
||||
// if the average length of the light probes is null, and we don't have a directional light in the scene, fall back to our fallback lightDir
|
||||
#if !defined(POINT) && !defined(SPOT) && !defined(VERTEXLIGHT_ON)
|
||||
if(length(unity_SHAr.xyz*unity_SHAr.w + unity_SHAg.xyz*unity_SHAg.w + unity_SHAb.xyz*unity_SHAb.w) == 0 && length(lightDir) < 0.1)
|
||||
{
|
||||
return half3(0.577, 0.577, 0.577);
|
||||
}
|
||||
#endif
|
||||
|
||||
return Unity_SafeNormalize(lightDir);
|
||||
}
|
||||
|
||||
half3 GetLightCol(const bool lightEnv, half3 lightColor, half3 lightDir)
|
||||
{
|
||||
UNITY_BRANCH
|
||||
if (lightEnv)
|
||||
{
|
||||
return lightColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
// no realtime light, use ambient or probe
|
||||
// calculates brightest SH, vs average in GetIndirectDiffuse ("light" vs "shadow" from probes)
|
||||
half4 lightDir4 = float4(lightDir, 1.0);
|
||||
return shEvalFull(lightDir) + max(SHEvalLinearL2(lightDir4), 0);
|
||||
}
|
||||
}
|
||||
|
||||
// VRC mirror support
|
||||
float _VRChatMirrorMode;
|
||||
float3 _VRChatMirrorCameraPos;
|
||||
half3 GetStereoViewDir(float3 worldPos)
|
||||
{
|
||||
float3 cameraPos = _VRChatMirrorMode ? _VRChatMirrorCameraPos :
|
||||
#ifdef USING_STEREO_MATRICES
|
||||
(unity_StereoWorldSpaceCameraPos[0] + unity_StereoWorldSpaceCameraPos[1]) * 0.5f;
|
||||
#else
|
||||
_WorldSpaceCameraPos;
|
||||
#endif
|
||||
|
||||
half3 viewDir = cameraPos - worldPos;
|
||||
return normalize(viewDir);
|
||||
}
|
||||
|
||||
#if defined(VERTEXLIGHT_ON)
|
||||
// Partially lifted vertex light support from XSToon: https://github.com/Xiexe/Xiexes-Unity-Shaders
|
||||
void Get4VertexLightsColFalloff(inout VertexLightInformation vLight, float3 worldPos, half3 normal)
|
||||
{
|
||||
half4 toLightX = unity_4LightPosX0 - worldPos.x;
|
||||
half4 toLightY = unity_4LightPosY0 - worldPos.y;
|
||||
half4 toLightZ = unity_4LightPosZ0 - worldPos.z;
|
||||
|
||||
half4 lengthSq = 0;
|
||||
lengthSq += toLightX * toLightX;
|
||||
lengthSq += toLightY * toLightY;
|
||||
lengthSq += toLightZ * toLightZ;
|
||||
|
||||
half4 atten = sqrt(1.0 / (1.0 + lengthSq * unity_4LightAtten0));
|
||||
|
||||
vLight.ColorFalloff[0] = saturate(unity_LightColor[0]) * atten.x;
|
||||
vLight.ColorFalloff[1] = saturate(unity_LightColor[1]) * atten.y;
|
||||
vLight.ColorFalloff[2] = saturate(unity_LightColor[2]) * atten.z;
|
||||
vLight.ColorFalloff[3] = saturate(unity_LightColor[3]) * atten.w;
|
||||
}
|
||||
|
||||
void GetVertexLightsDir(inout VertexLightInformation vLights, float3 worldPos)
|
||||
{
|
||||
float3 toLightX = float3(unity_4LightPosX0.x, unity_4LightPosY0.x, unity_4LightPosZ0.x);
|
||||
float3 toLightY = float3(unity_4LightPosX0.y, unity_4LightPosY0.y, unity_4LightPosZ0.y);
|
||||
float3 toLightZ = float3(unity_4LightPosX0.z, unity_4LightPosY0.z, unity_4LightPosZ0.z);
|
||||
float3 toLightW = float3(unity_4LightPosX0.w, unity_4LightPosY0.w, unity_4LightPosZ0.w);
|
||||
|
||||
half3 dirX = normalize(toLightX - worldPos);
|
||||
half3 dirY = normalize(toLightY - worldPos);
|
||||
half3 dirZ = normalize(toLightZ - worldPos);
|
||||
half3 dirW = normalize(toLightW - worldPos);
|
||||
|
||||
vLights.Direction[0] = dirX;
|
||||
vLights.Direction[1] = dirY;
|
||||
vLights.Direction[2] = dirZ;
|
||||
vLights.Direction[3] = dirW;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(USE_SPECULAR)
|
||||
half3 GetSpecularFresnel(DotProducts dotProducts, half3 f0)
|
||||
{
|
||||
return F_Schlick(f0, dotProducts.vdh, dotProducts.vdn);
|
||||
}
|
||||
|
||||
half3 GetDirectSpecular(Surface surface, DotProducts d, float3 fresnel)
|
||||
{
|
||||
half3 specular = half3(0,0,0);
|
||||
|
||||
#if defined(USE_SPECULAR)
|
||||
float rough = max(surface.roughness * surface.roughness, 0.0045);
|
||||
|
||||
float V = V_SmithGGXCorrelated(d.vdn, d.ndl, rough);
|
||||
float D = VRC_GGXTerm(d.ndh, rough);
|
||||
half3 directSpecular = max(0, (D * V) * fresnel);
|
||||
half3 directSpecularSharp = smoothstep(0.5, 0.51, directSpecular);
|
||||
|
||||
specular = lerp(directSpecular, directSpecularSharp, surface.specularSharpness);
|
||||
#endif
|
||||
|
||||
return specular;
|
||||
}
|
||||
#endif
|
||||
|
||||
half3 GetIndirectDiffuse()
|
||||
{
|
||||
half3 ambient = half3(0,0,0);
|
||||
#if defined(UNITY_PASS_FORWARDBASE)
|
||||
// SH average only, dodges a ShadeSH9 for efficiency but means we approximate lightprobes
|
||||
ambient = half3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
|
||||
#endif
|
||||
return ambient;
|
||||
}
|
||||
|
||||
//Reflection direction, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax
|
||||
half3 GetReflectionUV(half3 direction, float3 position, half4 cubemapPosition, half3 boxMin, half3 boxMax)
|
||||
{
|
||||
#if UNITY_SPECCUBE_BOX_PROJECTION
|
||||
UNITY_BRANCH
|
||||
if (cubemapPosition.w > 0) {
|
||||
half3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
|
||||
half scalar = min(min(factors.x, factors.y), factors.z);
|
||||
direction = direction * scalar + (position - cubemapPosition);
|
||||
}
|
||||
#endif
|
||||
return direction;
|
||||
}
|
||||
|
||||
half3 GetBoxProjection (half3 direction, float3 position, half4 cubemapPosition, half3 boxMin, half3 boxMax)
|
||||
{
|
||||
#if defined(UNITY_SPECCUBE_BOX_PROJECTION)
|
||||
UNITY_BRANCH
|
||||
if (cubemapPosition.w > 0) {
|
||||
half3 factors =
|
||||
((direction > 0 ? boxMax : boxMin) - position) / direction;
|
||||
half scalar = min(min(factors.x, factors.y), factors.z);
|
||||
direction = direction * scalar + (position - cubemapPosition);
|
||||
}
|
||||
#endif
|
||||
return direction;
|
||||
}
|
||||
|
||||
half3 GetIndirectSpecular(Surface surface, half3 reflDir, float3 worldPos, half3 normal)
|
||||
{
|
||||
half3 spec = half3(0,0,0);
|
||||
#if defined(USE_SPECULAR)
|
||||
#if defined(UNITY_PASS_FORWARDBASE)
|
||||
half3 indirectSpecular;
|
||||
Unity_GlossyEnvironmentData envData;
|
||||
envData.roughness = surface.roughness;
|
||||
envData.reflUVW = GetBoxProjection(
|
||||
reflDir, worldPos,
|
||||
unity_SpecCube0_ProbePosition,
|
||||
unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax
|
||||
);
|
||||
|
||||
half3 probe0 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE(unity_SpecCube0), unity_SpecCube0_HDR, envData);
|
||||
half interpolator = unity_SpecCube0_BoxMin.w;
|
||||
UNITY_BRANCH
|
||||
if (interpolator < 0.99999)
|
||||
{
|
||||
envData.reflUVW = GetBoxProjection(
|
||||
reflDir, worldPos,
|
||||
unity_SpecCube1_ProbePosition,
|
||||
unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax
|
||||
);
|
||||
half3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube0_HDR, envData);
|
||||
indirectSpecular = lerp(probe1, probe0, interpolator);
|
||||
}
|
||||
else
|
||||
{
|
||||
indirectSpecular = probe0;
|
||||
}
|
||||
half horizon = min(1 + dot(reflDir, normal), 1);
|
||||
indirectSpecular *= horizon * horizon;
|
||||
spec = indirectSpecular;
|
||||
#endif
|
||||
#endif
|
||||
return spec;
|
||||
}
|
||||
|
||||
half3 GetRimLight(Surface surface, half attenuation, half svdn, half3 lightCol, half3 indirectCol)
|
||||
{
|
||||
half3 rimlight = half3(0,0,0);
|
||||
|
||||
#if defined(UNITY_PASS_FORWARDBASE) && !defined(VRCHAT_PASS_OUTLINE)
|
||||
UNITY_BRANCH if (USE_RIMLIGHT)
|
||||
{
|
||||
half rimIntensity = saturate((1 - svdn));
|
||||
rimIntensity = smoothstep(surface.rimRange - surface.rimSharpness, surface.rimRange + surface.rimSharpness, rimIntensity);
|
||||
rimlight = rimIntensity * surface.rimIntensity * surface.rimColor * (surface.rimEnvironmental ? lightCol + indirectCol : 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
return rimlight;
|
||||
}
|
||||
|
||||
half3 SampleShadowRampTexture(half uv)
|
||||
{
|
||||
return tex2Dlod(_Ramp, float4(VRCHAT_TRANSFORM_ATLAS_TEX_MODE(float2(uv, 0.5), _Ramp), 0, 0));
|
||||
}
|
||||
|
||||
// math adapted from https://gist.github.com/mairod/a75e7b44f68110e1576d77419d608786?permalink_comment_id=3180018#gistcomment-3180018
|
||||
// rotates in YIQ color space for efficiency
|
||||
half3 ApplyHue(half3 col, half hueAngle, half mask)
|
||||
{
|
||||
UNITY_BRANCH
|
||||
if (hueAngle == 0)
|
||||
{
|
||||
return col;
|
||||
}
|
||||
else
|
||||
{
|
||||
const half3 k = 0.57735;
|
||||
half sinAngle = sin(hueAngle);
|
||||
half cosAngle = cos(hueAngle);
|
||||
half3 shifted = col * cosAngle + cross(k, col) * sinAngle + k * dot(k, col) * (1.0 - cosAngle);
|
||||
return lerp(col, shifted, mask);
|
||||
}
|
||||
}
|
||||
|
||||
half2 GetVRMatcapUV(half3 worldUp, half3 viewDirection, half3 normalDirection)
|
||||
{
|
||||
half3 worldViewUp = normalize(worldUp - viewDirection * dot(viewDirection, worldUp));
|
||||
half3 worldViewRight = normalize(cross(viewDirection, worldViewUp));
|
||||
half2 matcapUV = half2(dot(worldViewRight, normalDirection), dot(worldViewUp, normalDirection)) * 0.5 + 0.5;
|
||||
return matcapUV;
|
||||
}
|
||||
|
||||
half GetAlpha(Surface s, half3 vpos)
|
||||
{
|
||||
half alpha = 1;
|
||||
|
||||
#if defined(_ALPHATEST_ON)
|
||||
if(_AlphaToMask == 1)
|
||||
{
|
||||
#if defined(UNITY_PASS_SHADOWCASTER)
|
||||
clip(s.albedoMap.a - s.cutoff);
|
||||
#else
|
||||
alpha = s.albedoMap.a * s.alpha;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
clip(s.albedoMap.a - s.cutoff);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_ALPHAPREMULTIPLY_ON)
|
||||
alpha = s.albedoMap.a;
|
||||
#if defined(UNITY_PASS_SHADOWCASTER)
|
||||
half dither = GetDither(vpos.xy);
|
||||
clip(alpha - dither);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_ALPHABLEND_ON)
|
||||
alpha = s.alpha;
|
||||
#if defined(UNITY_PASS_SHADOWCASTER)
|
||||
half dither = GetDither(vpos.xy);
|
||||
clip(alpha - dither);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return alpha;
|
||||
}
|
||||
|
||||
#if defined(USE_DETAIL_MAPS)
|
||||
void ApplyDetailMap(Surface surface, inout half4 albedo)
|
||||
{
|
||||
half mask = surface.detailMaskMap;
|
||||
switch (surface.detailMode)
|
||||
{
|
||||
case 0: // AlphaBlended
|
||||
albedo.rgb = lerp(albedo.rgb, surface.detailAlbedoMap.rgb, surface.detailAlbedoMap.a * mask);
|
||||
break;
|
||||
case 1: // Additive
|
||||
albedo.rgb += surface.detailAlbedoMap.rgb * mask;
|
||||
break;
|
||||
case 2: // Multiply
|
||||
albedo.rgb *= LerpWhiteTo(surface.detailAlbedoMap.rgb, mask);
|
||||
break;
|
||||
case 3: // MultiplyX2
|
||||
albedo.rgb *= LerpWhiteTo(surface.detailAlbedoMap.rgb * unity_ColorSpaceDouble.rgb, mask);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
float3 BlendAdditive(float3 base, float3 blend)
|
||||
{
|
||||
return min(1, base + blend);
|
||||
}
|
||||
|
||||
void ApplyColorMask(
|
||||
half4 colorMask,
|
||||
half4 colorMaskColor1,
|
||||
half4 colorMaskColor2,
|
||||
half4 colorMaskColor3,
|
||||
half4 colorMaskColor4,
|
||||
uint blendMode,
|
||||
inout half3 albedo,
|
||||
inout half3 emission)
|
||||
{
|
||||
const float3 grayscaleVector = float3(0.3, 0.59, 0.11);
|
||||
half grayscale = dot(albedo, grayscaleVector);
|
||||
|
||||
half opacity1 = colorMask.r * colorMaskColor1.a;
|
||||
half opacity2 = colorMask.g * colorMaskColor2.a;
|
||||
half opacity3 = colorMask.b * colorMaskColor3.a;
|
||||
half opacity4 = colorMask.a * colorMaskColor4.a;
|
||||
|
||||
UNITY_BRANCH
|
||||
if (blendMode == COLORMASK_BLEND_MULTIPLY)
|
||||
{
|
||||
albedo = lerp(albedo, grayscale * colorMaskColor1.rgb, opacity1);
|
||||
albedo = lerp(albedo, grayscale * colorMaskColor2.rgb, opacity2);
|
||||
albedo = lerp(albedo, grayscale * colorMaskColor3.rgb, opacity3);
|
||||
albedo = lerp(albedo, grayscale * colorMaskColor4.rgb, opacity4);
|
||||
}
|
||||
else if (blendMode == COLORMASK_BLEND_ADDITIVE)
|
||||
{
|
||||
albedo = lerp(albedo, BlendAdditive(grayscale, colorMaskColor1.rgb), opacity1);
|
||||
albedo = lerp(albedo, BlendAdditive(grayscale, colorMaskColor2.rgb), opacity2);
|
||||
albedo = lerp(albedo, BlendAdditive(grayscale, colorMaskColor3.rgb), opacity3);
|
||||
albedo = lerp(albedo, BlendAdditive(grayscale, colorMaskColor4.rgb), opacity4);
|
||||
}
|
||||
|
||||
emission += colorMaskColor1.rgb * colorMask.r * _ColorMaskEmissionStrength1;
|
||||
emission += colorMaskColor2.rgb * colorMask.g * _ColorMaskEmissionStrength2;
|
||||
emission += colorMaskColor3.rgb * colorMask.b * _ColorMaskEmissionStrength3;
|
||||
emission += colorMaskColor4.rgb * colorMask.a * _ColorMaskEmissionStrength4;
|
||||
}
|
||||
|
||||
LightVectors PopulateLightingVectors(Surface surface, float3 worldPos, half3 worldNormal, half3 tangent, half3 bitangent)
|
||||
{
|
||||
LightVectors lv = (LightVectors)0;
|
||||
|
||||
lv.lightEnv = any(_WorldSpaceLightPos0.xyz);
|
||||
lv.lightDir = GetLightDir(lv.lightEnv, worldPos);
|
||||
lv.lightCol = GetLightCol(lv.lightEnv, _LightColor0.rgb, lv.lightDir);
|
||||
lv.viewDir = normalize(_WorldSpaceCameraPos - worldPos);
|
||||
lv.stereoViewDir = GetStereoViewDir(worldPos);
|
||||
lv.fixedVector = normalize(lv.lightDir + lv.viewDir);
|
||||
lv.reflViewDir = reflect(-lv.viewDir, worldNormal);
|
||||
lv.reflLightDir = reflect(lv.lightDir, worldNormal);
|
||||
|
||||
return lv;
|
||||
}
|
||||
|
||||
LightVectors PopulateVertexLightingVectors(LightVectors sharedLightVectors, half3 lightDir, half3 lightCol, half3 worldNormal)
|
||||
{
|
||||
LightVectors lv = (LightVectors)0;
|
||||
|
||||
lv.lightEnv = sharedLightVectors.lightEnv;
|
||||
lv.lightDir = lightDir;
|
||||
lv.lightCol = lightCol;
|
||||
lv.viewDir = sharedLightVectors.viewDir;
|
||||
lv.stereoViewDir = sharedLightVectors.stereoViewDir;
|
||||
lv.fixedVector = normalize(lv.lightDir + lv.viewDir);
|
||||
lv.reflViewDir = sharedLightVectors.reflViewDir;
|
||||
lv.reflLightDir = reflect(lv.lightDir, worldNormal);
|
||||
|
||||
return lv;
|
||||
}
|
||||
|
||||
DotProducts PopulateLightingDotProducts(LightVectors lv, half3 worldNormal, half3 tangent, half3 bitangent)
|
||||
{
|
||||
DotProducts d = (DotProducts)0;
|
||||
|
||||
d.ndl = dot(lv.lightDir, worldNormal); // -1 to 1
|
||||
d.ndl01 = d.ndl * 0.5 + 0.5; // 0 to 1 remapped
|
||||
d.clampedNdl = saturate(d.ndl); // 0 to 1 clamped
|
||||
d.vdn = abs(dot(lv.viewDir, worldNormal));
|
||||
d.svdn = abs(dot(lv.stereoViewDir, worldNormal));
|
||||
d.vdh = dot(lv.viewDir, lv.fixedVector);
|
||||
d.ndh = dot(worldNormal, lv.fixedVector);
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
#if defined(UNITY_PASS_FORWARDBASE)
|
||||
half3 GetDiffuseBRDFBase(Surface surface, DotProducts dotProducts, LightVectors lightVectors, half3 indirectDiffuse, half3 albedo, half attenuation, half occlusion)
|
||||
{
|
||||
// attenuation is on shadow ramp
|
||||
half3 ramp = SampleShadowRampTexture(dotProducts.ndl01 * attenuation);
|
||||
half3 brightness = ramp * occlusion;
|
||||
|
||||
// don't just multiply brightness, this tends to look bad for toon-style skin and materials
|
||||
// instead, color the shadows with albedo + detail
|
||||
brightness = min(1, brightness + surface.shadowBoost);
|
||||
half3 coloredContribution = lerp(albedo.rgb * surface.shadowAlbedo, 1, brightness);
|
||||
|
||||
// clamp light intensity to 0-1 if _LimitBrightness is set
|
||||
return albedo * MaybeSaturate((coloredContribution * lightVectors.lightCol) + indirectDiffuse, surface.limitBrightness) * surface.alpha;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(UNITY_PASS_FORWARDADD) || defined(VERTEXLIGHT_ON)
|
||||
half3 GetDiffuseBRDFAdd(Surface surface, DotProducts dotProducts, LightVectors lightVectors, half3 indirectDiffuse, half3 albedo, half attenuation, half occlusion)
|
||||
{
|
||||
// attenuation is on brightness
|
||||
half3 ramp = SampleShadowRampTexture(dotProducts.ndl01);
|
||||
half3 brightness = ramp * attenuation * occlusion;
|
||||
|
||||
// in add passes we need to pre-multiply attenuation so we start at 0 intensity
|
||||
brightness = min(1, brightness + surface.shadowBoost * attenuation);
|
||||
half3 coloredContribution = lerp(albedo.rgb * surface.shadowAlbedo * attenuation, 1, brightness);
|
||||
|
||||
// clamp light intensity to 0-1 if _LimitBrightness is set
|
||||
return albedo * MaybeSaturate((coloredContribution * lightVectors.lightCol), surface.limitBrightness) * surface.alpha;
|
||||
}
|
||||
#endif
|
||||
|
||||
half3 GetSpecularBRDF(Surface surface, DotProducts dotProducts, LightVectors lv, half attenuation, float3 worldPos, half3 worldNormal, half3 vertexLightSpec, half3 fresnel)
|
||||
{
|
||||
half3 specularBRDF = 0;
|
||||
#if defined(USE_SPECULAR)
|
||||
half3 directSpecular = GetDirectSpecular(surface, dotProducts, fresnel) * attenuation * dotProducts.clampedNdl * lv.lightCol;
|
||||
half3 indirectSpecular = GetIndirectSpecular(surface, lv.reflViewDir, worldPos, worldNormal) * fresnel;
|
||||
specularBRDF = max(0, (indirectSpecular + directSpecular + vertexLightSpec));
|
||||
|
||||
#if defined(_ALPHAPREMULTIPLY_ON)
|
||||
specularBRDF *= surface.alpha;
|
||||
#endif
|
||||
#endif
|
||||
return specularBRDF;
|
||||
}
|
||||
|
||||
#if defined(USE_MATCAP)
|
||||
void ApplyMatcap(Surface surface, LightVectors lv, half3 worldNormal, inout half3 albedo)
|
||||
{
|
||||
const half3 upVector = half3(0,1,0);
|
||||
half2 matcapUV = GetVRMatcapUV(upVector, lv.viewDir, worldNormal);
|
||||
half3 matcap = tex2D(_Matcap, matcapUV).rgb;
|
||||
half strength = surface.matcapStrength * surface.matcapMask;
|
||||
switch (surface.matcapType)
|
||||
{
|
||||
case 0: // Additive (base pass only)
|
||||
#if defined(UNITY_PASS_FORWARDBASE)
|
||||
albedo += matcap * strength;
|
||||
#endif
|
||||
break;
|
||||
case 1: // Multiplicative
|
||||
albedo *= lerp(1, matcap, strength);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void PopulateVertexLights(Surface surface, LightVectors lv, float3 worldPos, half3 worldNormal, half3 tangent, half3 bitangent, half3 f0, half3 albedo, half occlusion, inout half3 vertexLightDiff, inout half3 vertexLightSpec)
|
||||
{
|
||||
#if defined(VERTEXLIGHT_ON)
|
||||
VertexLightInformation vLight = (VertexLightInformation)0;
|
||||
LightVectors vLightVectors = (LightVectors)0;
|
||||
DotProducts vDotProducts = (DotProducts)0;
|
||||
|
||||
Get4VertexLightsColFalloff(/* inout */ vLight, worldPos, worldNormal);
|
||||
GetVertexLightsDir(/* inout */ vLight, worldPos);
|
||||
|
||||
UNITY_LOOP
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
vLightVectors = PopulateVertexLightingVectors(lv, vLight.Direction[i], vLight.ColorFalloff[i], worldNormal);
|
||||
vDotProducts = PopulateLightingDotProducts(vLightVectors, worldNormal, tangent, bitangent);
|
||||
|
||||
// run the full BRDF, just pretend it's a FORWARDADD pass - our lighting model is cheap enough that this should be fine
|
||||
vertexLightDiff += GetDiffuseBRDFAdd(surface, vDotProducts, vLightVectors, 0, albedo, vLight.ColorFalloff[i], occlusion);
|
||||
|
||||
#if defined(USE_SPECULAR)
|
||||
half3 vFresnel = GetSpecularFresnel(vDotProducts, f0);
|
||||
half3 vLspec = GetDirectSpecular(surface, vDotProducts, vFresnel) * vDotProducts.clampedNdl;
|
||||
vertexLightSpec += vLspec * vLight.ColorFalloff[i];
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
vertexLightDiff = 0;
|
||||
vertexLightSpec = 0;
|
||||
#endif
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22d0da77cb6061342968d9087151cdd1
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,71 @@
|
||||
half4 VRChatLightingBRDF(UNITY_POSITION(vpos), v2f i, Surface surface)
|
||||
{
|
||||
UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos.xyz);
|
||||
// fix for rare bug where light atten is 0 when there is no directional light in the scene
|
||||
#ifdef UNITY_PASS_FORWARDBASE
|
||||
if(all(_LightColor0.rgb == 0.0)) { attenuation = 1.0; }
|
||||
#endif
|
||||
|
||||
#if !defined(UNITY_PASS_SHADOWCASTER)
|
||||
half3 worldNormal = i.normal;
|
||||
half3 tangent = i.tangent.xyz;
|
||||
half3 bitangent = cross(worldNormal, tangent) * sign(i.tangent.w);
|
||||
float3 worldPos = i.worldPos;
|
||||
GetSurfaceNormals(surface, bitangent, tangent, worldNormal);
|
||||
|
||||
LightVectors lightVectors = PopulateLightingVectors(surface, worldPos, worldNormal, tangent, bitangent);
|
||||
DotProducts dotProducts = PopulateLightingDotProducts(lightVectors, worldNormal, tangent, bitangent);
|
||||
|
||||
half4 albedo = surface.albedoMap;
|
||||
#if defined(USE_DETAIL_MAPS)
|
||||
ApplyDetailMap(surface, /* inout */ albedo);
|
||||
#endif
|
||||
half3 diffuseColor = albedo.rgb;
|
||||
albedo.rgb *= (1.0 - surface.metallic);
|
||||
surface.alpha = GetAlpha(surface, i.pos);
|
||||
half occlusion = surface.occlusionMap;
|
||||
|
||||
half3 emission = 0;
|
||||
#if defined(USE_EMISSION_MAP) && defined(UNITY_PASS_FORWARDBASE) // We don't want emission in shadow or add pass.
|
||||
emission = surface.emissionMap;
|
||||
#endif
|
||||
|
||||
// minimum brightness has a max of 0.1 so just apply it unconditionally, little risk of blowing anything out
|
||||
emission += surface.minBrightness * albedo;
|
||||
|
||||
// f0 is specular color
|
||||
half3 f0 = half3(0,0,0);
|
||||
half3 fresnel = half3(0,0,0);
|
||||
|
||||
#if defined(USE_SPECULAR)
|
||||
f0 = 0.16 * surface.reflectance * surface.reflectance * (1.0 - surface.metallic) + diffuseColor * surface.metallic;
|
||||
fresnel = GetSpecularFresnel(dotProducts, f0) * saturate((surface.reflectance + surface.metallic) * 4.0f);
|
||||
#endif
|
||||
|
||||
#if defined(USE_MATCAP)
|
||||
ApplyMatcap(surface, lightVectors, worldNormal, /* inout */ albedo.rgb);
|
||||
#endif
|
||||
|
||||
half3 vertexLightDiff = 0;
|
||||
half3 vertexLightSpec = 0;
|
||||
PopulateVertexLights(surface, lightVectors, worldPos, worldNormal, tangent, bitangent, f0, albedo, occlusion, vertexLightDiff, vertexLightSpec);
|
||||
|
||||
half3 indirectDiffuse = GetIndirectDiffuse() * occlusion;
|
||||
#if defined(UNITY_PASS_FORWARDBASE)
|
||||
half3 diffuseBRDF = GetDiffuseBRDFBase(surface, dotProducts, lightVectors, indirectDiffuse, albedo, attenuation, occlusion);
|
||||
#else
|
||||
half3 diffuseBRDF = GetDiffuseBRDFAdd(surface, dotProducts, lightVectors, indirectDiffuse, albedo, attenuation, occlusion);
|
||||
#endif
|
||||
half3 specularBRDF = GetSpecularBRDF(surface, dotProducts, lightVectors, attenuation, worldPos, worldNormal, vertexLightSpec, fresnel);
|
||||
half3 rimLight = GetRimLight(surface, attenuation, dotProducts.svdn, lightVectors.lightCol, indirectDiffuse);
|
||||
rimLight *= LerpWhiteTo(diffuseColor, surface.rimAlbedoTint);
|
||||
|
||||
half3 litFragment = diffuseBRDF + specularBRDF + vertexLightDiff + emission + rimLight;
|
||||
|
||||
half4 finalColor = half4(litFragment, surface.alpha);
|
||||
UNITY_APPLY_FOG(i.fogCoord, finalColor);
|
||||
return finalColor;
|
||||
#else
|
||||
return half4(0, 0, 0, GetAlpha(surface, i.pos));
|
||||
#endif
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e9e977e5b9ee48488ee8f6748a0f2bd
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,93 @@
|
||||
struct v2f_outline
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
half3 color : TEXCOORD1;
|
||||
|
||||
UNITY_FOG_COORDS(2)
|
||||
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
VRCHAT_ATLAS_VERTEX_OUTPUT
|
||||
};
|
||||
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _OutlineThickness);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half3, _OutlineColor);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half, _OutlineFromAlbedo);
|
||||
|
||||
sampler2D _OutlineMask;
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(half4, _OutlineMask_ST);
|
||||
VRCHAT_DEFINE_ATLAS_PROPERTY(uint, _OutlineMaskChannel);
|
||||
VRCHAT_DEFINE_ATLAS_TEXTUREMODE(_OutlineMask);
|
||||
|
||||
// When an avatar scales really small, the outline (since it's calculated in world space) becomes really thick.
|
||||
// This function clamps the outline scale based on the screen-space length of the normal offset, avoiding that
|
||||
// issue at the cost of a bit of a fudge factor chosen to accomodate the typical avatar scale range in VRChat.
|
||||
float4 GetScreenSpaceClampedOffsetClipPosition(float3 worldPos, float3 offsetWorldPos, float thickness)
|
||||
{
|
||||
float4 clipPos = UnityWorldToClipPos(float4(worldPos, 1));
|
||||
float4 offsetClipPos = UnityWorldToClipPos(float4(offsetWorldPos, 1));
|
||||
float dist = distance(clipPos.xy / clipPos.w, offsetClipPos.xy / offsetClipPos.w);
|
||||
if (dist <= 0.0001f) // avoid division by zero
|
||||
return offsetClipPos;
|
||||
float clampedDistance = min(dist, 0.05f * thickness);
|
||||
return lerp(clipPos, offsetClipPos, clampedDistance / dist);
|
||||
}
|
||||
|
||||
v2f_outline vert_outline (appdata v)
|
||||
{
|
||||
v2f_outline o = (v2f_outline)0;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
VRCHAT_ATLAS_INITIALIZE_VERTEX_OUTPUT(v, o);
|
||||
VRCHAT_SETUP_ATLAS_INDEX_POST_VERTEX(o);
|
||||
|
||||
uint maskChannel = VRCHAT_GET_ATLAS_PROPERTY(_OutlineMaskChannel);
|
||||
float mask = tex2Dlod(_OutlineMask, half4(v.uv, 0, 0))[maskChannel];
|
||||
float thickness = VRCHAT_GET_ATLAS_PROPERTY(_OutlineThickness);
|
||||
|
||||
if (thickness <= 0)
|
||||
{
|
||||
o.pos = float4(0, 0, 0, 0);
|
||||
return o;
|
||||
}
|
||||
|
||||
float3 worldNormal = UnityObjectToWorldNormal(v.normal);
|
||||
float3 worldPos = mul(unity_ObjectToWorld, float4(v.vertex.xyz, 1)).xyz;
|
||||
float3 offsetWorldPos = worldPos + worldNormal * thickness * mask * 0.01;
|
||||
|
||||
o.pos = GetScreenSpaceClampedOffsetClipPosition(worldPos, offsetWorldPos, thickness);
|
||||
o.uv = v.uv;
|
||||
|
||||
UNITY_BRANCH if (VRCHAT_GET_ATLAS_PROPERTY(_VertexColor))
|
||||
o.color = v.color;
|
||||
else
|
||||
o.color = half3(1, 1, 1);
|
||||
|
||||
UNITY_TRANSFER_FOG(o, o.pos);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag_outline (v2f_outline i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
VRCHAT_SETUP_ATLAS_INDEX_POST_VERTEX(i);
|
||||
|
||||
half3 outlineColor = VRCHAT_GET_ATLAS_PROPERTY(_OutlineColor);
|
||||
half outlineFromAlbedo = VRCHAT_GET_ATLAS_PROPERTY(_OutlineFromAlbedo);
|
||||
|
||||
half3 color = outlineColor;
|
||||
|
||||
UNITY_BRANCH if (outlineFromAlbedo)
|
||||
{
|
||||
half3 albedo = tex2D(_MainTex, VRCHAT_TRANSFORM_ATLAS_TEX_MODE(i.uv, _MainTex)).rgb;
|
||||
albedo *= VRCHAT_GET_ATLAS_PROPERTY(_Color).rgb;
|
||||
albedo *= i.color;
|
||||
color = lerp(color, albedo, outlineFromAlbedo);
|
||||
}
|
||||
|
||||
half4 finalColor = half4(color, 1);
|
||||
UNITY_APPLY_FOG(i.fogCoord, finalColor);
|
||||
return finalColor;
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 934af42828b554d499e6b39635b75760
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,20 @@
|
||||
// atlasing support
|
||||
#ifndef VRCHAT_ATLASING_INCLUDED
|
||||
#define VRCHAT_ATLASING_INCLUDED
|
||||
|
||||
#ifdef VRCHAT_ATLASING_ENABLED
|
||||
// TODO
|
||||
#else
|
||||
#define VRCHAT_DEFINE_ATLAS_PROPERTY(type, name) type name
|
||||
#define VRCHAT_DEFINE_ATLAS_TEXTUREMODE(name)
|
||||
#define VRCHAT_GET_ATLAS_PROPERTY(name) name
|
||||
#define VRCHAT_ATLAS_VERTEX_INPUT
|
||||
#define VRCHAT_ATLAS_VERTEX_OUTPUT
|
||||
#define VRCHAT_TRANSFORM_ATLAS_TEX(tex, name) (tex.xy * name##_ST.xy + name##_ST.zw)
|
||||
#define VRCHAT_TRANSFORM_ATLAS_TEX_MODE(tex, name) (tex.xy * name##_ST.xy + name##_ST.zw)
|
||||
#define VRCHAT_ATLAS_INITIALIZE_VERTEX_OUTPUT(input, output)
|
||||
#define VRCHAT_ATLAS_TRANSFER_VERTEX_OUTPUT(input, output)
|
||||
#define VRCHAT_SETUP_ATLAS_INDEX_POST_VERTEX(input)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79e7b17e52656104da27c3a02065ebc9
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,150 @@
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o = (v2f)0;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
VRCHAT_ATLAS_INITIALIZE_VERTEX_OUTPUT(v, o);
|
||||
VRCHAT_SETUP_ATLAS_INDEX_POST_VERTEX(o);
|
||||
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv.xy = v.uv;
|
||||
o.uv.zw = v.uv1;
|
||||
|
||||
UNITY_BRANCH if (VRCHAT_GET_ATLAS_PROPERTY(_VertexColor))
|
||||
o.color = v.color;
|
||||
else
|
||||
o.color = half4(1, 1, 1, 1);
|
||||
|
||||
#if !defined(UNITY_PASS_SHADOWCASTER)
|
||||
o.worldPos = mul(unity_ObjectToWorld, v.vertex);
|
||||
o.viewDir = normalize(UnityWorldSpaceViewDir(o.worldPos));
|
||||
half3 wnormal = UnityObjectToWorldNormal(v.normal);
|
||||
half3 tangent = UnityObjectToWorldDir(v.tangent.xyz);
|
||||
o.normal = wnormal;
|
||||
o.tangent.xyz = tangent;
|
||||
o.tangent.w = v.tangent.w * unity_WorldTransformParams.w;
|
||||
|
||||
UNITY_TRANSFER_SHADOW(o, o.uv);
|
||||
UNITY_TRANSFER_FOG(o, o.pos);
|
||||
#else
|
||||
TRANSFER_SHADOW_CASTER_NOPOS(o, o.pos);
|
||||
#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag (v2f i, uint facing : SV_IsFrontFace) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
VRCHAT_SETUP_ATLAS_INDEX_POST_VERTEX(i);
|
||||
|
||||
Surface surface = (Surface)0;
|
||||
|
||||
float2 uv0 = i.uv.xy;
|
||||
|
||||
//surface.cutoff = material.cutoff;
|
||||
|
||||
surface.albedoMap = tex2D(_MainTex, VRCHAT_TRANSFORM_ATLAS_TEX_MODE(uv0, _MainTex))
|
||||
* VRCHAT_GET_ATLAS_PROPERTY(_Color)
|
||||
* half4(i.color, 1);
|
||||
|
||||
#if !defined(UNITY_PASS_SHADOWCASTER)
|
||||
float2 hueShiftDdx = ddx(uv0);
|
||||
float2 hueShiftDdy = ddy(uv0);
|
||||
half hueShiftMask = 0;
|
||||
UNITY_BRANCH if (USE_HUE_SHIFT)
|
||||
{
|
||||
hueShiftMask = SAMPLE_MASK_GRAD(_HueShiftMask, uv0, hueShiftDdx, hueShiftDdy);
|
||||
surface.albedoMap.rgb = ApplyHue(surface.albedoMap.rgb, VRCHAT_GET_ATLAS_PROPERTY(_HueShift), hueShiftMask);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(USE_NORMAL_MAPS)
|
||||
half bumpScale = VRCHAT_GET_ATLAS_PROPERTY(_BumpScale);
|
||||
surface.normalMap = UnpackScaleNormal(tex2D(_BumpMap, VRCHAT_TRANSFORM_ATLAS_TEX_MODE(uv0, _BumpMap)), bumpScale);
|
||||
#else
|
||||
surface.normalMap = half3(0, 0, 1);
|
||||
#endif
|
||||
|
||||
if (!facing)
|
||||
{
|
||||
// flip normal direction for backfaces
|
||||
surface.normalMap = -surface.normalMap;
|
||||
}
|
||||
|
||||
surface.shadowBoost = VRCHAT_GET_ATLAS_PROPERTY(_ShadowBoost);
|
||||
surface.shadowAlbedo = VRCHAT_GET_ATLAS_PROPERTY(_ShadowAlbedo);
|
||||
surface.minBrightness = VRCHAT_GET_ATLAS_PROPERTY(_MinBrightness);
|
||||
surface.limitBrightness = VRCHAT_GET_ATLAS_PROPERTY(_LimitBrightness);
|
||||
|
||||
#if defined(USE_EMISSION_MAP)
|
||||
uint emissionUVidx = VRCHAT_GET_ATLAS_PROPERTY(_EmissionUV);
|
||||
float2 emissionUV = SelectUV(i.uv, emissionUVidx);
|
||||
surface.emissionMap = tex2D(_EmissionMap, VRCHAT_TRANSFORM_ATLAS_TEX_MODE(emissionUV, _EmissionMap)).rgb
|
||||
* VRCHAT_GET_ATLAS_PROPERTY(_EmissionColor)
|
||||
* VRCHAT_GET_ATLAS_PROPERTY(_EmissionStrength);
|
||||
UNITY_BRANCH if (USE_HUE_SHIFT)
|
||||
surface.emissionMap.rgb = ApplyHue(surface.emissionMap.rgb, VRCHAT_GET_ATLAS_PROPERTY(_EmissionHueShift), hueShiftMask);
|
||||
#endif
|
||||
|
||||
#if !defined(UNITY_PASS_SHADOWCASTER)
|
||||
float2 colorMaskUv = VRCHAT_TRANSFORM_ATLAS_TEX_MODE(uv0, _ColorMask);
|
||||
float2 colorMaskDdx = ddx(colorMaskUv);
|
||||
float2 colorMaskDdy = ddy(colorMaskUv);
|
||||
UNITY_BRANCH if (USE_COLOR_MASK)
|
||||
{
|
||||
half4 colorMask = tex2Dgrad(_ColorMask, colorMaskUv, colorMaskDdx, colorMaskDdy);
|
||||
ApplyColorMask(colorMask, _ColorMaskColor1, _ColorMaskColor2, _ColorMaskColor3, _ColorMaskColor4, _ColorMaskBlendMode, /*inout*/ surface.albedoMap.rgb, /*inout*/ surface.emissionMap.rgb);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(USE_OCCLUSION_MAP)
|
||||
surface.occlusionMap = lerp(1, SAMPLE_MASK(_OcclusionMap, uv0), VRCHAT_GET_ATLAS_PROPERTY(_OcclusionStrength));
|
||||
#else
|
||||
surface.occlusionMap = 1;
|
||||
#endif
|
||||
|
||||
#if defined(UNITY_PASS_FORWARDBASE) && !defined(VRCHAT_PASS_OUTLINE)
|
||||
UNITY_BRANCH if (USE_RIMLIGHT)
|
||||
{
|
||||
surface.rimColor = VRCHAT_GET_ATLAS_PROPERTY(_RimColor);
|
||||
surface.rimAlbedoTint = VRCHAT_GET_ATLAS_PROPERTY(_RimAlbedoTint);
|
||||
surface.rimIntensity = VRCHAT_GET_ATLAS_PROPERTY(_RimIntensity);
|
||||
surface.rimRange = 1 - VRCHAT_GET_ATLAS_PROPERTY(_RimRange);
|
||||
surface.rimSharpness = VRCHAT_GET_ATLAS_PROPERTY(_RimSharpness);
|
||||
surface.rimEnvironmental = VRCHAT_GET_ATLAS_PROPERTY(_RimEnvironmental);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(USE_DETAIL_MAPS)
|
||||
uint detailUVidx = VRCHAT_GET_ATLAS_PROPERTY(_DetailUV);
|
||||
float2 detailUV = SelectUV(i.uv, detailUVidx);
|
||||
surface.detailMode = VRCHAT_GET_ATLAS_PROPERTY(_DetailMode);
|
||||
surface.detailMaskMap = SAMPLE_MASK(_DetailMask, uv0); // always use uv0 for mask
|
||||
surface.detailAlbedoMap = tex2D(_DetailAlbedoMap, VRCHAT_TRANSFORM_ATLAS_TEX_MODE(detailUV, _DetailAlbedoMap));
|
||||
#if defined(USE_NORMAL_MAPS)
|
||||
half detailNormalMapScale = VRCHAT_GET_ATLAS_PROPERTY(_DetailNormalMapScale) * surface.detailMaskMap;
|
||||
surface.detailNormalMap = UnpackScaleNormal(tex2D(_DetailNormalMap, VRCHAT_TRANSFORM_ATLAS_TEX_MODE(detailUV, _DetailNormalMap)), detailNormalMapScale);
|
||||
#endif
|
||||
UNITY_BRANCH if (USE_HUE_SHIFT)
|
||||
surface.detailAlbedoMap.rgb = ApplyHue(surface.detailAlbedoMap.rgb, VRCHAT_GET_ATLAS_PROPERTY(_DetailHueShift), hueShiftMask);
|
||||
#endif
|
||||
|
||||
#if defined(USE_SPECULAR)
|
||||
surface.metallic = SAMPLE_MASK(_MetallicMap, uv0) * VRCHAT_GET_ATLAS_PROPERTY(_MetallicStrength);
|
||||
float glossMap = SAMPLE_MASK(_GlossMap, uv0);
|
||||
float smoothness = glossMap * VRCHAT_GET_ATLAS_PROPERTY(_GlossStrength);
|
||||
surface.roughness = 1 - max(smoothness, GetGeometricSpecularAA(i.normal));
|
||||
surface.reflectance = glossMap * VRCHAT_GET_ATLAS_PROPERTY(_Reflectance);
|
||||
surface.specularSharpness = VRCHAT_GET_ATLAS_PROPERTY(_SpecularSharpness);
|
||||
#endif
|
||||
|
||||
#if defined(USE_MATCAP)
|
||||
surface.matcapMask = SAMPLE_MASK(_MatcapMask, uv0);
|
||||
surface.matcapType = VRCHAT_GET_ATLAS_PROPERTY(_MatcapType);
|
||||
surface.matcapStrength = VRCHAT_GET_ATLAS_PROPERTY(_MatcapStrength);
|
||||
#endif
|
||||
|
||||
return VRChatLightingBRDF(i.pos, i, surface);
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 92b2c32677a9f3c4594a620e606ce309
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51ca8b33f002e3e459db426abb4997b0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b472e790e18a5534e90b40b0403ecad5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,153 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ed41581528c4fa4fa11970aca4edb8d
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 0
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 32
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 6.5 KiB |
@ -0,0 +1,153 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 348500adef1d2da428abc7b720b8b699
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 128
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 2
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 7.2 KiB |
@ -0,0 +1,140 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 636cf1b5dfca6f54b94ca3d2ff8216c9
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 128
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 2
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: 63
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 7.4 KiB |
@ -0,0 +1,140 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f304bf7a07313d43b8562d9eabce646
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 128
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 2
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,140 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dfafc89321615114fb6dbecdba0c8214
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 0
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 32
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,140 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d1b50be612cf1248b6e101f8d1c5b53
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 0
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 32
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,140 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d6a7a9ec31ab7448a777f0e2daef4af
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 0
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 32
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,239 @@
|
||||
// A fairly feature-full shader for toon-style shading in VRChat. Allowed on mobile avatars.
|
||||
Shader "VRChat/Mobile/Toon Standard"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Enum(Off, 0, Front, 1, Back, 2)] _Culling ("Culling", Int) = 2
|
||||
//[Enum(Opaque, 0)] _BlendMode("Blend Mode", Int) = 0
|
||||
//[Enum(Opaque, 0, Cutout, 1, Cutout Plus, 2, Transparent, 3, Fade, 4)] _BlendMode("Blend Mode", Int) = 0
|
||||
|
||||
_Color ("Main Color", Color) = (1,1,1,1)
|
||||
_MainTex ("Main Texture", 2D) = "white" {}
|
||||
//_Cutoff ("Alpha Cutoff", Range(0,1)) = 0.5
|
||||
[ToggleUI] _VertexColor ("Apply Vertex Color", Float) = 0.0
|
||||
|
||||
_Ramp ("Shadow Ramp", 2D) = "white" {}
|
||||
_ShadowBoost ("Shadow Boost", Range(0,1)) = 0.0
|
||||
_ShadowAlbedo ("Shadow Tint", Range(0,1)) = 0.5
|
||||
[PowerSlider(2)] _MinBrightness ("Min Brightness", Range(0,0.1)) = 0.0
|
||||
[ToggleUI] _LimitBrightness ("Limit Brightness", Float) = 1.0
|
||||
|
||||
[Normal] _BumpMap ("Normal Map", 2D) = "bump" {}
|
||||
_BumpScale ("Normal Scale", Float) = 1.0
|
||||
|
||||
_MetallicMap ("Metallic Map", 2D) = "white" {}
|
||||
[Enum(Red, 0, Green, 1, Blue, 2, Alpha, 3)] _MetallicMapChannel ("Color Channel", Int) = 0
|
||||
_MetallicStrength ("Metallic Strength", Range(0,1)) = 0
|
||||
_GlossMap ("Gloss Map", 2D) = "white" {}
|
||||
[Enum(Red, 0, Green, 1, Blue, 2, Alpha, 3)] _GlossMapChannel ("Color Channel", Int) = 3
|
||||
_GlossStrength ("Gloss Strength", Range(0,1)) = 0.5
|
||||
_Reflectance ("Reflectance", Range(0,1)) = 0.5
|
||||
_SpecularSharpness("Sharpness", Range(0,1)) = 0
|
||||
|
||||
_Matcap ("Matcap", 2D) = "white" {}
|
||||
_MatcapMask ("Matcap Mask", 2D) = "white" {}
|
||||
[Enum(Red, 0, Green, 1, Blue, 2, Alpha, 3)] _MatcapMaskChannel ("Color Channel", Int) = 0
|
||||
[Enum(Additive, 0, Multiplicative, 1)] _MatcapType ("Matcap Type", Int) = 0
|
||||
_MatcapStrength ("Matcap Strength", Range(0,1)) = 1.0
|
||||
|
||||
_RimColor("Color", Color) = (1,1,1,1)
|
||||
_RimAlbedoTint("Albedo Tint", Range(0,1)) = 0.0
|
||||
_RimIntensity("Intensity", Range(0,1)) = 0.5
|
||||
_RimRange("Range", Range(0,1)) = 0.3
|
||||
_RimSharpness("Softness", Range(0,1)) = 0.1
|
||||
[ToggleUI] _RimEnvironmental("Environmental", Float) = 0.0
|
||||
|
||||
_EmissionMap ("Emission Map", 2D) = "white" {}
|
||||
_EmissionColor ("Emission Color", Color) = (0,0,0)
|
||||
_EmissionStrength ("Strength", Range(0, 2)) = 1
|
||||
[Enum(UV0, 0, UV1, 1)] _EmissionUV ("UV Map", Int) = 0
|
||||
|
||||
_OcclusionMap ("Occlusion Map", 2D) = "white" {}
|
||||
[Enum(Red, 0, Green, 1, Blue, 2, Alpha, 3)] _OcclusionMapChannel ("Color Channel", Int) = 1
|
||||
_OcclusionStrength ("Occlusion Strength", Range(0,1)) = 1
|
||||
|
||||
[Enum(AlphaBlended, 0, Additive, 1, Multiply, 2, MultiplyX2, 3)] _DetailMode ("Detail Mode", Int) = 0
|
||||
_DetailMask ("Detail Mask", 2D) = "white" {}
|
||||
[Enum(Red, 0, Green, 1, Blue, 2, Alpha, 3)] _DetailMaskChannel ("Color Channel", Int) = 3
|
||||
_DetailAlbedoMap ("Detail Texture", 2D) = "black" {}
|
||||
_DetailNormalMap ("Detail Normal Map", 2D) = "bump" {}
|
||||
_DetailNormalMapScale ("Detail Normal Scale", Float) = 1.0
|
||||
[Enum(UV0, 0, UV1, 1)] _DetailUV ("UV Map", Int) = 0
|
||||
|
||||
_HueShift ("Albedo Hue Shift", Range(0,6.283185)) = 0
|
||||
_DetailHueShift ("Detail Hue Shift", Range(0,6.283185)) = 0
|
||||
_EmissionHueShift ("Emission Hue Shift", Range(0,6.283185)) = 0
|
||||
_HueShiftMask ("Hue Shift Mask", 2D) = "white" {}
|
||||
[Enum(Red, 0, Green, 1, Blue, 2, Alpha, 3)] _HueShiftMaskChannel ("Color Channel", Int) = 1
|
||||
|
||||
_ColorMask ("Color Mask", 2D) = "black" {}
|
||||
_ColorMaskColor1("Color 1", Color) = (1,1,1,1)
|
||||
_ColorMaskEmissionStrength1("Color 1 Emission", Range(0,2)) = 0
|
||||
_ColorMaskColor2("Color 2", Color) = (1,1,1,1)
|
||||
_ColorMaskEmissionStrength2("Color 2 Emission", Range(0,2)) = 0
|
||||
_ColorMaskColor3("Color 3", Color) = (1,1,1,1)
|
||||
_ColorMaskEmissionStrength3("Color 3 Emission", Range(0,2)) = 0
|
||||
_ColorMaskColor4("Color 4", Color) = (1,1,1,1)
|
||||
_ColorMaskEmissionStrength4("Color 4 Emission", Range(0,2)) = 0
|
||||
|
||||
[Enum(Multiply, 0, Additive, 1)] _ColorMaskBlendMode("Color Mask Blend Mode", Int) = 0
|
||||
|
||||
//[Enum(UnityEngine.Rendering.BlendMode)]_SrcBlend ("__src", int) = 1
|
||||
//[Enum(UnityEngine.Rendering.BlendMode)]_DstBlend ("__dst", int) = 0
|
||||
//[Enum(Off,0,On,1)]_ZWrite ("__zw", int) = 1
|
||||
//_AlphaToMask ("Alpha To Mask", Int) = 0
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Cull [_Culling]
|
||||
//AlphaToMask [_AlphaToMask]
|
||||
AlphaToMask Off
|
||||
|
||||
Tags { "VRCFallback" = "toonstandard" "RenderType" = "Opaque" }
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "FORWARD"
|
||||
Tags { "LightMode" = "ForwardBase" }
|
||||
|
||||
//Blend [_SrcBlend] [_DstBlend]
|
||||
Blend One Zero
|
||||
//ZWrite [_ZWrite]
|
||||
ZWrite On
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fog
|
||||
#pragma multi_compile_fwdbase
|
||||
#pragma multi_compile _ VERTEXLIGHT_ON
|
||||
//#pragma shader_feature_local_fragment _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
|
||||
//#pragma multi_compile _ VRCHAT_ATLASING_ENABLED
|
||||
|
||||
#pragma shader_feature_local_fragment _ USE_SPECULAR
|
||||
#pragma shader_feature_local_fragment _ USE_MATCAP
|
||||
#pragma shader_feature_local_fragment _ USE_DETAIL_MAPS
|
||||
#pragma shader_feature_local_fragment _ USE_NORMAL_MAPS
|
||||
#pragma shader_feature_local_fragment _ USE_OCCLUSION_MAP
|
||||
#pragma dynamic_branch_local_fragment _ USE_RIMLIGHT
|
||||
#pragma dynamic_branch_local_fragment _ USE_HUE_SHIFT
|
||||
#pragma dynamic_branch_local_fragment _ USE_COLOR_MASK
|
||||
|
||||
// this one is practically free in terms of performance, so save some variants by always enabling it for now
|
||||
#define USE_EMISSION_MAP
|
||||
|
||||
// disable variants that are not needed, including realtime shadows (not supported)
|
||||
#pragma skip_variants LIGHTMAP_ON DYNAMICLIGHTMAP_ON DIRLIGHTMAP_COMBINED STEREO_CUBEMAP_RENDER_ON
|
||||
#pragma skip_variants SHADOWS_DEPTH SHADOWS_SCREEN SHADOWS_CUBE SHADOWS_SOFT SHADOWS_SHADOWMASK LIGHTMAP_SHADOW_MIXING
|
||||
|
||||
#ifndef UNITY_PASS_FORWARDBASE
|
||||
#define UNITY_PASS_FORWARDBASE
|
||||
#endif
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityPBSLighting.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
#include "Lighting.cginc"
|
||||
#include "./CG/VRCAtlasingShim.cginc"
|
||||
#include "./CG/DataStructs.cginc"
|
||||
#include "./CG/Definitions.cginc"
|
||||
#include "./CG/Helpers.cginc"
|
||||
#include "./CG/Lighting.cginc"
|
||||
#include "./CG/VertexFragment.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "FWDADD"
|
||||
Tags { "LightMode" = "ForwardAdd" }
|
||||
|
||||
//Blend [_SrcBlend] One
|
||||
Blend One One
|
||||
ZWrite Off
|
||||
ZTest LEqual
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fog
|
||||
#pragma multi_compile_fwdadd_fullshadow
|
||||
//#pragma shader_feature_local_fragment _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
|
||||
//#pragma multi_compile _ VRCHAT_ATLASING_ENABLED
|
||||
|
||||
#pragma shader_feature_local_fragment _ USE_SPECULAR
|
||||
#pragma shader_feature_local_fragment _ USE_MATCAP
|
||||
#pragma shader_feature_local_fragment _ USE_DETAIL_MAPS
|
||||
#pragma shader_feature_local_fragment _ USE_NORMAL_MAPS
|
||||
#pragma shader_feature_local_fragment _ USE_OCCLUSION_MAP
|
||||
#pragma dynamic_branch_local_fragment _ USE_RIMLIGHT
|
||||
#pragma dynamic_branch_local_fragment _ USE_HUE_SHIFT
|
||||
#pragma dynamic_branch_local_fragment _ USE_COLOR_MASK
|
||||
|
||||
// disable variants that are not needed, including realtime shadows (not supported)
|
||||
#pragma skip_variants LIGHTMAP_ON DYNAMICLIGHTMAP_ON DIRLIGHTMAP_COMBINED STEREO_CUBEMAP_RENDER_ON
|
||||
#pragma skip_variants SHADOWS_DEPTH SHADOWS_SCREEN SHADOWS_CUBE SHADOWS_SOFT SHADOWS_SHADOWMASK LIGHTMAP_SHADOW_MIXING
|
||||
|
||||
#ifndef UNITY_PASS_FORWARDADD
|
||||
#define UNITY_PASS_FORWARDADD
|
||||
#endif
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityPBSLighting.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
#include "Lighting.cginc"
|
||||
#include "./CG/VRCAtlasingShim.cginc"
|
||||
#include "./CG/DataStructs.cginc"
|
||||
#include "./CG/Definitions.cginc"
|
||||
#include "./CG/Helpers.cginc"
|
||||
#include "./CG/Lighting.cginc"
|
||||
#include "./CG/VertexFragment.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "SHADOWCASTER"
|
||||
Tags { "LightMode" = "ShadowCaster" }
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_shadowcaster
|
||||
//#pragma shader_feature_local_fragment _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
|
||||
//#pragma multi_compile _ VRCHAT_ATLASING_ENABLED
|
||||
|
||||
#ifndef UNITY_PASS_SHADOWCASTER
|
||||
#define UNITY_PASS_SHADOWCASTER
|
||||
#endif
|
||||
|
||||
// disable variants that are not needed, including realtime shadows (not supported)
|
||||
#pragma skip_variants LIGHTMAP_ON DYNAMICLIGHTMAP_ON DIRLIGHTMAP_COMBINED STEREO_CUBEMAP_RENDER_ON
|
||||
#pragma skip_variants SHADOWS_DEPTH SHADOWS_SCREEN SHADOWS_CUBE SHADOWS_SOFT SHADOWS_SHADOWMASK LIGHTMAP_SHADOW_MIXING
|
||||
#pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityPBSLighting.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
#include "Lighting.cginc"
|
||||
#include "./CG/VRCAtlasingShim.cginc"
|
||||
#include "./CG/DataStructs.cginc"
|
||||
#include "./CG/Definitions.cginc"
|
||||
#include "./CG/Helpers.cginc"
|
||||
#include "./CG/Lighting.cginc"
|
||||
#include "./CG/VertexFragment.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback "VRChat/Mobile/Diffuse"
|
||||
CustomEditor "VRC.ToonStandard.ToonStandardShaderEditor"
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e765db0afa7ecfc44ade2e4e2491f65a
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures:
|
||||
- _MainTex: {instanceID: 0}
|
||||
- _Ramp: {fileID: 2800000, guid: 636cf1b5dfca6f54b94ca3d2ff8216c9, type: 3}
|
||||
- _BumpMap: {instanceID: 0}
|
||||
- _MetallicMap: {instanceID: 0}
|
||||
- _GlossMap: {instanceID: 0}
|
||||
- _Matcap: {instanceID: 0}
|
||||
- _MatcapMask: {instanceID: 0}
|
||||
- _EmissionMap: {instanceID: 0}
|
||||
- _OcclusionMap: {instanceID: 0}
|
||||
- _DetailMask: {instanceID: 0}
|
||||
- _DetailAlbedoMap: {instanceID: 0}
|
||||
- _DetailNormalMap: {instanceID: 0}
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,286 @@
|
||||
// A fairly feature-full shader for toon-style shading in VRChat. Outline variant is PC-only, but placed in `Mobile` folder for consistency.
|
||||
Shader "VRChat/Mobile/Toon Standard (Outline)"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Enum(Off, 0, Front, 1, Back, 2)] _Culling ("Culling", Int) = 2
|
||||
//[Enum(Opaque, 0)] _BlendMode("Blend Mode", Int) = 0
|
||||
//[Enum(Opaque, 0, Cutout, 1, Cutout Plus, 2, Transparent, 3, Fade, 4)] _BlendMode("Blend Mode", Int) = 0
|
||||
|
||||
_Color ("Main Color", Color) = (1,1,1,1)
|
||||
_MainTex ("Main Texture", 2D) = "white" {}
|
||||
//_Cutoff ("Alpha Cutoff", Range(0,1)) = 0.5
|
||||
[ToggleUI] _VertexColor ("Apply Vertex Color", Float) = 0.0
|
||||
|
||||
_Ramp ("Shadow Ramp", 2D) = "white" {}
|
||||
_ShadowBoost ("Shadow Boost", Range(0,1)) = 0.0
|
||||
_ShadowAlbedo ("Shadow Tint", Range(0,1)) = 0.5
|
||||
[PowerSlider(2)] _MinBrightness ("Min Brightness", Range(0,0.1)) = 0.0
|
||||
[ToggleUI] _LimitBrightness ("Limit Brightness", Float) = 1.0
|
||||
|
||||
[Normal] _BumpMap ("Normal Map", 2D) = "bump" {}
|
||||
_BumpScale ("Normal Scale", Float) = 1.0
|
||||
|
||||
_MetallicMap ("Metallic Map", 2D) = "white" {}
|
||||
[Enum(Red, 0, Green, 1, Blue, 2, Alpha, 3)] _MetallicMapChannel ("Color Channel", Int) = 0
|
||||
_MetallicStrength ("Metallic Strength", Range(0,1)) = 0
|
||||
_GlossMap ("Gloss Map", 2D) = "white" {}
|
||||
[Enum(Red, 0, Green, 1, Blue, 2, Alpha, 3)] _GlossMapChannel ("Color Channel", Int) = 3
|
||||
_GlossStrength ("Gloss Strength", Range(0,1)) = 0.5
|
||||
_Reflectance ("Reflectance", Range(0,1)) = 0.5
|
||||
_SpecularSharpness("Sharpness", Range(0,1)) = 0
|
||||
|
||||
_Matcap ("Matcap", 2D) = "white" {}
|
||||
_MatcapMask ("Matcap Mask", 2D) = "white" {}
|
||||
[Enum(Red, 0, Green, 1, Blue, 2, Alpha, 3)] _MatcapMaskChannel ("Color Channel", Int) = 0
|
||||
[Enum(Additive, 0, Multiplicative, 1)] _MatcapType ("Matcap Type", Int) = 0
|
||||
_MatcapStrength ("Matcap Strength", Range(0,1)) = 1.0
|
||||
|
||||
_RimColor("Color", Color) = (1,1,1,1)
|
||||
_RimAlbedoTint("Albedo Tint", Range(0,1)) = 0.0
|
||||
_RimIntensity("Intensity", Range(0,1)) = 0.5
|
||||
_RimRange("Range", Range(0,1)) = 0.3
|
||||
_RimSharpness("Softness", Range(0,1)) = 0.1
|
||||
[ToggleUI] _RimEnvironmental("Environmental", Float) = 0.0
|
||||
|
||||
_EmissionMap ("Emission Map", 2D) = "white" {}
|
||||
_EmissionColor ("Emission Color", Color) = (0,0,0)
|
||||
_EmissionStrength ("Strength", Range(0, 2)) = 1
|
||||
[Enum(UV0, 0, UV1, 1)] _EmissionUV ("UV Map", Int) = 0
|
||||
|
||||
_OcclusionMap ("Occlusion Map", 2D) = "white" {}
|
||||
[Enum(Red, 0, Green, 1, Blue, 2, Alpha, 3)] _OcclusionMapChannel ("Color Channel", Int) = 1
|
||||
_OcclusionStrength ("Occlusion Strength", Range(0,1)) = 1
|
||||
|
||||
[Enum(AlphaBlended, 0, Additive, 1, Multiply, 2, MultiplyX2, 3)] _DetailMode ("Detail Mode", Int) = 0
|
||||
_DetailMask ("Detail Mask", 2D) = "white" {}
|
||||
[Enum(Red, 0, Green, 1, Blue, 2, Alpha, 3)] _DetailMaskChannel ("Color Channel", Int) = 3
|
||||
_DetailAlbedoMap ("Detail Texture", 2D) = "black" {}
|
||||
_DetailNormalMap ("Detail Normal Map", 2D) = "bump" {}
|
||||
_DetailNormalMapScale ("Detail Normal Scale", Float) = 1.0
|
||||
[Enum(UV0, 0, UV1, 1)] _DetailUV ("UV Map", Int) = 0
|
||||
|
||||
_HueShift ("Albedo Hue Shift", Range(0,6.283185)) = 0
|
||||
_DetailHueShift ("Detail Hue Shift", Range(0,6.283185)) = 0
|
||||
_EmissionHueShift ("Emission Hue Shift", Range(0,6.283185)) = 0
|
||||
_HueShiftMask ("Hue Shift Mask", 2D) = "white" {}
|
||||
[Enum(Red, 0, Green, 1, Blue, 2, Alpha, 3)] _HueShiftMaskChannel ("Color Channel", Int) = 1
|
||||
|
||||
_OutlineMask ("Thickness", 2D) = "white" {}
|
||||
[Enum(Red, 0, Green, 1, Blue, 2, Alpha, 3)] _OutlineMaskChannel ("Color Channel", Int) = 0
|
||||
[PowerSlider(2)] _OutlineThickness ("Thickness Multiplier", Range(0, 0.5)) = 0.05
|
||||
_OutlineColor ("Color", Color) = (0,0,0,1)
|
||||
_OutlineFromAlbedo ("Color From Albedo", Range(0,1)) = 0.0
|
||||
|
||||
_ColorMask ("Color Mask", 2D) = "black" {}
|
||||
_ColorMaskColor1("Color 1", Color) = (1,1,1,1)
|
||||
_ColorMaskEmissionStrength1("Color 1 Emission", Range(0,2)) = 0
|
||||
_ColorMaskColor2("Color 2", Color) = (1,1,1,1)
|
||||
_ColorMaskEmissionStrength2("Color 2 Emission", Range(0,2)) = 0
|
||||
_ColorMaskColor3("Color 3", Color) = (1,1,1,1)
|
||||
_ColorMaskEmissionStrength3("Color 3 Emission", Range(0,2)) = 0
|
||||
_ColorMaskColor4("Color 4", Color) = (1,1,1,1)
|
||||
_ColorMaskEmissionStrength4("Color 4 Emission", Range(0,2)) = 0
|
||||
|
||||
[Enum(Multiply, 0, Additive, 1)] _ColorMaskBlendMode("Color Mask Blend Mode", Int) = 0
|
||||
|
||||
//[Enum(UnityEngine.Rendering.BlendMode)]_SrcBlend ("__src", int) = 1
|
||||
//[Enum(UnityEngine.Rendering.BlendMode)]_DstBlend ("__dst", int) = 0
|
||||
//[Enum(Off,0,On,1)]_ZWrite ("__zw", int) = 1
|
||||
//_AlphaToMask ("Alpha To Mask", Int) = 0
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Cull [_Culling]
|
||||
//AlphaToMask [_AlphaToMask]
|
||||
AlphaToMask Off
|
||||
|
||||
Tags { "VRCFallback" = "toonstandard" "RenderType" = "Opaque" }
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "FORWARD"
|
||||
Tags { "LightMode" = "ForwardBase" }
|
||||
|
||||
//Blend [_SrcBlend] [_DstBlend]
|
||||
Blend One Zero
|
||||
//ZWrite [_ZWrite]
|
||||
ZWrite On
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fog
|
||||
#pragma multi_compile_fwdbase
|
||||
#pragma multi_compile _ VERTEXLIGHT_ON
|
||||
//#pragma shader_feature_local_fragment _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
|
||||
//#pragma multi_compile _ VRCHAT_ATLASING_ENABLED
|
||||
|
||||
#pragma shader_feature_local_fragment _ USE_SPECULAR
|
||||
#pragma shader_feature_local_fragment _ USE_MATCAP
|
||||
#pragma shader_feature_local_fragment _ USE_DETAIL_MAPS
|
||||
#pragma shader_feature_local_fragment _ USE_NORMAL_MAPS
|
||||
#pragma shader_feature_local_fragment _ USE_OCCLUSION_MAP
|
||||
#pragma dynamic_branch_local_fragment _ USE_RIMLIGHT
|
||||
#pragma dynamic_branch_local_fragment _ USE_HUE_SHIFT
|
||||
#pragma dynamic_branch_local_fragment _ USE_COLOR_MASK
|
||||
|
||||
// this one is practically free in terms of performance, so save some variants by always enabling it for now
|
||||
#define USE_EMISSION_MAP
|
||||
|
||||
// disable variants that are not needed, including realtime shadows (not supported)
|
||||
#pragma skip_variants LIGHTMAP_ON DYNAMICLIGHTMAP_ON DIRLIGHTMAP_COMBINED STEREO_CUBEMAP_RENDER_ON
|
||||
#pragma skip_variants SHADOWS_DEPTH SHADOWS_SCREEN SHADOWS_CUBE SHADOWS_SOFT SHADOWS_SHADOWMASK LIGHTMAP_SHADOW_MIXING
|
||||
|
||||
#ifndef UNITY_PASS_FORWARDBASE
|
||||
#define UNITY_PASS_FORWARDBASE
|
||||
#endif
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityPBSLighting.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
#include "Lighting.cginc"
|
||||
#include "./CG/VRCAtlasingShim.cginc"
|
||||
#include "./CG/DataStructs.cginc"
|
||||
#include "./CG/Definitions.cginc"
|
||||
#include "./CG/Helpers.cginc"
|
||||
#include "./CG/Lighting.cginc"
|
||||
#include "./CG/VertexFragment.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "FORWARD_OUTLINE"
|
||||
Tags { "LightMode" = "ForwardBase" }
|
||||
|
||||
Blend One Zero
|
||||
ZWrite On
|
||||
|
||||
Cull Front
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert_outline
|
||||
#pragma fragment frag_outline
|
||||
#pragma multi_compile_fog
|
||||
#pragma multi_compile_fwdbase
|
||||
#pragma multi_compile _ VERTEXLIGHT_ON
|
||||
//#pragma multi_compile _ VRCHAT_ATLASING_ENABLED
|
||||
|
||||
// disable variants that are not needed, including realtime shadows (not supported)
|
||||
#pragma skip_variants LIGHTMAP_ON DYNAMICLIGHTMAP_ON DIRLIGHTMAP_COMBINED STEREO_CUBEMAP_RENDER_ON
|
||||
#pragma skip_variants SHADOWS_DEPTH SHADOWS_SCREEN SHADOWS_CUBE SHADOWS_SOFT SHADOWS_SHADOWMASK LIGHTMAP_SHADOW_MIXING
|
||||
|
||||
#define VRCHAT_PASS_OUTLINE
|
||||
#ifndef UNITY_PASS_FORWARDBASE
|
||||
#define UNITY_PASS_FORWARDBASE
|
||||
#endif
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityPBSLighting.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
#include "Lighting.cginc"
|
||||
#include "./CG/VRCAtlasingShim.cginc"
|
||||
#include "./CG/DataStructs.cginc"
|
||||
#include "./CG/Definitions.cginc"
|
||||
#include "./CG/Helpers.cginc"
|
||||
#include "./CG/Outlines.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "FWDADD"
|
||||
Tags { "LightMode" = "ForwardAdd" }
|
||||
|
||||
//Blend [_SrcBlend] One
|
||||
Blend One One
|
||||
ZWrite Off
|
||||
ZTest LEqual
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fog
|
||||
#pragma multi_compile_fwdadd_fullshadow
|
||||
//#pragma shader_feature_local_fragment _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
|
||||
//#pragma multi_compile _ VRCHAT_ATLASING_ENABLED
|
||||
|
||||
#pragma shader_feature_local_fragment _ USE_SPECULAR
|
||||
#pragma shader_feature_local_fragment _ USE_MATCAP
|
||||
#pragma shader_feature_local_fragment _ USE_DETAIL_MAPS
|
||||
#pragma shader_feature_local_fragment _ USE_NORMAL_MAPS
|
||||
#pragma shader_feature_local_fragment _ USE_OCCLUSION_MAP
|
||||
#pragma dynamic_branch_local_fragment _ USE_RIMLIGHT
|
||||
#pragma dynamic_branch_local_fragment _ USE_HUE_SHIFT
|
||||
#pragma dynamic_branch_local_fragment _ USE_COLOR_MASK
|
||||
|
||||
// disable variants that are not needed, including realtime shadows (not supported)
|
||||
#pragma skip_variants LIGHTMAP_ON DYNAMICLIGHTMAP_ON DIRLIGHTMAP_COMBINED STEREO_CUBEMAP_RENDER_ON
|
||||
#pragma skip_variants SHADOWS_DEPTH SHADOWS_SCREEN SHADOWS_CUBE SHADOWS_SOFT SHADOWS_SHADOWMASK LIGHTMAP_SHADOW_MIXING
|
||||
|
||||
#ifndef UNITY_PASS_FORWARDADD
|
||||
#define UNITY_PASS_FORWARDADD
|
||||
#endif
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityPBSLighting.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
#include "Lighting.cginc"
|
||||
#include "./CG/VRCAtlasingShim.cginc"
|
||||
#include "./CG/DataStructs.cginc"
|
||||
#include "./CG/Definitions.cginc"
|
||||
#include "./CG/Helpers.cginc"
|
||||
#include "./CG/Lighting.cginc"
|
||||
#include "./CG/VertexFragment.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "SHADOWCASTER"
|
||||
Tags { "LightMode" = "ShadowCaster" }
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_shadowcaster
|
||||
//#pragma shader_feature_local_fragment _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
|
||||
//#pragma multi_compile _ VRCHAT_ATLASING_ENABLED
|
||||
|
||||
#ifndef UNITY_PASS_SHADOWCASTER
|
||||
#define UNITY_PASS_SHADOWCASTER
|
||||
#endif
|
||||
|
||||
// disable variants that are not needed, including realtime shadows (not supported)
|
||||
#pragma skip_variants LIGHTMAP_ON DYNAMICLIGHTMAP_ON DIRLIGHTMAP_COMBINED STEREO_CUBEMAP_RENDER_ON
|
||||
#pragma skip_variants SHADOWS_DEPTH SHADOWS_SCREEN SHADOWS_CUBE SHADOWS_SOFT SHADOWS_SHADOWMASK LIGHTMAP_SHADOW_MIXING
|
||||
#pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityPBSLighting.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
#include "Lighting.cginc"
|
||||
#include "./CG/VRCAtlasingShim.cginc"
|
||||
#include "./CG/DataStructs.cginc"
|
||||
#include "./CG/Definitions.cginc"
|
||||
#include "./CG/Helpers.cginc"
|
||||
#include "./CG/Lighting.cginc"
|
||||
#include "./CG/VertexFragment.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback "VRChat/Mobile/Diffuse"
|
||||
CustomEditor "VRC.ToonStandard.ToonStandardShaderEditor"
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 051a0ed2f2aedd741aa8186ae92f97e0
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures:
|
||||
- _MainTex: {instanceID: 0}
|
||||
- _Ramp: {fileID: 2800000, guid: 636cf1b5dfca6f54b94ca3d2ff8216c9, type: 3}
|
||||
- _BumpMap: {instanceID: 0}
|
||||
- _MetallicMap: {instanceID: 0}
|
||||
- _GlossMap: {instanceID: 0}
|
||||
- _Matcap: {instanceID: 0}
|
||||
- _MatcapMask: {instanceID: 0}
|
||||
- _EmissionMap: {instanceID: 0}
|
||||
- _OcclusionMap: {instanceID: 0}
|
||||
- _DetailMask: {instanceID: 0}
|
||||
- _DetailAlbedoMap: {instanceID: 0}
|
||||
- _DetailNormalMap: {instanceID: 0}
|
||||
- _HueShiftMask: {instanceID: 0}
|
||||
- _OutlineMask: {instanceID: 0}
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,48 @@
|
||||
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
|
||||
|
||||
// Simplified Bumped shader. Differences from regular Bumped one:
|
||||
// - no Main Color
|
||||
// - Normalmap uses Tiling/Offset of the Base texture
|
||||
// - fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH.
|
||||
|
||||
Shader "VRChat/Mobile/Bumped Diffuse"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||
[NoScaleOffset] _BumpMap ("Normalmap", 2D) = "bump" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 250
|
||||
|
||||
CGPROGRAM
|
||||
#define _SPECULARHIGHLIGHTS_OFF
|
||||
#define _GLOSSYREFLECTIONS_OFF
|
||||
#include "VRChat.cginc"
|
||||
#pragma target 3.0
|
||||
#pragma surface surf LambertVRC exclude_path:prepass exclude_path:deferred noforwardadd noshadow nodynlightmap nolppv noshadowmask
|
||||
|
||||
UNITY_DECLARE_TEX2D(_MainTex);
|
||||
UNITY_DECLARE_TEX2D(_BumpMap);
|
||||
|
||||
struct Input
|
||||
{
|
||||
float2 uv_MainTex;
|
||||
fixed4 color : COLOR;
|
||||
};
|
||||
|
||||
void surf (Input IN, inout SurfaceOutputVRC o)
|
||||
{
|
||||
fixed4 c = UNITY_SAMPLE_TEX2D(_MainTex, IN.uv_MainTex);
|
||||
o.Albedo = c.rgb * IN.color;
|
||||
o.Alpha = 1.0f;
|
||||
o.Normal = UnpackNormal(UNITY_SAMPLE_TEX2D(_BumpMap, IN.uv_MainTex));
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Fallback "VRChat/Mobile/Diffuse"
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8c1f8ac363df824899534a0b30eef00
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,54 @@
|
||||
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
|
||||
|
||||
// Simplified Bumped Specular shader. Differences from regular Bumped Specular one:
|
||||
// - no Main Color nor Specular Color
|
||||
// - specular lighting directions are approximated per vertex
|
||||
// - writes zero to alpha channel
|
||||
// - Normalmap uses Tiling/Offset of the Base texture
|
||||
// - no Deferred Lighting support
|
||||
// - no Lightmap support
|
||||
// - fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH.
|
||||
|
||||
Shader "VRChat/Mobile/Bumped Mapped Specular"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {}
|
||||
_Shininess ("Shininess", Range (0.03, 1)) = 0.078125
|
||||
_SpecColor ("Specular Color", Color) = (1,1,1,1)
|
||||
[NoScaleOffset] _BumpMap ("Normalmap", 2D) = "bump" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 250
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma surface surf BlinnPhong exclude_path:prepass exclude_path:deferred noforwardadd noshadow nodynlightmap nolppv noshadowmask
|
||||
|
||||
UNITY_DECLARE_TEX2D(_MainTex);
|
||||
UNITY_DECLARE_TEX2D(_BumpMap);
|
||||
half _Shininess;
|
||||
|
||||
struct Input
|
||||
{
|
||||
float2 uv_MainTex;
|
||||
fixed4 color : COLOR;
|
||||
};
|
||||
|
||||
void surf (Input IN, inout SurfaceOutput o)
|
||||
{
|
||||
fixed4 tex = UNITY_SAMPLE_TEX2D(_MainTex, IN.uv_MainTex);
|
||||
o.Albedo = tex.rgb * IN.color;
|
||||
o.Gloss = tex.a;
|
||||
o.Alpha = 1.0f;
|
||||
o.Specular = _Shininess;
|
||||
o.Normal = UnpackNormal(UNITY_SAMPLE_TEX2D(_BumpMap, IN.uv_MainTex));
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Fallback "VRChat/Mobile/Diffuse"
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 528d55c4e8adab14b974ca665ed1b996
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,64 @@
|
||||
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
|
||||
|
||||
// Simplified Bumped Specular shader. Differences from regular Bumped Specular one:
|
||||
// - no Main Color nor Specular Color
|
||||
// - specular lighting directions are approximated per vertex
|
||||
// - writes zero to alpha channel
|
||||
// - Normalmap uses Tiling/Offset of the Base texture
|
||||
// - no Deferred Lighting support
|
||||
// - no Lightmap support
|
||||
// - fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH.
|
||||
|
||||
Shader "VRChat/Mobile/Bumped Mapped Specular"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Shininess ("Shininess", Range (0.03, 1)) = 0.078125
|
||||
_MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {}
|
||||
[NoScaleOffset] _BumpMap ("Normalmap", 2D) = "bump" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 250
|
||||
|
||||
CGPROGRAM
|
||||
#pragma surface surf MobileBlinnPhong exclude_path:prepass nolightmap noforwardadd halfasview interpolateview
|
||||
|
||||
inline fixed4 LightingMobileBlinnPhong (SurfaceOutput s, fixed3 lightDir, fixed3 halfDir, fixed atten)
|
||||
{
|
||||
fixed diff = max (0, dot (s.Normal, lightDir));
|
||||
fixed nh = max (0, dot (s.Normal, halfDir));
|
||||
fixed spec = pow (nh, s.Specular*128) * s.Gloss;
|
||||
|
||||
fixed4 c;
|
||||
c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * spec) * atten;
|
||||
UNITY_OPAQUE_ALPHA(c.a);
|
||||
return c;
|
||||
}
|
||||
|
||||
sampler2D _MainTex;
|
||||
sampler2D _BumpMap;
|
||||
half _Shininess;
|
||||
|
||||
struct Input
|
||||
{
|
||||
float2 uv_MainTex;
|
||||
fixed4 color : COLOR;
|
||||
};
|
||||
|
||||
void surf (Input IN, inout SurfaceOutput o)
|
||||
{
|
||||
fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
|
||||
o.Albedo = tex.rgb * IN.color;
|
||||
o.Gloss = tex.a;
|
||||
o.Alpha = tex.a;
|
||||
o.Specular = _Shininess;
|
||||
o.Normal = UnpackNormal (tex2D(_BumpMap, IN.uv_MainTex));
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
FallBack "Mobile/VertexLit"
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 584dc70fbb9834e48beb29e3206e3ca0
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,44 @@
|
||||
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
|
||||
|
||||
// Simplified Diffuse shader. Differences from regular Diffuse one:
|
||||
// - no Main Color
|
||||
// - fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH.
|
||||
|
||||
Shader "VRChat/Mobile/Diffuse"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 150
|
||||
|
||||
CGPROGRAM
|
||||
#define _SPECULARHIGHLIGHTS_OFF
|
||||
#define _GLOSSYREFLECTIONS_OFF
|
||||
#include "VRChat.cginc"
|
||||
#pragma target 3.0
|
||||
#pragma surface surf LambertVRC exclude_path:prepass exclude_path:deferred noforwardadd noshadow nodynlightmap nolppv noshadowmask
|
||||
|
||||
UNITY_DECLARE_TEX2D(_MainTex);
|
||||
|
||||
struct Input
|
||||
{
|
||||
float2 uv_MainTex;
|
||||
fixed4 color : COLOR;
|
||||
};
|
||||
|
||||
void surf (Input IN, inout SurfaceOutputVRC o)
|
||||
{
|
||||
fixed4 c = UNITY_SAMPLE_TEX2D(_MainTex, IN.uv_MainTex);
|
||||
o.Albedo = c.rgb * IN.color;
|
||||
o.Alpha = 1.0f;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
FallBack "Diffuse"
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2dcd9e0568e0a6f45b92c60ba2eb16a0
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,121 @@
|
||||
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
|
||||
|
||||
// Unlit shader. Simplest possible textured shader.
|
||||
// - SUPPORTS lightmap
|
||||
// - no lighting
|
||||
// - no per-material color
|
||||
|
||||
Shader "VRChat/Mobile/Lightmapped"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 100
|
||||
|
||||
// Non-lightmapped
|
||||
Pass
|
||||
{
|
||||
Tags { "LightMode" = "Vertex" }
|
||||
Lighting Off
|
||||
SetTexture [_MainTex]
|
||||
{
|
||||
constantColor (1,1,1,1)
|
||||
combine texture, constant // UNITY_OPAQUE_ALPHA_FFP
|
||||
}
|
||||
}
|
||||
|
||||
// Lightmapped
|
||||
Pass
|
||||
{
|
||||
Tags{ "LIGHTMODE" = "VertexLM" "RenderType" = "Opaque" }
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
#include "UnityCG.cginc"
|
||||
#pragma multi_compile_fog
|
||||
#define USING_FOG (defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2))
|
||||
|
||||
// uniforms
|
||||
float4 _MainTex_ST;
|
||||
|
||||
// vertex shader input data
|
||||
struct appdata
|
||||
{
|
||||
float3 pos : POSITION;
|
||||
float3 uv1 : TEXCOORD1;
|
||||
float3 uv0 : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
// vertex-to-fragment interpolators
|
||||
struct v2f
|
||||
{
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float2 uv1 : TEXCOORD1;
|
||||
#if USING_FOG
|
||||
fixed fog : TEXCOORD2;
|
||||
#endif
|
||||
float4 pos : SV_POSITION;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
// vertex shader
|
||||
v2f vert(appdata IN)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(IN);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
||||
// compute texture coordinates
|
||||
o.uv0 = IN.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
|
||||
o.uv1 = IN.uv0.xy * _MainTex_ST.xy + _MainTex_ST.zw;
|
||||
|
||||
// fog
|
||||
#if USING_FOG
|
||||
float3 eyePos = UnityObjectToViewPos(float4(IN.pos, 1));
|
||||
float fogCoord = length(eyePos.xyz); // radial fog distance
|
||||
UNITY_CALC_FOG_FACTOR_RAW(fogCoord);
|
||||
o.fog = saturate(unityFogFactor);
|
||||
#endif
|
||||
|
||||
// transform position
|
||||
o.pos = UnityObjectToClipPos(IN.pos);
|
||||
return o;
|
||||
}
|
||||
|
||||
// textures
|
||||
sampler2D _MainTex;
|
||||
|
||||
// fragment shader
|
||||
fixed4 frag(v2f IN) : SV_Target
|
||||
{
|
||||
fixed4 col, tex;
|
||||
|
||||
// Fetch lightmap
|
||||
half4 bakedColorTex = UNITY_SAMPLE_TEX2D(unity_Lightmap, IN.uv0.xy);
|
||||
col.rgb = DecodeLightmap(bakedColorTex);
|
||||
|
||||
// Fetch color texture
|
||||
tex = tex2D(_MainTex, IN.uv1.xy);
|
||||
col.rgb = tex.rgb * col.rgb;
|
||||
col.a = 1;
|
||||
|
||||
// fog
|
||||
#if USING_FOG
|
||||
col.rgb = lerp(unity_FogColor.rgb, col.rgb, IN.fog);
|
||||
#endif
|
||||
return col;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b1f7ecc80417c414b9d62ce541d5bcbf
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,117 @@
|
||||
// VRChat MatCapLit shader, based on Unity's Mobile/Diffuse. Copyright (c) 2019 VRChat.
|
||||
|
||||
// Simple MatCapLit shader.
|
||||
// -fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH.
|
||||
|
||||
Shader "VRChat/Mobile/MatCap Lit"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex("Texture", 2D) = "white" {}
|
||||
_MatCap ("MatCap (RGB)", 2D) = "white" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" "Queue"="Geometry" }
|
||||
Pass
|
||||
{
|
||||
Name "FORWARD"
|
||||
Tags { "LightMode" = "ForwardBase" }
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#pragma multi_compile_fwdbase
|
||||
#pragma multi_compile_instancing
|
||||
#pragma skip_variants SHADOWS_SHADOWMASK SHADOWS_SCREEN SHADOWS_DEPTH SHADOWS_CUBE
|
||||
|
||||
#include "UnityPBSLighting.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
|
||||
struct VertexInput
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float3 normal : NORMAL;
|
||||
fixed4 color : COLOR;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 worldPos : TEXCOORD1;
|
||||
fixed4 color : TEXCOORD2;
|
||||
fixed4 indirect : TEXCOORD3;
|
||||
fixed4 direct : TEXCOORD4;
|
||||
float2 matcapUV : TEXCOORD5;
|
||||
SHADOW_COORDS(7)
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
UNITY_DECLARE_TEX2D(_MainTex);
|
||||
half4 _MainTex_ST;
|
||||
|
||||
UNITY_DECLARE_TEX2D(_MatCap);
|
||||
|
||||
float2 matcapSample(float3 viewDirection, float3 normalDirection)
|
||||
{
|
||||
half3 worldUp = float3(0,1,0);
|
||||
half3 worldViewUp = normalize(worldUp - viewDirection * dot(viewDirection, worldUp));
|
||||
half3 worldViewRight = normalize(cross(viewDirection, worldViewUp));
|
||||
half2 matcapUV = half2(dot(worldViewRight, normalDirection), dot(worldViewUp, normalDirection)) * 0.5 + 0.5;
|
||||
return matcapUV;
|
||||
}
|
||||
|
||||
VertexOutput vert (VertexInput v)
|
||||
{
|
||||
VertexOutput o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_OUTPUT(VertexOutput, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.worldPos = mul(unity_ObjectToWorld, v.vertex);
|
||||
o.uv = v.uv;
|
||||
|
||||
half3 indirectDiffuse = ShadeSH9(half4(0, 0, 0, 1)); // We don't care about anything other than the color from GI, so only feed in 0,0,0, rather than the normal
|
||||
half4 lightCol = _LightColor0;
|
||||
|
||||
//If we don't have a directional light or realtime light in the scene, we can derive light color from a slightly modified indirect color.
|
||||
int lightEnv = int(any(_WorldSpaceLightPos0.xyz));
|
||||
if(lightEnv != 1)
|
||||
lightCol = indirectDiffuse.xyzz * 0.2;
|
||||
|
||||
o.color = v.color;
|
||||
o.direct = lightCol;
|
||||
o.indirect = indirectDiffuse.xyzz;
|
||||
|
||||
float3 worldNorm = normalize(unity_WorldToObject[0].xyz * v.normal.x + unity_WorldToObject[1].xyz * v.normal.y + unity_WorldToObject[2].xyz * v.normal.z);
|
||||
worldNorm = mul((float3x3)UNITY_MATRIX_V, worldNorm);
|
||||
o.matcapUV = matcapSample(normalize(_WorldSpaceCameraPos - o.worldPos), UnityObjectToWorldNormal(v.normal)); //worldNorm.xy * 0.5 + 0.5;
|
||||
|
||||
TRANSFER_SHADOW(o);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (VertexOutput i, float facing : VFACE) : SV_Target
|
||||
{
|
||||
UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos.xyz);
|
||||
|
||||
fixed4 albedo = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(i.uv, _MainTex));
|
||||
fixed4 mc = UNITY_SAMPLE_TEX2D(_MatCap, i.matcapUV);
|
||||
half4 final = (albedo * i.color * mc) * (i.direct * attenuation + i.indirect);
|
||||
|
||||
return half4(final.rgb, 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback "VRChat/Mobile/Diffuse"
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ad043b7f9839cb48a75a9238d433dec
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,43 @@
|
||||
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
|
||||
|
||||
// Simplified Additive Particle shader. Differences from regular Additive Particle one:
|
||||
// - no Tint color
|
||||
// - no Smooth particle support
|
||||
// - no AlphaTest
|
||||
// - no ColorMask
|
||||
|
||||
Shader "VRChat/Mobile/Particles/Additive"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Particle Texture", 2D) = "white" {}
|
||||
}
|
||||
|
||||
Category
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
||||
Blend SrcAlpha One
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
Fog { Color (0,0,0,0) }
|
||||
|
||||
BindChannels
|
||||
{
|
||||
Bind "Color", color
|
||||
Bind "Vertex", vertex
|
||||
Bind "TexCoord", texcoord
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
SetTexture [_MainTex]
|
||||
{
|
||||
combine texture * primary
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9200bec112b65ec4fbbbd33fa89c20f4
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,43 @@
|
||||
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
|
||||
|
||||
// Simplified Alpha Blended Particle shader. Differences from regular Alpha Blended Particle one:
|
||||
// - no Tint color
|
||||
// - no Smooth particle support
|
||||
// - no AlphaTest
|
||||
// - no ColorMask
|
||||
|
||||
Shader "VRChat/Mobile/Particles/Alpha Blended"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Particle Texture", 2D) = "white" {}
|
||||
}
|
||||
|
||||
Category
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
Fog { Color (0,0,0,0) }
|
||||
|
||||
BindChannels
|
||||
{
|
||||
Bind "Color", color
|
||||
Bind "Vertex", vertex
|
||||
Bind "TexCoord", texcoord
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
SetTexture [_MainTex]
|
||||
{
|
||||
combine texture * primary
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b39b95ac85682040beff730e0cfc77a
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,47 @@
|
||||
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
|
||||
|
||||
// Simplified Multiply Particle shader. Differences from regular Multiply Particle one:
|
||||
// - no Smooth particle support
|
||||
// - no AlphaTest
|
||||
// - no ColorMask
|
||||
|
||||
Shader "VRChat/Mobile/Particles/Multiply"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Particle Texture", 2D) = "white" {}
|
||||
}
|
||||
|
||||
Category
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
||||
Blend Zero SrcColor
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
Fog { Color (1,1,1,1) }
|
||||
|
||||
BindChannels
|
||||
{
|
||||
Bind "Color", color
|
||||
Bind "Vertex", vertex
|
||||
Bind "TexCoord", texcoord
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
SetTexture [_MainTex]
|
||||
{
|
||||
combine texture * primary
|
||||
}
|
||||
SetTexture [_MainTex]
|
||||
{
|
||||
constantColor (1,1,1,1)
|
||||
combine previous lerp (previous) constant
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5b89f0c74ccf5049ba803c14a090378
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,73 @@
|
||||
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
|
||||
|
||||
Shader "VRChat/Mobile/Skybox"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Rotation ("Rotation", Range(0, 360)) = 0
|
||||
[NoScaleOffset] _Tex ("Cubemap", Cube) = "grey" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Background" "RenderType"="Background" "PreviewType"="Skybox" }
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
samplerCUBE _Tex;
|
||||
float _Rotation;
|
||||
|
||||
float3 RotateAroundYInDegrees (float3 vertex, float degrees)
|
||||
{
|
||||
float alpha = degrees * UNITY_PI / 180.0;
|
||||
float sina, cosa;
|
||||
sincos(alpha, sina, cosa);
|
||||
float2x2 m = float2x2(cosa, -sina, sina, cosa);
|
||||
return float3(mul(m, vertex.xz), vertex.y).xzy;
|
||||
}
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float3 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert (appdata_t v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
float3 rotated = RotateAroundYInDegrees(v.vertex, _Rotation);
|
||||
o.vertex = UnityObjectToClipPos(rotated);
|
||||
o.texcoord = v.vertex.xyz;
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
half4 tex = texCUBE(_Tex, i.texcoord);
|
||||
return tex;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback Off
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c0d3cb006bb294142bef136f492f2568
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,211 @@
|
||||
Shader "VRChat/Mobile/Standard Lite"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex("Albedo(RGB)", 2D) = "white" {}
|
||||
_Color("Color", Color) = (1,1,1,1)
|
||||
|
||||
[NoScaleOffset] _MetallicGlossMap("Metallic(R) Smoothness(A) Map", 2D) = "white" {}
|
||||
[Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 1.0
|
||||
_Glossiness("Smoothness", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
_BumpScale("Scale", Float) = 1.0
|
||||
[NoScaleOffset] _BumpMap("Normal Map", 2D) = "bump" {}
|
||||
|
||||
[NoScaleOffset] _OcclusionMap("Occlusion(G)", 2D) = "white" {}
|
||||
_OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
[NoScaleOffset] _EmissionMap("Emission(RGB)", 2D) = "white" {}
|
||||
_EmissionColor("Emission Color", Color) = (0, 0, 0)
|
||||
|
||||
[Enum(UV0,0,UV1,1)] _UVSec ("UV Set for secondary textures", Float) = 0
|
||||
[NoScaleOffset] _DetailMask("Detail Mask(A)", 2D) = "white" {}
|
||||
|
||||
_DetailAlbedoMap("Detail Albedo x2(RGB)", 2D) = "grey" {}
|
||||
_DetailNormalMapScale("Scale", Float) = 1.0
|
||||
[NoScaleOffset] _DetailNormalMap("Detail Normal Map", 2D) = "bump" {}
|
||||
|
||||
[ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 0
|
||||
[ToggleOff] _GlossyReflections("Glossy Reflections", Float) = 0
|
||||
|
||||
[Toggle(_ENABLE_GEOMETRIC_SPECULAR_AA)] _EnableGeometricSpecularAA("EnableGeometricSpecularAA", Float) = 1.0
|
||||
_SpecularAAScreenSpaceVariance("SpecularAAScreenSpaceVariance", Range(0.0, 1.0)) = 0.1
|
||||
_SpecularAAThreshold("SpecularAAThreshold", Range(0.0, 1.0)) = 0.2
|
||||
|
||||
[Enum(Default,0,MonoSH,1,MonoSH (no highlights),2)] _LightmapType ("Lightmap Type", Float) = 0
|
||||
|
||||
// TODO: This has questionable performance impact on Mobile but very little discernable impact on PC. Should
|
||||
// make a toggle once we have properly branched compilation between those platforms, that's PC-only
|
||||
[Toggle(_BICUBIC)] _Bicubic ("Enable Bicubic Sampling", Float) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 200
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
//#define _DEBUG_VRC
|
||||
#ifdef _DEBUG_VRC
|
||||
#define DEBUG_COL(rgb) debugCol = half4(rgb, 1)
|
||||
#define DEBUG_VAL(val) debugCol = half4(val, val, val, 1)
|
||||
half4 debugCol = half4(0,0,0,1);
|
||||
#else
|
||||
#define DEBUG_COL(rgb)
|
||||
#define DEBUG_VAL(val)
|
||||
#endif
|
||||
|
||||
#pragma target 3.0
|
||||
#pragma shader_feature _ _DETAIL
|
||||
#pragma shader_feature_fragment _ _SPECULARHIGHLIGHTS_OFF
|
||||
#pragma shader_feature_fragment _ _GLOSSYREFLECTIONS_OFF
|
||||
#pragma shader_feature_fragment _ _MONOSH_SPECULAR _MONOSH_NOSPECULAR
|
||||
// due to a Unity bug - we cannot use dynamic_branch in a surface shader in the SDK, as it prevents objects from being baked
|
||||
// any shader with a `dynamic_branch` inside of a Meta pass will fail to compile for lightmapping
|
||||
#pragma shader_feature_fragment _ _ENABLE_GEOMETRIC_SPECULAR_AA
|
||||
#pragma shader_feature_fragment _ _EMISSION
|
||||
#pragma shader_feature_fragment _ DISABLE_VERTEX_COLORING
|
||||
//SDK-SYNC-IGNORE-LINE - unused variants in SDK projects - #pragma multi_compile_fragment _ FORCE_UNITY_DLDR_LIGHTMAP_ENCODING FORCE_UNITY_RGBM_LIGHTMAP_ENCODING FORCE_UNITY_LIGHTMAP_FULL_HDR_ENCODING UNITY_LIGHTMAP_NONE
|
||||
//#pragma multi_compile _ _BICUBIC
|
||||
|
||||
#if defined(LIGHTMAP_ON)
|
||||
#if defined(_MONOSH_SPECULAR) || defined(_MONOSH_NOSPECULAR)
|
||||
#define _MONOSH
|
||||
#if defined(_MONOSH_SPECULAR)
|
||||
#define _LMSPEC
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "VRChat.cginc"
|
||||
|
||||
#pragma surface surf StandardVRC vertex:vert exclude_path:prepass exclude_path:deferred noforwardadd noshadow nodynlightmap nolppv noshadowmask
|
||||
#pragma skip_variants LIGHTMAP_SHADOW_MIXING
|
||||
|
||||
// -------------------------------------
|
||||
|
||||
struct Input
|
||||
{
|
||||
float2 texcoord0;
|
||||
#ifdef _DETAIL
|
||||
float2 texcoord1;
|
||||
#endif
|
||||
fixed4 color : COLOR;
|
||||
};
|
||||
|
||||
UNITY_DECLARE_TEX2D(_MainTex);
|
||||
float4 _MainTex_ST;
|
||||
half4 _Color;
|
||||
|
||||
UNITY_DECLARE_TEX2D(_MetallicGlossMap);
|
||||
uniform half _Glossiness;
|
||||
uniform half _Metallic;
|
||||
|
||||
UNITY_DECLARE_TEX2D(_BumpMap);
|
||||
uniform half _BumpScale;
|
||||
|
||||
UNITY_DECLARE_TEX2D(_OcclusionMap);
|
||||
uniform half _OcclusionStrength;
|
||||
|
||||
uniform half _SpecularAAScreenSpaceVariance;
|
||||
uniform half _SpecularAAThreshold;
|
||||
|
||||
UNITY_DECLARE_TEX2D(_EmissionMap);
|
||||
half4 _EmissionColor;
|
||||
|
||||
#ifdef _DETAIL
|
||||
uniform half _UVSec;
|
||||
float4 _DetailAlbedoMap_ST;
|
||||
UNITY_DECLARE_TEX2D(_DetailMask);
|
||||
UNITY_DECLARE_TEX2D(_DetailAlbedoMap);
|
||||
UNITY_DECLARE_TEX2D(_DetailNormalMap);
|
||||
uniform half _DetailNormalMapScale;
|
||||
#endif
|
||||
|
||||
// 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 vert(inout appdata_full v, out Input o)
|
||||
{
|
||||
UNITY_INITIALIZE_OUTPUT(Input,o);
|
||||
o.texcoord0 = TRANSFORM_TEX(v.texcoord.xy, _MainTex); // Always source from uv0
|
||||
#ifdef _DETAIL
|
||||
o.texcoord1 = TRANSFORM_TEX(((_UVSec == 0) ? v.texcoord.xy : v.texcoord1.xy), _DetailAlbedoMap);
|
||||
#endif
|
||||
}
|
||||
|
||||
void surf(Input IN, inout SurfaceOutputStandardVRC o)
|
||||
{
|
||||
// Albedo comes from a texture tinted by color
|
||||
half4 albedoMap = UNITY_SAMPLE_TEX2D(_MainTex, IN.texcoord0) * _Color;
|
||||
#if !defined(DISABLE_VERTEX_COLORING) //SDK-SYNC-IGNORE-LINE
|
||||
albedoMap *= IN.color; //SDK-SYNC-IGNORE-LINE
|
||||
#endif //SDK-SYNC-IGNORE-LINE
|
||||
o.Albedo = albedoMap.rgb;
|
||||
|
||||
// Metallic and smoothness come from slider variables
|
||||
half4 metallicGlossMap = UNITY_SAMPLE_TEX2D(_MetallicGlossMap, IN.texcoord0);
|
||||
o.Metallic = metallicGlossMap.r * _Metallic;
|
||||
o.Smoothness = metallicGlossMap.a * _Glossiness;
|
||||
|
||||
// Occlusion is sampled from the Green channel to match up with Standard. Can be packed to Metallic if you insert it into multiple slots.
|
||||
o.Occlusion = LerpOneTo(UNITY_SAMPLE_TEX2D(_OcclusionMap, IN.texcoord0).g, _OcclusionStrength);
|
||||
|
||||
// only takes into account directional lights, so only use if using noforwardadd!
|
||||
float dx0 = ddx(IN.texcoord0);
|
||||
float dy0 = ddy(IN.texcoord0);
|
||||
#if defined(LIGHTMAP_ON) && !defined(_MONOSH) && !defined(DIRLIGHTMAP_COMBINED) && defined(_GLOSSYREFLECTIONS_OFF)
|
||||
UNITY_BRANCH if (any(_LightColor0.xyz))
|
||||
#else
|
||||
if (true)
|
||||
#endif
|
||||
{
|
||||
o.Normal = UnpackScaleNormal(SAMPLE_TEXTURE2D_GRAD(_BumpMap, sampler_BumpMap, IN.texcoord0, dx0, dy0), _BumpScale);
|
||||
} else {
|
||||
o.Normal = half3(0, 0, 1);
|
||||
}
|
||||
|
||||
#if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) //SDK-SYNC-IGNORE-LINE
|
||||
o.SpecularAA = 1; //SDK-SYNC-IGNORE-LINE
|
||||
#endif //SDK-SYNC-IGNORE-LINE
|
||||
o.SpecularAAVariance = _SpecularAAScreenSpaceVariance;
|
||||
o.SpecularAAThreshold = _SpecularAAThreshold;
|
||||
|
||||
#ifdef _DETAIL
|
||||
half4 detailMask = UNITY_SAMPLE_TEX2D(_DetailMask, IN.texcoord0);
|
||||
float dx1 = ddx(IN.texcoord1);
|
||||
float dy1 = ddy(IN.texcoord1);
|
||||
UNITY_BRANCH
|
||||
if (detailMask.a > 0)
|
||||
{
|
||||
half4 detailAlbedoMap = SAMPLE_TEXTURE2D_GRAD(_DetailAlbedoMap, sampler_DetailAlbedoMap, IN.texcoord1, dx1, dy1);
|
||||
o.Albedo *= LerpWhiteTo(detailAlbedoMap.rgb * unity_ColorSpaceDouble.rgb, detailMask.a);
|
||||
|
||||
#if defined(LIGHTMAP_ON) && !defined(_MONOSH) && !defined(DIRLIGHTMAP_COMBINED) && defined(_GLOSSYREFLECTIONS_OFF)
|
||||
UNITY_BRANCH if (any(_LightColor0.xyz))
|
||||
#else
|
||||
if (true)
|
||||
#endif
|
||||
{
|
||||
half3 detailNormalTangent = UnpackScaleNormal(SAMPLE_TEXTURE2D_GRAD(_DetailNormalMap, sampler_DetailNormalMap, IN.texcoord1, dx1, dy1), _DetailNormalMapScale);
|
||||
o.Normal = lerp(o.Normal, BlendNormals(o.Normal, detailNormalTangent), detailMask.a);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_EMISSION) //SDK-SYNC-IGNORE-LINE
|
||||
o.Emission = UNITY_SAMPLE_TEX2D(_EmissionMap, IN.texcoord0) * _EmissionColor; //SDK-SYNC-IGNORE-LINE
|
||||
#endif //SDK-SYNC-IGNORE-LINE
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
FallBack "VRChat/Mobile/Diffuse"
|
||||
CustomEditor "StandardLiteShaderGUI"
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b7113dea2069fc4e8943843eff19f70
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,158 @@
|
||||
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
|
||||
// Modified by VRChat Inc. to be more VR-friendly and support supersampling.
|
||||
|
||||
Shader "VRChat/Mobile/Worlds/Supersampled UI"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
|
||||
_Color ("Tint", Color) = (1,1,1,1)
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
"CanUseSpriteAtlas"="True"
|
||||
}
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ColorMask [_ColorMask]
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Default"
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 3.0
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
|
||||
#pragma multi_compile_local _ UNITY_UI_CLIP_RECT
|
||||
#pragma multi_compile_local _ UNITY_UI_ALPHACLIP
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float4 mask : TEXCOORD1;
|
||||
centroid float2 texcoordCentroid : TEXCOORD2;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _Color;
|
||||
fixed4 _TextureSampleAdd;
|
||||
float4 _ClipRect;
|
||||
float4 _MainTex_ST;
|
||||
float _UIMaskSoftnessX;
|
||||
float _UIMaskSoftnessY;
|
||||
|
||||
v2f vert(appdata_t v)
|
||||
{
|
||||
v2f OUT;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
|
||||
float4 vPosition = UnityObjectToClipPos(v.vertex);
|
||||
OUT.vertex = vPosition;
|
||||
|
||||
OUT.texcoord = OUT.texcoordCentroid = TRANSFORM_TEX(v.texcoord, _MainTex);
|
||||
|
||||
float2 pixelSize = vPosition.w;
|
||||
pixelSize /= float2(1, 1) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy));
|
||||
|
||||
float4 clampedRect = clamp(_ClipRect, -2e10, 2e10);
|
||||
float2 maskUV = (v.vertex.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy);
|
||||
OUT.mask = float4(v.vertex.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_UIMaskSoftnessX, _UIMaskSoftnessY) + abs(pixelSize.xy)));
|
||||
|
||||
OUT.color = v.color * _Color;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f IN) : SV_Target
|
||||
{
|
||||
//Round up the alpha color coming from the interpolator (to 1.0/256.0 steps)
|
||||
//The incoming alpha could have numerical instability, which makes it very sensible to
|
||||
//HDR color transparency blend, when it blends with the world's texture.
|
||||
const half alphaPrecision = half(0xff);
|
||||
const half invAlphaPrecision = half(1.0/alphaPrecision);
|
||||
IN.color.a = round(IN.color.a * alphaPrecision)*invAlphaPrecision;
|
||||
|
||||
// per pixel partial derivatives
|
||||
float2 dx = ddx(IN.texcoord.xy);
|
||||
float2 dy = ddy(IN.texcoord.xy);// rotated grid uv offsets
|
||||
float2 uvOffsets = float2(0.125, 0.375);
|
||||
float2 offsetUV = float2(0.0, 0.0);// supersampled using 2x2 rotated grid
|
||||
half4 color = 0;
|
||||
|
||||
// calculate gradient manually, since we don't want them to come from centroid texcoords
|
||||
float4 grad = float4(ddx(IN.texcoord.xy), ddy(IN.texcoord.xy));
|
||||
const float bias_pow = 0.5f; // pow(2, -1.0f)
|
||||
grad *= bias_pow;
|
||||
|
||||
// supersampling
|
||||
offsetUV.xy = IN.texcoordCentroid.xy + uvOffsets.x * dx + uvOffsets.y * dy;
|
||||
color += tex2Dgrad(_MainTex, offsetUV, grad.xy, grad.zw);
|
||||
offsetUV.xy = IN.texcoordCentroid.xy - uvOffsets.x * dx - uvOffsets.y * dy;
|
||||
color += tex2Dgrad(_MainTex, offsetUV, grad.xy, grad.zw);
|
||||
offsetUV.xy = IN.texcoordCentroid.xy + uvOffsets.y * dx - uvOffsets.x * dy;
|
||||
color += tex2Dgrad(_MainTex, offsetUV, grad.xy, grad.zw);
|
||||
offsetUV.xy = IN.texcoordCentroid.xy - uvOffsets.y * dx + uvOffsets.x * dy;
|
||||
color += tex2Dgrad(_MainTex, offsetUV, grad.xy, grad.zw);
|
||||
|
||||
color *= 0.25;
|
||||
color = (color + _TextureSampleAdd) * IN.color;
|
||||
|
||||
#ifdef UNITY_UI_CLIP_RECT
|
||||
half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw);
|
||||
color.a *= m.x * m.y;
|
||||
#endif
|
||||
|
||||
#ifdef UNITY_UI_ALPHACLIP
|
||||
clip (color.a - 0.001);
|
||||
#endif
|
||||
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44c1b7c3827912f45b473dbe106c1ecf
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,95 @@
|
||||
// VRChat Toon shader, based on Unity's Mobile/Diffuse. Copyright (c) 2019 VRChat.
|
||||
//Partially derived from "XSToon" (MIT License) - Copyright (c) 2019 thexiexe@gmail.com
|
||||
// Simplified Toon shader.
|
||||
// -fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH.
|
||||
|
||||
Shader "VRChat/Mobile/Toon Lit"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex("Texture", 2D) = "white" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" "Queue"="Geometry" }
|
||||
Pass
|
||||
{
|
||||
Name "FORWARD"
|
||||
Tags { "LightMode" = "ForwardBase" }
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#pragma multi_compile_fwdbase
|
||||
#pragma skip_variants SHADOWS_SHADOWMASK SHADOWS_SCREEN SHADOWS_DEPTH SHADOWS_CUBE
|
||||
|
||||
#include "UnityPBSLighting.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
|
||||
struct VertexInput
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
fixed4 color : COLOR;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 worldPos : TEXCOORD1;
|
||||
fixed4 color : TEXCOORD2;
|
||||
half4 indirect : TEXCOORD3;
|
||||
half4 direct : TEXCOORD4;
|
||||
SHADOW_COORDS(5)
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
UNITY_DECLARE_TEX2D(_MainTex);
|
||||
half4 _MainTex_ST;
|
||||
|
||||
VertexOutput vert (VertexInput v)
|
||||
{
|
||||
VertexOutput o;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_OUTPUT(VertexOutput, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.worldPos = mul(unity_ObjectToWorld, v.vertex);
|
||||
o.uv = v.uv;
|
||||
|
||||
half3 indirectDiffuse = ShadeSH9(half4(0, 0, 0, 1)); // We don't care about anything other than the color from GI, so only feed in 0,0,0, rather than the normal
|
||||
half4 lightCol = _LightColor0;
|
||||
|
||||
//If we don't have a directional light or realtime light in the scene, we can derive light color from a slightly modified indirect color.
|
||||
int lightEnv = int(any(_WorldSpaceLightPos0.xyz));
|
||||
if(lightEnv != 1)
|
||||
lightCol = indirectDiffuse.xyzz * 0.2;
|
||||
|
||||
o.color = v.color;
|
||||
o.direct = lightCol;
|
||||
o.indirect = indirectDiffuse.xyzz;
|
||||
TRANSFER_SHADOW(o);
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag (VertexOutput i, float facing : VFACE) : SV_Target
|
||||
{
|
||||
UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos.xyz);
|
||||
|
||||
half4 albedo = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(i.uv, _MainTex));
|
||||
half4 final = (albedo * i.color) * (i.direct * attenuation + i.indirect);
|
||||
|
||||
return half4(final.rgb, 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback "VRChat/Mobile/Diffuse"
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: affc81f3d164d734d8f13053effb1c5c
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,605 @@
|
||||
#ifndef VRCHAT_INCLUDED
|
||||
#define VRCHAT_INCLUDED
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityPBSLighting.cginc"
|
||||
|
||||
#if defined(UNITY_SHOULD_SAMPLE_SH) || defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
|
||||
#define UNITY_LIGHT_FUNCTION_APPLY_INDIRECT
|
||||
#endif
|
||||
|
||||
#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (defined(SHADER_TARGET_SURFACE_ANALYSIS) && !defined(SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER))
|
||||
#define SAMPLE_TEXTURE2D(tex,samplertex,coord) tex.Sample (samplertex,coord)
|
||||
#define SAMPLE_TEXTURE2D_GRAD(tex,samplertex,coord,ddx,ddy) tex.SampleGrad(samplertex, coord, ddx, ddy)
|
||||
#define TEXTURE2D_PARAM(textureName, samplerName) Texture2D textureName, SamplerState samplerName
|
||||
#define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName
|
||||
#else
|
||||
#define SAMPLE_TEXTURE2D(tex,samplertex,coord) tex2D (tex,coord)
|
||||
#define SAMPLE_TEXTURE2D_GRAD(tex,samplertex,coord,ddx,ddy) tex2Dgrad(tex, coord, ddx, ddy)
|
||||
#define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName
|
||||
#define TEXTURE2D_ARGS(textureName, samplerName) textureName
|
||||
#endif
|
||||
|
||||
// Use our squeezed BRDF on mobile
|
||||
// In general we want FLOAT_MIN to be the smallest value such that (1.0f + FLOAT_MIN) != FLOAT_MIN
|
||||
#if defined(SHADER_API_MOBILE)
|
||||
#define VRC_BRDF_PBS BRDF2_VRC_PBS
|
||||
#define FLOAT_MIN 1e-4
|
||||
#else
|
||||
#define VRC_BRDF_PBS UNITY_BRDF_PBS
|
||||
#define FLOAT_MIN 1e-6
|
||||
#endif
|
||||
|
||||
#if defined(_BICUBIC)
|
||||
float BakeryBicubic_w0(float a)
|
||||
{
|
||||
return (1.0f/6.0f)*(a*(a*(-a + 3.0f) - 3.0f) + 1.0f);
|
||||
}
|
||||
|
||||
float BakeryBicubic_w1(float a)
|
||||
{
|
||||
return (1.0f/6.0f)*(a*a*(3.0f*a - 6.0f) + 4.0f);
|
||||
}
|
||||
|
||||
float BakeryBicubic_w2(float a)
|
||||
{
|
||||
return (1.0f/6.0f)*(a*(a*(-3.0f*a + 3.0f) + 3.0f) + 1.0f);
|
||||
}
|
||||
|
||||
float BakeryBicubic_w3(float a)
|
||||
{
|
||||
return (1.0f/6.0f)*(a*a*a);
|
||||
}
|
||||
|
||||
float BakeryBicubic_g0(float a)
|
||||
{
|
||||
return BakeryBicubic_w0(a) + BakeryBicubic_w1(a);
|
||||
}
|
||||
|
||||
float BakeryBicubic_g1(float a)
|
||||
{
|
||||
return BakeryBicubic_w2(a) + BakeryBicubic_w3(a);
|
||||
}
|
||||
|
||||
float BakeryBicubic_h0(float a)
|
||||
{
|
||||
return -1.0f + BakeryBicubic_w1(a) / (BakeryBicubic_w0(a) + BakeryBicubic_w1(a)) + 0.5f;
|
||||
}
|
||||
|
||||
float BakeryBicubic_h1(float a)
|
||||
{
|
||||
return 1.0f + BakeryBicubic_w3(a) / (BakeryBicubic_w2(a) + BakeryBicubic_w3(a)) + 0.5f;
|
||||
}
|
||||
|
||||
// Bicubic
|
||||
float4 SampleTexture2DBicubicFilter(TEXTURE2D_PARAM(tex, smp), float2 coord)
|
||||
{
|
||||
#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (defined(SHADER_TARGET_SURFACE_ANALYSIS) && !defined(SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER))
|
||||
float width, height;
|
||||
tex.GetDimensions(width, height);
|
||||
float4 texelSize = float4(width, height, 1/width, 1/height);
|
||||
#else
|
||||
float2 theSize = textureSize(tex, 0);
|
||||
float4 texelSize = float4(
|
||||
float(theSize.x),
|
||||
float(theSize.y),
|
||||
1/float(theSize.x),
|
||||
1/float(theSize.y));;
|
||||
#endif
|
||||
|
||||
float x = coord.x * texelSize.z;
|
||||
float y = coord.y * texelSize.z;
|
||||
|
||||
x -= 0.5f;
|
||||
y -= 0.5f;
|
||||
|
||||
float px = floor(x);
|
||||
float py = floor(y);
|
||||
|
||||
float fx = x - px;
|
||||
float fy = y - py;
|
||||
|
||||
float g0x = BakeryBicubic_g0(fx);
|
||||
float g1x = BakeryBicubic_g1(fx);
|
||||
float h0x = BakeryBicubic_h0(fx);
|
||||
float h1x = BakeryBicubic_h1(fx);
|
||||
float h0y = BakeryBicubic_h0(fy);
|
||||
float h1y = BakeryBicubic_h1(fy);
|
||||
|
||||
return BakeryBicubic_g0(fy) * ( g0x * SAMPLE_TEXTURE2D(tex, smp, (float2(px + h0x, py + h0y) * texelSize.x)) +
|
||||
g1x * SAMPLE_TEXTURE2D(tex, smp, (float2(px + h1x, py + h0y) * texelSize.x))) +
|
||||
BakeryBicubic_g1(fy) * ( g0x * SAMPLE_TEXTURE2D(tex, smp, (float2(px + h0x, py + h1y) * texelSize.x)) +
|
||||
g1x * SAMPLE_TEXTURE2D(tex, smp, (float2(px + h1x, py + h1y) * texelSize.x)));
|
||||
}
|
||||
#define MAYBE_BICUBIC_SAMPLE(texture, smp, uv) SampleTexture2DBicubicFilter(TEXTURE2D_ARGS(texture, smp), uv)
|
||||
#else
|
||||
#define MAYBE_BICUBIC_SAMPLE(texture, smp, uv) SAMPLE_TEXTURE2D(texture, smp, uv)
|
||||
#endif
|
||||
|
||||
inline half3 VRC_SafeNormalize(half3 value)
|
||||
{
|
||||
float lenSqr = max((float)dot(value, value), FLOAT_MIN);
|
||||
return value * (half) rsqrt(lenSqr);
|
||||
}
|
||||
|
||||
inline half shEvaluateDiffuseL1Geomerics(half L0, half3 L1, half3 n)
|
||||
{
|
||||
// avg direction of incoming light
|
||||
half3 R1 = 0.5f * L1;
|
||||
|
||||
// directional brightness
|
||||
half lenR1 = length(R1);
|
||||
|
||||
// linear angle between normal and direction 0-1, saturate fix from filamented
|
||||
half q = dot(VRC_SafeNormalize(R1), n) * 0.5 + 0.5;
|
||||
q = isnan(q) ? 1 : q;
|
||||
q = saturate(q);
|
||||
|
||||
// power for q
|
||||
// lerps from 1 (linear) to 3 (cubic) based on directionality
|
||||
//half p = 1.0f + 2.0f * lenR1 / L0;
|
||||
|
||||
// dynamic range constant
|
||||
// should vary between 4 (highly directional) and 0 (ambient)
|
||||
//half a = (1.0f - lenR1 / L0) / (1.0f + lenR1 / L0);
|
||||
|
||||
// negative ambient fix, if L0 <= 0, return 0
|
||||
//return (L0 <= 0.f) ? 0.f : (L0 * (a + (1.0f - a) * (p + 1.0f) * pow(q, p)));
|
||||
|
||||
// optimized reordering. thanks wolfram
|
||||
return (L0 <= 0.f) ? 0.f : ( 4. * lenR1 * pow(q, (2 * lenR1) / L0 + 1) + ( L0 * (L0 - lenR1) )/(L0 + lenR1));
|
||||
}
|
||||
|
||||
inline half shEvaluateDiffuseL1Normalized(half L0, half3 L1, half3 n)
|
||||
{
|
||||
return shEvaluateDiffuseL1Geomerics(1, L1 / L0, n);
|
||||
}
|
||||
|
||||
float PerceptualSmoothnessToRoughness(float perceptualSmoothness)
|
||||
{
|
||||
float perceptualRoughness = SmoothnessToPerceptualRoughness(perceptualSmoothness);
|
||||
half roughness = PerceptualRoughnessToRoughness(perceptualRoughness);
|
||||
return roughness;
|
||||
}
|
||||
|
||||
float RoughnessToPerceptualSmoothness(float roughness)
|
||||
{
|
||||
float perceptualRoughness = RoughnessToPerceptualRoughness(roughness);
|
||||
return 1.0 - perceptualRoughness;
|
||||
}
|
||||
|
||||
float ProjectedSpaceNormalFiltering(half perceptualSmoothness, float variance, float threshold)
|
||||
{
|
||||
float roughness = PerceptualSmoothnessToRoughness(perceptualSmoothness);
|
||||
// Ref: Stable Geometric Specular Antialiasing with Projected-Space NDF Filtering - https://yusuketokuyoshi.com/papers/2021/Tokuyoshi2021SAA.pdf
|
||||
float squaredRoughness = roughness * roughness;
|
||||
float projRoughness2 = squaredRoughness / (1.0 - squaredRoughness);
|
||||
float filteredProjRoughness2 = saturate(projRoughness2 + min(2.0 * variance, threshold * threshold));
|
||||
squaredRoughness = filteredProjRoughness2 / (filteredProjRoughness2 + 1.0f);
|
||||
|
||||
return RoughnessToPerceptualSmoothness(sqrt(squaredRoughness));
|
||||
}
|
||||
|
||||
// Reference: Error Reduction and Simplification for Shading Anti-Aliasing
|
||||
// Specular antialiasing for geometry-induced normal (and NDF) variations: Tokuyoshi / Kaplanyan et al.'s method.
|
||||
// This is the deferred approximation, which works reasonably well so we keep it for forward too for now.
|
||||
// screenSpaceVariance should be at most 0.5^2 = 0.25, as that corresponds to considering
|
||||
// a gaussian pixel reconstruction kernel with a standard deviation of 0.5 of a pixel, thus 2 sigma covering the whole pixel.
|
||||
float GeometricNormalVariance(float3 geometricNormalWS, float screenSpaceVariance)
|
||||
{
|
||||
float3 deltaU = ddx(geometricNormalWS);
|
||||
float3 deltaV = ddy(geometricNormalWS);
|
||||
|
||||
return screenSpaceVariance * (dot(deltaU, deltaU) + dot(deltaV, deltaV));
|
||||
}
|
||||
|
||||
float ProjectedSpaceGeometricNormalFiltering(float perceptualSmoothness, float3 geometricNormalWS, float screenSpaceVariance, float threshold)
|
||||
{
|
||||
float variance = GeometricNormalVariance(geometricNormalWS, screenSpaceVariance);
|
||||
return ProjectedSpaceNormalFiltering(perceptualSmoothness, variance, threshold);
|
||||
}
|
||||
|
||||
//#define OLD_GGX_TERM
|
||||
#if !defined (OLD_GGX_TERM)
|
||||
inline half ComputeSpecularGGX(half3 nL1, half3 viewDir, half3 normalWorld, half smoothness)
|
||||
{
|
||||
nL1 = VRC_SafeNormalize(nL1);
|
||||
|
||||
half3 halfDir = VRC_SafeNormalize(nL1 - viewDir);
|
||||
half nh = saturate(dot(normalWorld, halfDir));
|
||||
|
||||
half perceptualRoughness = SmoothnessToPerceptualRoughness(smoothness);//* sqrt(focus));
|
||||
half roughness = PerceptualRoughnessToRoughness(perceptualRoughness);
|
||||
|
||||
half lh = saturate(dot(nL1, halfDir));
|
||||
// ------------------------
|
||||
// Specular term
|
||||
// GGX Distribution multiplied by combined approximation of Visibility and Fresnel
|
||||
// See "Optimizing PBR for Mobile" from Siggraph 2015 moving mobile graphics course
|
||||
// https://community.arm.com/events/1155
|
||||
|
||||
half a = roughness;
|
||||
half a2 = a*a;
|
||||
|
||||
half d = nh * nh * (a2 - 1.f) + 1.00001f;
|
||||
half specularTerm = a2 / (max(0.1f, lh*lh) * (a + 0.5f) * (d * d) * 4);
|
||||
|
||||
#if defined (SHADER_API_MOBILE)
|
||||
// on mobiles (where half actually means something) denominator have risk of overflow
|
||||
// clamp below was added specifically to "fix" that, but dx compiler (we convert bytecode to metal/gles)
|
||||
// sees that specularTerm have only non-negative terms, so it skips max(0,..) in clamp (leaving only min(100,...))
|
||||
specularTerm = specularTerm - FLOAT_MIN;
|
||||
specularTerm = clamp(specularTerm, 0.0, 100.0); // Prevent FP16 overflow on mobiles
|
||||
#endif
|
||||
|
||||
return specularTerm;
|
||||
}
|
||||
#else
|
||||
inline half ComputeSpecularGGX(half3 nL1, half3 viewDir, half3 normalWorld, half smoothness)
|
||||
{
|
||||
nL1 = VRC_SafeNormalize(nL1);
|
||||
half3 halfDir = VRC_SafeNormalize(nL1 - viewDir);
|
||||
half nh = saturate(dot(normalWorld, halfDir));
|
||||
half perceptualRoughness = SmoothnessToPerceptualRoughness(smoothness );//* sqrt(focus));
|
||||
half roughness = PerceptualRoughnessToRoughness(perceptualRoughness);
|
||||
return GGXTerm(nh, roughness);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_MONOSH)
|
||||
// MonoSH by Bakery Lightmapper https://assetstore.unity.com/packages/tools/level-design/bakery-gpu-lightmapper-122218
|
||||
inline void BakeryMonoSH(out half3 diffuseColor, out half3 specularContrib, float2 lmUV, half3 normalWorld, half3 viewDir, half smoothness, half occlusion)
|
||||
{
|
||||
half3 dominantDir = MAYBE_BICUBIC_SAMPLE(unity_LightmapInd, samplerunity_Lightmap, lmUV).xyz;;
|
||||
half3 L0 = DecodeLightmap(MAYBE_BICUBIC_SAMPLE(unity_Lightmap, samplerunity_Lightmap, lmUV));
|
||||
|
||||
half3 nL1 = dominantDir * 2 - 1;
|
||||
half3x3 L1 = half3x3(nL1.x * L0, nL1.y * L0, nL1.z * L0) * 2;
|
||||
|
||||
half lumaL0 = dot(L0, 1);
|
||||
half3 lumaL1 = mul(L1, half3(1, 1, 1));
|
||||
half lumaSH = shEvaluateDiffuseL1Geomerics(lumaL0, lumaL1, normalWorld);
|
||||
|
||||
half3 sh = L0 + mul(normalWorld, L1);
|
||||
half regularLumaSH = dot(sh, 1);
|
||||
sh *= lerp(1, lumaSH / regularLumaSH, saturate(regularLumaSH*16));
|
||||
|
||||
diffuseColor = max(sh, 0.0);
|
||||
|
||||
#if defined(_LMSPEC)
|
||||
half L1len = length(mul(L1, half3(1, 1, 1)));
|
||||
half focus = L1len / (length(L0) + L1len);
|
||||
half specularTerm = ComputeSpecularGGX(nL1, viewDir, normalWorld, smoothness * focus);
|
||||
|
||||
sh = L0 + mul(nL1, L1);
|
||||
|
||||
specularContrib = max(specularTerm * sh, 0.0);
|
||||
|
||||
// Reflection Probes use occlusion, direct lights don't. MonoSH and Specular Hack are both somewhere in between,
|
||||
// so we use focus to split the difference - 1.0 is direct, 0.0 is reflection probe, so we invert.
|
||||
specularContrib *= LerpOneTo(occlusion, 1 - focus);
|
||||
#else
|
||||
specularContrib = 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
inline UnityGI UnityGI_BaseVRC(UnityGIInput data, half occlusion, half3 normalWorld, half3 eyeVec, half smoothness, half hasReflProbe)
|
||||
{
|
||||
UnityGI o_gi;
|
||||
|
||||
// Base pass with Lightmap support is responsible for handling ShadowMask / blending here for performance reason
|
||||
#if defined(HANDLE_SHADOWS_BLENDING_IN_GI)
|
||||
half bakedAtten = UnitySampleBakedOcclusion(data.lightmapUV.xy, data.worldPos);
|
||||
float zDist = dot(_WorldSpaceCameraPos - data.worldPos, UNITY_MATRIX_V[2].xyz);
|
||||
float fadeDist = UnityComputeShadowFadeDistance(data.worldPos, zDist);
|
||||
data.atten = UnityMixRealtimeAndBakedShadows(data.atten, bakedAtten, UnityComputeShadowFade(fadeDist));
|
||||
#endif
|
||||
|
||||
o_gi.light = data.light;
|
||||
o_gi.light.color *= data.atten;
|
||||
|
||||
#if defined(LIGHTMAP_ON)
|
||||
#if defined(_MONOSH)
|
||||
BakeryMonoSH(o_gi.indirect.diffuse, o_gi.indirect.specular, data.lightmapUV.xy, normalWorld, eyeVec, smoothness, occlusion);
|
||||
#else
|
||||
// Baked lightmaps
|
||||
|
||||
half3 bakedColor = half3(1.0, 1.0, 1.0);
|
||||
half4 bakedColorTex = UNITY_SAMPLE_TEX2D(unity_Lightmap, data.lightmapUV.xy);
|
||||
#if defined(FORCE_UNITY_DLDR_LIGHTMAP_ENCODING)
|
||||
bakedColor = DecodeLightmapDoubleLDR(bakedColorTex, unity_Lightmap_HDR);
|
||||
#elif defined(FORCE_UNITY_RGBM_LIGHTMAP_ENCODING)
|
||||
bakedColor = DecodeLightmapRGBM(bakedColorTex, unity_Lightmap_HDR);
|
||||
#elif defined(FORCE_UNITY_LIGHTMAP_FULL_HDR_ENCODING)
|
||||
bakedColor = bakedColorTex;
|
||||
#else
|
||||
bakedColor = DecodeLightmap(bakedColorTex);
|
||||
#endif
|
||||
|
||||
// Can be set if the renderer has a valid lightmap but the shader doesn't use it
|
||||
#if !defined(UNITY_LIGHTMAP_NONE)
|
||||
#if defined(DIRLIGHTMAP_COMBINED)
|
||||
fixed4 bakedDirTex = UNITY_SAMPLE_TEX2D_SAMPLER(unity_LightmapInd, unity_Lightmap, data.lightmapUV.xy);
|
||||
o_gi.indirect.diffuse = DecodeDirectionalLightmap(bakedColor, bakedDirTex, normalWorld);
|
||||
#else // not directional lightmap
|
||||
o_gi.indirect.diffuse = bakedColor;
|
||||
#endif
|
||||
#else
|
||||
o_gi.indirect.diffuse = 1;
|
||||
#endif
|
||||
|
||||
o_gi.indirect.specular = 0;
|
||||
#endif
|
||||
o_gi.indirect.diffuse *= occlusion;
|
||||
#elif defined(UNITY_SHOULD_SAMPLE_SH)
|
||||
o_gi.indirect.diffuse.r = shEvaluateDiffuseL1Geomerics(unity_SHAr.w, unity_SHAr.xyz, normalWorld);
|
||||
o_gi.indirect.diffuse.g = shEvaluateDiffuseL1Geomerics(unity_SHAg.w, unity_SHAg.xyz, normalWorld);
|
||||
o_gi.indirect.diffuse.b = shEvaluateDiffuseL1Geomerics(unity_SHAb.w, unity_SHAb.xyz, normalWorld);
|
||||
|
||||
#if !defined(_SPECULARHIGHLIGHTS_OFF)
|
||||
UNITY_BRANCH
|
||||
#if !defined(_GLOSSYREFLECTIONS_OFF)
|
||||
if(!any(o_gi.light.color) && !hasReflProbe)
|
||||
#else
|
||||
if(!any(o_gi.light.color))
|
||||
#endif
|
||||
{
|
||||
half3 L0rgb = half3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
|
||||
half3x3 L1rgb = half3x3(unity_SHAr.x, unity_SHAg.x, unity_SHAb.x,
|
||||
unity_SHAr.y, unity_SHAg.y, unity_SHAb.y,
|
||||
unity_SHAr.z, unity_SHAg.z, unity_SHAb.z);
|
||||
half3 L1 = unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
|
||||
|
||||
half3 dominantDir = VRC_SafeNormalize(L1);
|
||||
|
||||
// Light can be anywhere from 'fully sparse' to 'completely focused' based on how much of it is L0 or L1rgb.
|
||||
half L1len = length(L1);
|
||||
half focus = L1len / (length(L0rgb) + L1len);
|
||||
half specularTerm = ComputeSpecularGGX(dominantDir, eyeVec, normalWorld, smoothness * focus);
|
||||
|
||||
// L0 + L1, the total light energy expected, is the same over the whole mesh. This is a problem with specular highlights
|
||||
// as they have a second peak in the negative direction - normally hidden by the fact that light energy there is normally zero.
|
||||
// Multiplying by non-linear diffuse gives satisfactory results, though isn't particularly physically accurate.
|
||||
// The brightness vs ground truth (a reflection probe) is too low though... closest we can get appears to be
|
||||
// a dimensionless version, shEvaluateDiffuseL1Geometrics but applied to just the ratio.
|
||||
half energyFactor = shEvaluateDiffuseL1Normalized(dot(L0rgb, 1), L1, normalWorld);
|
||||
half3 sh = (L0rgb + mul(dominantDir, L1rgb)) * energyFactor;
|
||||
|
||||
o_gi.indirect.specular = max(specularTerm * sh, 0.0);
|
||||
|
||||
// Reflection Probes use occlusion, direct lights don't. MonoSH and Specular Hack are both somewhere in between,
|
||||
// so we use focus to split the difference - 1.0 is direct, 0.0 is reflection probe, so we invert.
|
||||
o_gi.indirect.specular *= LerpOneTo(occlusion, 1 - focus);
|
||||
}
|
||||
else
|
||||
{
|
||||
o_gi.indirect.specular = 0;
|
||||
}
|
||||
#else
|
||||
o_gi.indirect.specular = 0;
|
||||
#endif
|
||||
o_gi.indirect.diffuse += data.ambient;
|
||||
o_gi.indirect.diffuse *= occlusion;
|
||||
#else
|
||||
o_gi.indirect.specular = 0;
|
||||
o_gi.indirect.diffuse = 0;
|
||||
#endif
|
||||
|
||||
return o_gi;
|
||||
}
|
||||
|
||||
struct SurfaceOutputStandardVRC
|
||||
{
|
||||
fixed3 Albedo; // base (diffuse or specular) color
|
||||
float3 Normal; // tangent space normal, if written
|
||||
half3 Emission;
|
||||
half Metallic; // 0=non-metal, 1=metal
|
||||
// Smoothness is the user facing name, it should be perceptual smoothness but user should not have to deal with it.
|
||||
// Everywhere in the code you meet smoothness it is perceptual smoothness
|
||||
half Smoothness; // 0=rough, 1=smooth
|
||||
half Occlusion;
|
||||
bool SpecularAA;
|
||||
half SpecularAAVariance;
|
||||
half SpecularAAThreshold;
|
||||
fixed Alpha; // alpha for transparencies
|
||||
half MinimumBrightness; // minimum brightness regardless of lighting
|
||||
};
|
||||
|
||||
struct SurfaceOutputVRC
|
||||
{
|
||||
fixed3 Albedo;
|
||||
fixed3 Normal;
|
||||
fixed3 Emission;
|
||||
half Specular;
|
||||
fixed Gloss;
|
||||
fixed Alpha;
|
||||
};
|
||||
|
||||
// Based on BRDF2_Unity_PBS
|
||||
// Modified here to re-use calculations for MonoSH and squeeze out all use cases not covered by VRC
|
||||
half4 BRDF2_VRC_PBS (half3 diffColor, half3 specColor, half oneMinusReflectivity, half smoothness,
|
||||
float3 normal, float3 viewDir,
|
||||
UnityLight light, UnityIndirect gi)
|
||||
{
|
||||
half3 color = gi.diffuse * diffColor;
|
||||
#if !defined(_SPECULARHIGHLIGHTS_OFF) || !defined(_GLOSSYREFLECTIONS_OFF)
|
||||
half nv = saturate(dot(normal, viewDir));
|
||||
half grazingTerm = saturate(smoothness + (1-oneMinusReflectivity));
|
||||
// surfaceReduction = Int D(NdotH) * NdotH * Id(NdotL>0) dH = 1/(realRoughness^2+1)
|
||||
half perceptualRoughness = SmoothnessToPerceptualRoughness(smoothness );//* sqrt(focus));
|
||||
half roughness = PerceptualRoughnessToRoughness(perceptualRoughness);
|
||||
|
||||
// 1-0.28*x^3 as approximation for (1/(x^4+1))^(1/2.2) on the domain [0;1]
|
||||
// 1-x^3*(0.6-0.08*x) approximation for 1/(x^4+1)
|
||||
half surfaceReduction = (0.6-0.08*perceptualRoughness);
|
||||
|
||||
surfaceReduction = 1.0 - roughness*perceptualRoughness*surfaceReduction;
|
||||
|
||||
color += surfaceReduction * gi.specular * FresnelLerpFast (specColor, grazingTerm, nv);
|
||||
#endif
|
||||
|
||||
// The DIRECTIONAL static branch exists, but in practice it seems like unity never switches back to the non-DIRECTIONAL variant once it switches
|
||||
// Not worth branching for a single dotproduct, i.e. if no specularity
|
||||
#if !defined(_SPECULARHIGHLIGHTS_OFF)
|
||||
UNITY_BRANCH
|
||||
if(any(light.color))
|
||||
#else
|
||||
if (true)
|
||||
#endif
|
||||
{
|
||||
half nl = saturate(dot(normal, light.dir));
|
||||
half3 mergedContrib = diffColor * nl;
|
||||
#if !defined(_SPECULARHIGHLIGHTS_OFF)
|
||||
half specularTerm = ComputeSpecularGGX(light.dir, -viewDir, normal, smoothness);
|
||||
mergedContrib += max(specularTerm * specColor, 0.0);
|
||||
#endif
|
||||
|
||||
color += light.color * mergedContrib;
|
||||
}
|
||||
// Original BRDF's color function.
|
||||
// Interestingly, it doesn't appear as though fresnel is applied to specular highlights caused by lights?
|
||||
// half3 color = (diffColor + specularTerm * specColor) * light.color * nl
|
||||
// + gi.diffuse * diffColor
|
||||
// + surfaceReduction * gi.specular * FresnelLerpFast (specColor, grazingTerm, nv);
|
||||
|
||||
return half4(color, 1);
|
||||
}
|
||||
|
||||
// executed second
|
||||
inline half4 LightingStandardVRC(SurfaceOutputStandardVRC s, float3 viewDir, UnityGI gi)
|
||||
{
|
||||
s.Normal = normalize(s.Normal);
|
||||
UNITY_BRANCH if (s.SpecularAA)
|
||||
s.Smoothness = ProjectedSpaceGeometricNormalFiltering(s.Smoothness, s.Normal, s.SpecularAAVariance, s.SpecularAAThreshold);
|
||||
half3 specularColor;
|
||||
half oneMinusReflectivity;
|
||||
s.Albedo = DiffuseAndSpecularFromMetallic(s.Albedo, s.Metallic, /*out*/ specularColor, /*out*/ oneMinusReflectivity);
|
||||
|
||||
// shader relies on pre-multiply alpha-blend (_SrcBlend = One, _DstBlend = OneMinusSrcAlpha)
|
||||
// this is necessary to handle transparency in physically correct way - only diffuse component gets affected by alpha
|
||||
half outputAlpha;
|
||||
s.Albedo = PreMultiplyAlpha (s.Albedo, s.Alpha, oneMinusReflectivity, /*out*/ outputAlpha);
|
||||
|
||||
half4 c = VRC_BRDF_PBS(s.Albedo, specularColor, oneMinusReflectivity, s.Smoothness, s.Normal, viewDir, gi.light, gi.indirect);
|
||||
c.a = outputAlpha;
|
||||
|
||||
#ifndef _DEBUG_VRC
|
||||
return c;
|
||||
#else
|
||||
return debugCol;
|
||||
#endif
|
||||
}
|
||||
|
||||
half3 VRC_GlossyEnvironment (UNITY_ARGS_TEXCUBE(tex), half4 hdr, Unity_GlossyEnvironmentData glossIn, out half hasReflProbe)
|
||||
{
|
||||
half perceptualRoughness = glossIn.roughness /* perceptualRoughness */ ;
|
||||
|
||||
// TODO: CAUTION: remap from Morten may work only with offline convolution, see impact with runtime convolution!
|
||||
// For now disabled
|
||||
#if 0
|
||||
float m = PerceptualRoughnessToRoughness(perceptualRoughness); // m is the real roughness parameter
|
||||
const float fEps = 1.192092896e-07F; // smallest such that 1.0+FLT_EPSILON != 1.0 (+1e-4h is NOT good here. is visibly very wrong)
|
||||
float n = (2.0/max(fEps, m*m))-2.0; // remap to spec power. See eq. 21 in --> https://dl.dropboxusercontent.com/u/55891920/papers/mm_brdf.pdf
|
||||
|
||||
n /= 4; // remap from n_dot_h formulatino to n_dot_r. See section "Pre-convolved Cube Maps vs Path Tracers" --> https://s3.amazonaws.com/docs.knaldtech.com/knald/1.0.0/lys_power_drops.html
|
||||
|
||||
perceptualRoughness = pow( 2/(n+2), 0.25); // remap back to square root of real roughness (0.25 include both the sqrt root of the conversion and sqrt for going from roughness to perceptualRoughness)
|
||||
#else
|
||||
// MM: came up with a surprisingly close approximation to what the #if 0'ed out code above does.
|
||||
perceptualRoughness = perceptualRoughness*(1.7 - 0.7*perceptualRoughness);
|
||||
#endif
|
||||
|
||||
half mip = perceptualRoughnessToMipmapLevel(perceptualRoughness);
|
||||
half3 R = glossIn.reflUVW;
|
||||
half4 rgbm = UNITY_SAMPLE_TEXCUBE_LOD(tex, R, mip);
|
||||
hasReflProbe = rgbm.a;
|
||||
|
||||
return DecodeHDR(rgbm, hdr);
|
||||
}
|
||||
|
||||
inline half3 UnityGI_IndirectSpecularVRC(UnityGIInput data, half occlusion, Unity_GlossyEnvironmentData glossIn, out half hasReflProbe)
|
||||
{
|
||||
half3 specular;
|
||||
|
||||
#if defined(_GLOSSYREFLECTIONS_OFF)
|
||||
specular = unity_IndirectSpecColor.rgb;
|
||||
hasReflProbe = 0;
|
||||
#else
|
||||
#if defined(UNITY_SPECCUBE_BOX_PROJECTION)
|
||||
// we will tweak reflUVW in glossIn directly (as we pass it to Unity_GlossyEnvironment twice for probe0 and probe1), so keep original to pass into BoxProjectedCubemapDirection
|
||||
half3 originalReflUVW = glossIn.reflUVW;
|
||||
glossIn.reflUVW = BoxProjectedCubemapDirection (originalReflUVW, data.worldPos, data.probePosition[0], data.boxMin[0], data.boxMax[0]);
|
||||
#endif
|
||||
|
||||
half3 env0 = VRC_GlossyEnvironment (UNITY_PASS_TEXCUBE(unity_SpecCube0), data.probeHDR[0], glossIn, hasReflProbe);
|
||||
#if defined(UNITY_SPECCUBE_BLENDING)
|
||||
const float kBlendFactor = 0.99999;
|
||||
float blendLerp = data.boxMin[0].w;
|
||||
UNITY_BRANCH
|
||||
if (blendLerp < kBlendFactor)
|
||||
{
|
||||
half secondReflProbe = 0;
|
||||
half3 env1 = VRC_GlossyEnvironment (UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1,unity_SpecCube0), data.probeHDR[1], glossIn, secondReflProbe);
|
||||
hasReflProbe += secondReflProbe;
|
||||
specular = lerp(env1, env0, blendLerp);
|
||||
}
|
||||
else
|
||||
{
|
||||
specular = env0;
|
||||
}
|
||||
#else
|
||||
specular = env0;
|
||||
#endif
|
||||
#endif
|
||||
return specular * occlusion;
|
||||
}
|
||||
|
||||
inline void VRC_ApplyMinBrightness(inout UnityGI gi, half minBright)
|
||||
{
|
||||
gi.indirect.diffuse = max(gi.indirect.diffuse, minBright);
|
||||
}
|
||||
|
||||
// executed first
|
||||
inline void LightingStandardVRC_GI(SurfaceOutputStandardVRC s, UnityGIInput data, inout UnityGI gi)
|
||||
{
|
||||
Unity_GlossyEnvironmentData g = UnityGlossyEnvironmentSetup(s.Smoothness, data.worldViewDir, s.Normal, lerp(unity_ColorSpaceDielectricSpec.rgb, s.Albedo, s.Metallic));
|
||||
half hasReflProbe = 0;
|
||||
half3 indirectSpecular = UnityGI_IndirectSpecularVRC(data, s.Occlusion, g, /* out */ hasReflProbe);
|
||||
gi = UnityGI_BaseVRC(data, s.Occlusion, s.Normal, -data.worldViewDir, s.Smoothness, hasReflProbe);
|
||||
VRC_ApplyMinBrightness(gi, s.MinimumBrightness);
|
||||
gi.indirect.specular += indirectSpecular;
|
||||
}
|
||||
|
||||
inline fixed4 UnityLambertVRCLight (SurfaceOutputVRC s, UnityLight light)
|
||||
{
|
||||
fixed diff = max (0, dot (s.Normal, light.dir));
|
||||
|
||||
fixed4 c;
|
||||
c.rgb = s.Albedo * light.color * diff;
|
||||
c.a = s.Alpha;
|
||||
return c;
|
||||
}
|
||||
|
||||
inline fixed4 LightingLambertVRC (SurfaceOutputVRC s, UnityGI gi)
|
||||
{
|
||||
fixed4 c;
|
||||
c = UnityLambertVRCLight (s, gi.light);
|
||||
|
||||
#if defined(UNITY_LIGHT_FUNCTION_APPLY_INDIRECT)
|
||||
c.rgb += s.Albedo * gi.indirect.diffuse;
|
||||
#endif
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
inline void LightingLambertVRC_GI (
|
||||
SurfaceOutputVRC s,
|
||||
UnityGIInput data,
|
||||
inout UnityGI gi)
|
||||
{
|
||||
gi = UnityGI_BaseVRC(data, 1.0, s.Normal, half3(0, 0, 0), half(0), 0);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3708ad9ef8f39284dba1249e0a7f3c86
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||