Outline Area and Particle Effect on Occupying Platform
parent
6e94be8b73
commit
b952b03f4c
@ -0,0 +1,51 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Custom_TransparentOutline
|
||||
m_Shader: {fileID: 4800000, guid: b59e0f7271de96f44aeb59a7632efae2, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 1
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _Texture2DAsset_ed5845bdef6b4ba39ae420b153b33345_Out_0_Texture2D:
|
||||
m_Texture: {fileID: 2800000, guid: 4a53678acb2214c7aa104d85906b0982, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_Lightmaps:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_LightmapsInd:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_ShadowMasks:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _OutlineWidth: 0.1
|
||||
- _QueueControl: 0
|
||||
- _QueueOffset: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _MainColor: {r: 1, g: 1, b: 1, a: 0.46666667}
|
||||
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d59a0e48d5e5a34bbc8919ff8e3cecd
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b217239934a46b4c91c867e2079ea81
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69d9586d668d9e24ab3f720f0d88330b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc25cfaaf25ea94438f80324b83abeec
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,275 @@
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
// Cartoon FX
|
||||
// (c) 2012-2020 Jean Moreno
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
// Parse conditional expressions from CFXR_MaterialInspector to show/hide some parts of the UI easily
|
||||
|
||||
namespace CartoonFX
|
||||
{
|
||||
public static class ExpressionParser
|
||||
{
|
||||
public delegate bool EvaluateFunction(string content);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
// Main Function to use
|
||||
|
||||
static public bool EvaluateExpression(string expression, EvaluateFunction evalFunction)
|
||||
{
|
||||
//Remove white spaces and double && ||
|
||||
string cleanExpr = "";
|
||||
for(int i = 0; i < expression.Length; i++)
|
||||
{
|
||||
switch(expression[i])
|
||||
{
|
||||
case ' ': break;
|
||||
case '&': cleanExpr += expression[i]; i++; break;
|
||||
case '|': cleanExpr += expression[i]; i++; break;
|
||||
default: cleanExpr += expression[i]; break;
|
||||
}
|
||||
}
|
||||
|
||||
List<Token> tokens = new List<Token>();
|
||||
StringReader reader = new StringReader(cleanExpr);
|
||||
Token t = null;
|
||||
do
|
||||
{
|
||||
t = new Token(reader);
|
||||
tokens.Add(t);
|
||||
} while(t.type != Token.TokenType.EXPR_END);
|
||||
|
||||
List<Token> polishNotation = Token.TransformToPolishNotation(tokens);
|
||||
|
||||
var enumerator = polishNotation.GetEnumerator();
|
||||
enumerator.MoveNext();
|
||||
Expression root = MakeExpression(ref enumerator, evalFunction);
|
||||
|
||||
return root.Evaluate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
// Expression Token
|
||||
|
||||
public class Token
|
||||
{
|
||||
static Dictionary<char, KeyValuePair<TokenType, string>> typesDict = new Dictionary<char, KeyValuePair<TokenType, string>>()
|
||||
{
|
||||
{'(', new KeyValuePair<TokenType, string>(TokenType.OPEN_PAREN, "(")},
|
||||
{')', new KeyValuePair<TokenType, string>(TokenType.CLOSE_PAREN, ")")},
|
||||
{'!', new KeyValuePair<TokenType, string>(TokenType.UNARY_OP, "NOT")},
|
||||
{'&', new KeyValuePair<TokenType, string>(TokenType.BINARY_OP, "AND")},
|
||||
{'|', new KeyValuePair<TokenType, string>(TokenType.BINARY_OP, "OR")}
|
||||
};
|
||||
|
||||
public enum TokenType
|
||||
{
|
||||
OPEN_PAREN,
|
||||
CLOSE_PAREN,
|
||||
UNARY_OP,
|
||||
BINARY_OP,
|
||||
LITERAL,
|
||||
EXPR_END
|
||||
}
|
||||
|
||||
public TokenType type;
|
||||
public string value;
|
||||
|
||||
public Token(StringReader s)
|
||||
{
|
||||
int c = s.Read();
|
||||
if(c == -1)
|
||||
{
|
||||
type = TokenType.EXPR_END;
|
||||
value = "";
|
||||
return;
|
||||
}
|
||||
|
||||
char ch = (char)c;
|
||||
|
||||
//Special case: solve bug where !COND_FALSE_1 && COND_FALSE_2 would return True
|
||||
bool embeddedNot = (ch == '!' && s.Peek() != '(');
|
||||
|
||||
if(typesDict.ContainsKey(ch) && !embeddedNot)
|
||||
{
|
||||
type = typesDict[ch].Key;
|
||||
value = typesDict[ch].Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
string str = "";
|
||||
str += ch;
|
||||
while(s.Peek() != -1 && !typesDict.ContainsKey((char)s.Peek()))
|
||||
{
|
||||
str += (char)s.Read();
|
||||
}
|
||||
type = TokenType.LITERAL;
|
||||
value = str;
|
||||
}
|
||||
}
|
||||
|
||||
static public List<Token> TransformToPolishNotation(List<Token> infixTokenList)
|
||||
{
|
||||
Queue<Token> outputQueue = new Queue<Token>();
|
||||
Stack<Token> stack = new Stack<Token>();
|
||||
|
||||
int index = 0;
|
||||
while(infixTokenList.Count > index)
|
||||
{
|
||||
Token t = infixTokenList[index];
|
||||
|
||||
switch(t.type)
|
||||
{
|
||||
case Token.TokenType.LITERAL:
|
||||
outputQueue.Enqueue(t);
|
||||
break;
|
||||
case Token.TokenType.BINARY_OP:
|
||||
case Token.TokenType.UNARY_OP:
|
||||
case Token.TokenType.OPEN_PAREN:
|
||||
stack.Push(t);
|
||||
break;
|
||||
case Token.TokenType.CLOSE_PAREN:
|
||||
while(stack.Peek().type != Token.TokenType.OPEN_PAREN)
|
||||
{
|
||||
outputQueue.Enqueue(stack.Pop());
|
||||
}
|
||||
stack.Pop();
|
||||
if(stack.Count > 0 && stack.Peek().type == Token.TokenType.UNARY_OP)
|
||||
{
|
||||
outputQueue.Enqueue(stack.Pop());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
while(stack.Count > 0)
|
||||
{
|
||||
outputQueue.Enqueue(stack.Pop());
|
||||
}
|
||||
|
||||
var list = new List<Token>(outputQueue);
|
||||
list.Reverse();
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
// Boolean Expression Classes
|
||||
|
||||
public abstract class Expression
|
||||
{
|
||||
public abstract bool Evaluate();
|
||||
}
|
||||
|
||||
public class ExpressionLeaf : Expression
|
||||
{
|
||||
private string content;
|
||||
private EvaluateFunction evalFunction;
|
||||
|
||||
public ExpressionLeaf(EvaluateFunction _evalFunction, string _content)
|
||||
{
|
||||
this.evalFunction = _evalFunction;
|
||||
this.content = _content;
|
||||
}
|
||||
|
||||
override public bool Evaluate()
|
||||
{
|
||||
//embedded not, see special case in Token declaration
|
||||
if(content.StartsWith("!"))
|
||||
{
|
||||
return !this.evalFunction(content.Substring(1));
|
||||
}
|
||||
|
||||
return this.evalFunction(content);
|
||||
}
|
||||
}
|
||||
|
||||
public class ExpressionAnd : Expression
|
||||
{
|
||||
private Expression left;
|
||||
private Expression right;
|
||||
|
||||
public ExpressionAnd(Expression _left, Expression _right)
|
||||
{
|
||||
this.left = _left;
|
||||
this.right = _right;
|
||||
}
|
||||
|
||||
override public bool Evaluate()
|
||||
{
|
||||
return left.Evaluate() && right.Evaluate();
|
||||
}
|
||||
}
|
||||
|
||||
public class ExpressionOr : Expression
|
||||
{
|
||||
private Expression left;
|
||||
private Expression right;
|
||||
|
||||
public ExpressionOr(Expression _left, Expression _right)
|
||||
{
|
||||
this.left = _left;
|
||||
this.right = _right;
|
||||
}
|
||||
|
||||
override public bool Evaluate()
|
||||
{
|
||||
return left.Evaluate() || right.Evaluate();
|
||||
}
|
||||
}
|
||||
|
||||
public class ExpressionNot : Expression
|
||||
{
|
||||
private Expression expr;
|
||||
|
||||
public ExpressionNot(Expression _expr)
|
||||
{
|
||||
this.expr = _expr;
|
||||
}
|
||||
|
||||
override public bool Evaluate()
|
||||
{
|
||||
return !expr.Evaluate();
|
||||
}
|
||||
}
|
||||
|
||||
static public Expression MakeExpression(ref List<Token>.Enumerator polishNotationTokensEnumerator, EvaluateFunction _evalFunction)
|
||||
{
|
||||
if(polishNotationTokensEnumerator.Current.type == Token.TokenType.LITERAL)
|
||||
{
|
||||
Expression lit = new ExpressionLeaf(_evalFunction, polishNotationTokensEnumerator.Current.value);
|
||||
polishNotationTokensEnumerator.MoveNext();
|
||||
return lit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(polishNotationTokensEnumerator.Current.value == "NOT")
|
||||
{
|
||||
polishNotationTokensEnumerator.MoveNext();
|
||||
Expression operand = MakeExpression(ref polishNotationTokensEnumerator, _evalFunction);
|
||||
return new ExpressionNot(operand);
|
||||
}
|
||||
else if(polishNotationTokensEnumerator.Current.value == "AND")
|
||||
{
|
||||
polishNotationTokensEnumerator.MoveNext();
|
||||
Expression left = MakeExpression(ref polishNotationTokensEnumerator, _evalFunction);
|
||||
Expression right = MakeExpression(ref polishNotationTokensEnumerator, _evalFunction);
|
||||
return new ExpressionAnd(left, right);
|
||||
}
|
||||
else if(polishNotationTokensEnumerator.Current.value == "OR")
|
||||
{
|
||||
polishNotationTokensEnumerator.MoveNext();
|
||||
Expression left = MakeExpression(ref polishNotationTokensEnumerator, _evalFunction);
|
||||
Expression right = MakeExpression(ref polishNotationTokensEnumerator, _evalFunction);
|
||||
return new ExpressionOr(left, right);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce7d96d3a4d4f3b4681ab437a9710d60
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,592 @@
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
// Cartoon FX
|
||||
// (c) 2012-2020 Jean Moreno
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
// Custom material inspector for Stylized FX shaders
|
||||
// - organize UI using comments in the shader code
|
||||
// - more flexibility than the material property drawers
|
||||
// version 2 (dec 2017)
|
||||
|
||||
namespace CartoonFX
|
||||
{
|
||||
public class MaterialInspector : ShaderGUI
|
||||
{
|
||||
//Set by PropertyDrawers to defined if the next properties should be visible
|
||||
static private Stack<bool> ShowStack = new Stack<bool>();
|
||||
|
||||
static public bool ShowNextProperty { get; private set; }
|
||||
static public void PushShowProperty(bool value)
|
||||
{
|
||||
ShowStack.Push(ShowNextProperty);
|
||||
ShowNextProperty &= value;
|
||||
}
|
||||
static public void PopShowProperty()
|
||||
{
|
||||
ShowNextProperty = ShowStack.Pop();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
const string kGuiCommandPrefix = "//#";
|
||||
const string kGC_IfKeyword = "IF_KEYWORD";
|
||||
const string kGC_IfProperty = "IF_PROPERTY";
|
||||
const string kGC_EndIf = "END_IF";
|
||||
const string kGC_HelpBox = "HELP_BOX";
|
||||
const string kGC_Label = "LABEL";
|
||||
|
||||
Dictionary<int, List<GUICommand>> guiCommands = new Dictionary<int, List<GUICommand>>();
|
||||
|
||||
bool initialized = false;
|
||||
AssetImporter shaderImporter;
|
||||
ulong lastTimestamp;
|
||||
void Initialize(MaterialEditor editor, bool force)
|
||||
{
|
||||
if((!initialized || force) && editor != null)
|
||||
{
|
||||
initialized = true;
|
||||
|
||||
guiCommands.Clear();
|
||||
|
||||
//Find the shader and parse the source to find special comments that will organize the GUI
|
||||
//It's hackish, but at least it allows any character to be used (unlike material property drawers/decorators) and can be used along with property drawers
|
||||
|
||||
var materials = new List<Material>();
|
||||
foreach(var o in editor.targets)
|
||||
{
|
||||
var m = o as Material;
|
||||
if(m != null)
|
||||
materials.Add(m);
|
||||
}
|
||||
if(materials.Count > 0 && materials[0].shader != null)
|
||||
{
|
||||
var path = AssetDatabase.GetAssetPath(materials[0].shader);
|
||||
//get asset importer
|
||||
shaderImporter = AssetImporter.GetAtPath(path);
|
||||
if(shaderImporter != null)
|
||||
{
|
||||
lastTimestamp = shaderImporter.assetTimeStamp;
|
||||
}
|
||||
//remove 'Assets' and replace with OS path
|
||||
path = Application.dataPath + path.Substring(6);
|
||||
//convert to cross-platform path
|
||||
path = path.Replace('/', Path.DirectorySeparatorChar);
|
||||
//open file for reading
|
||||
var lines = File.ReadAllLines(path);
|
||||
|
||||
bool insideProperties = false;
|
||||
//regex pattern to find properties, as they need to be counted so that
|
||||
//special commands can be inserted at the right position when enumerating them
|
||||
var regex = new Regex(@"[a-zA-Z0-9_]+\s*\([^\)]*\)");
|
||||
int propertyCount = 0;
|
||||
bool insideCommentBlock = false;
|
||||
foreach(var l in lines)
|
||||
{
|
||||
var line = l.TrimStart();
|
||||
|
||||
if(insideProperties)
|
||||
{
|
||||
bool isComment = line.StartsWith("//");
|
||||
|
||||
if(line.Contains("/*"))
|
||||
insideCommentBlock = true;
|
||||
if(line.Contains("*/"))
|
||||
insideCommentBlock = false;
|
||||
|
||||
//finished properties block?
|
||||
if(line.StartsWith("}"))
|
||||
break;
|
||||
|
||||
//comment
|
||||
if(line.StartsWith(kGuiCommandPrefix))
|
||||
{
|
||||
string command = line.Substring(kGuiCommandPrefix.Length).TrimStart();
|
||||
//space
|
||||
if(string.IsNullOrEmpty(command))
|
||||
AddGUICommand(propertyCount, new GC_Space());
|
||||
//separator
|
||||
else if(command.StartsWith("---"))
|
||||
AddGUICommand(propertyCount, new GC_Separator());
|
||||
//separator
|
||||
else if(command.StartsWith("==="))
|
||||
AddGUICommand(propertyCount, new GC_SeparatorDouble());
|
||||
//if keyword
|
||||
else if(command.StartsWith(kGC_IfKeyword))
|
||||
{
|
||||
var expr = command.Substring(command.LastIndexOf(kGC_IfKeyword) + kGC_IfKeyword.Length + 1);
|
||||
AddGUICommand(propertyCount, new GC_IfKeyword() { expression = expr, materials = materials.ToArray() });
|
||||
}
|
||||
//if property
|
||||
else if(command.StartsWith(kGC_IfProperty))
|
||||
{
|
||||
var expr = command.Substring(command.LastIndexOf(kGC_IfProperty) + kGC_IfProperty.Length + 1);
|
||||
AddGUICommand(propertyCount, new GC_IfProperty() { expression = expr, materials = materials.ToArray() });
|
||||
}
|
||||
//end if
|
||||
else if(command.StartsWith(kGC_EndIf))
|
||||
{
|
||||
AddGUICommand(propertyCount, new GC_EndIf());
|
||||
}
|
||||
//help box
|
||||
else if(command.StartsWith(kGC_HelpBox))
|
||||
{
|
||||
var messageType = MessageType.Error;
|
||||
var message = "Invalid format for HELP_BOX:\n" + command;
|
||||
var cmd = command.Substring(command.LastIndexOf(kGC_HelpBox) + kGC_HelpBox.Length + 1).Split(new string[] { "::" }, System.StringSplitOptions.RemoveEmptyEntries);
|
||||
if(cmd.Length == 1)
|
||||
{
|
||||
message = cmd[0];
|
||||
messageType = MessageType.None;
|
||||
}
|
||||
else if(cmd.Length == 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgType = (MessageType)System.Enum.Parse(typeof(MessageType), cmd[0], true);
|
||||
message = cmd[1].Replace(" ", "\n");
|
||||
messageType = msgType;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
AddGUICommand(propertyCount, new GC_HelpBox()
|
||||
{
|
||||
message = message,
|
||||
messageType = messageType
|
||||
});
|
||||
}
|
||||
//label
|
||||
else if(command.StartsWith(kGC_Label))
|
||||
{
|
||||
var label = command.Substring(command.LastIndexOf(kGC_Label) + kGC_Label.Length + 1);
|
||||
AddGUICommand(propertyCount, new GC_Label() { label = label });
|
||||
}
|
||||
//header: plain text after command
|
||||
else
|
||||
{
|
||||
AddGUICommand(propertyCount, new GC_Header() { label = command });
|
||||
}
|
||||
}
|
||||
else
|
||||
//property
|
||||
{
|
||||
if(regex.IsMatch(line) && !insideCommentBlock && !isComment)
|
||||
propertyCount++;
|
||||
}
|
||||
}
|
||||
|
||||
//start properties block?
|
||||
if(line.StartsWith("Properties"))
|
||||
{
|
||||
insideProperties = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddGUICommand(int propertyIndex, GUICommand command)
|
||||
{
|
||||
if(!guiCommands.ContainsKey(propertyIndex))
|
||||
guiCommands.Add(propertyIndex, new List<GUICommand>());
|
||||
|
||||
guiCommands[propertyIndex].Add(command);
|
||||
}
|
||||
|
||||
public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
|
||||
{
|
||||
initialized = false;
|
||||
base.AssignNewShaderToMaterial(material, oldShader, newShader);
|
||||
}
|
||||
|
||||
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
|
||||
{
|
||||
//init:
|
||||
//- read metadata in properties comment to generate ui layout
|
||||
//- force update if timestamp doesn't match last (= file externally updated)
|
||||
bool force = (shaderImporter != null && shaderImporter.assetTimeStamp != lastTimestamp);
|
||||
Initialize(materialEditor, force);
|
||||
|
||||
var shader = (materialEditor.target as Material).shader;
|
||||
materialEditor.SetDefaultGUIWidths();
|
||||
|
||||
//show all properties by default
|
||||
ShowNextProperty = true;
|
||||
ShowStack.Clear();
|
||||
|
||||
for(int i = 0; i < properties.Length; i++)
|
||||
{
|
||||
if(guiCommands.ContainsKey(i))
|
||||
{
|
||||
for(int j = 0; j < guiCommands[i].Count; j++)
|
||||
{
|
||||
guiCommands[i][j].OnGUI();
|
||||
}
|
||||
}
|
||||
|
||||
//Use custom properties to enable/disable groups based on keywords
|
||||
if(ShowNextProperty)
|
||||
{
|
||||
if((properties[i].flags & (MaterialProperty.PropFlags.HideInInspector | MaterialProperty.PropFlags.PerRendererData)) == MaterialProperty.PropFlags.None)
|
||||
{
|
||||
DisplayProperty(properties[i], materialEditor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//make sure to show gui commands that are after properties
|
||||
int index = properties.Length;
|
||||
if(guiCommands.ContainsKey(index))
|
||||
{
|
||||
for(int j = 0; j < guiCommands[index].Count; j++)
|
||||
{
|
||||
guiCommands[index][j].OnGUI();
|
||||
}
|
||||
}
|
||||
|
||||
//Special fields
|
||||
Styles.MaterialDrawSeparatorDouble();
|
||||
materialEditor.RenderQueueField();
|
||||
materialEditor.EnableInstancingField();
|
||||
}
|
||||
|
||||
virtual protected void DisplayProperty(MaterialProperty property, MaterialEditor materialEditor)
|
||||
{
|
||||
float propertyHeight = materialEditor.GetPropertyHeight(property, property.displayName);
|
||||
Rect controlRect = EditorGUILayout.GetControlRect(true, propertyHeight, EditorStyles.layerMaskField, new GUILayoutOption[0]);
|
||||
materialEditor.ShaderProperty(controlRect, property, property.displayName);
|
||||
}
|
||||
}
|
||||
|
||||
// Same as Toggle drawer, but doesn't set any keyword
|
||||
// This will avoid adding unnecessary shader keyword to the project
|
||||
internal class MaterialToggleNoKeywordDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
private static bool IsPropertyTypeSuitable(MaterialProperty prop)
|
||||
{
|
||||
return prop.type == MaterialProperty.PropType.Float || prop.type == MaterialProperty.PropType.Range;
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
float height;
|
||||
if (!MaterialToggleNoKeywordDrawer.IsPropertyTypeSuitable(prop))
|
||||
{
|
||||
height = 40f;
|
||||
}
|
||||
else
|
||||
{
|
||||
height = base.GetPropertyHeight(prop, label, editor);
|
||||
}
|
||||
return height;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor)
|
||||
{
|
||||
if (!MaterialToggleNoKeywordDrawer.IsPropertyTypeSuitable(prop))
|
||||
{
|
||||
EditorGUI.HelpBox(position, "Toggle used on a non-float property: " + prop.name, MessageType.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
bool flag = Mathf.Abs(prop.floatValue) > 0.001f;
|
||||
EditorGUI.showMixedValue = prop.hasMixedValue;
|
||||
flag = EditorGUI.Toggle(position, label, flag);
|
||||
EditorGUI.showMixedValue = false;
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
prop.floatValue = ((!flag) ? 0f : 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Same as KeywordEnum drawer, but uses the keyword supplied as is rather than adding a prefix to them
|
||||
internal class MaterialKeywordEnumNoPrefixDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
private readonly GUIContent[] labels;
|
||||
private readonly string[] keywords;
|
||||
|
||||
public MaterialKeywordEnumNoPrefixDrawer(string lbl1, string kw1) : this(new[] { lbl1 }, new[] { kw1 }) { }
|
||||
public MaterialKeywordEnumNoPrefixDrawer(string lbl1, string kw1, string lbl2, string kw2) : this(new[] { lbl1, lbl2 }, new[] { kw1, kw2 }) { }
|
||||
public MaterialKeywordEnumNoPrefixDrawer(string lbl1, string kw1, string lbl2, string kw2, string lbl3, string kw3) : this(new[] { lbl1, lbl2, lbl3 }, new[] { kw1, kw2, kw3 }) { }
|
||||
public MaterialKeywordEnumNoPrefixDrawer(string lbl1, string kw1, string lbl2, string kw2, string lbl3, string kw3, string lbl4, string kw4) : this(new[] { lbl1, lbl2, lbl3, lbl4 }, new[] { kw1, kw2, kw3, kw4 }) { }
|
||||
public MaterialKeywordEnumNoPrefixDrawer(string lbl1, string kw1, string lbl2, string kw2, string lbl3, string kw3, string lbl4, string kw4, string lbl5, string kw5) : this(new[] { lbl1, lbl2, lbl3, lbl4, lbl5 }, new[] { kw1, kw2, kw3, kw4, kw5 }) { }
|
||||
public MaterialKeywordEnumNoPrefixDrawer(string lbl1, string kw1, string lbl2, string kw2, string lbl3, string kw3, string lbl4, string kw4, string lbl5, string kw5, string lbl6, string kw6) : this(new[] { lbl1, lbl2, lbl3, lbl4, lbl5, lbl6 }, new[] { kw1, kw2, kw3, kw4, kw5, kw6 }) { }
|
||||
|
||||
public MaterialKeywordEnumNoPrefixDrawer(string[] labels, string[] keywords)
|
||||
{
|
||||
this.labels= new GUIContent[keywords.Length];
|
||||
this.keywords = new string[keywords.Length];
|
||||
for (int i = 0; i < keywords.Length; ++i)
|
||||
{
|
||||
this.labels[i] = new GUIContent(labels[i]);
|
||||
this.keywords[i] = keywords[i];
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsPropertyTypeSuitable(MaterialProperty prop)
|
||||
{
|
||||
return prop.type == MaterialProperty.PropType.Float || prop.type == MaterialProperty.PropType.Range;
|
||||
}
|
||||
|
||||
void SetKeyword(MaterialProperty prop, int index)
|
||||
{
|
||||
for (int i = 0; i < keywords.Length; ++i)
|
||||
{
|
||||
string keyword = GetKeywordName(prop.name, keywords[i]);
|
||||
foreach (Material material in prop.targets)
|
||||
{
|
||||
if (index == i)
|
||||
material.EnableKeyword(keyword);
|
||||
else
|
||||
material.DisableKeyword(keyword);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
if (!IsPropertyTypeSuitable(prop))
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight * 2.5f;
|
||||
}
|
||||
return base.GetPropertyHeight(prop, label, editor);
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor)
|
||||
{
|
||||
if (!IsPropertyTypeSuitable(prop))
|
||||
{
|
||||
EditorGUI.HelpBox(position, "Toggle used on a non-float property: " + prop.name, MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorGUI.showMixedValue = prop.hasMixedValue;
|
||||
var value = (int)prop.floatValue;
|
||||
value = EditorGUI.Popup(position, label, value, labels);
|
||||
EditorGUI.showMixedValue = false;
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
prop.floatValue = value;
|
||||
SetKeyword(prop, value);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Apply(MaterialProperty prop)
|
||||
{
|
||||
base.Apply(prop);
|
||||
if (!IsPropertyTypeSuitable(prop))
|
||||
return;
|
||||
|
||||
if (prop.hasMixedValue)
|
||||
return;
|
||||
|
||||
SetKeyword(prop, (int)prop.floatValue);
|
||||
}
|
||||
|
||||
// Final keyword name: property name + "_" + display name. Uppercased,
|
||||
// and spaces replaced with underscores.
|
||||
private static string GetKeywordName(string propName, string name)
|
||||
{
|
||||
// Just return the supplied name
|
||||
return name;
|
||||
|
||||
// Original code:
|
||||
/*
|
||||
string n = propName + "_" + name;
|
||||
return n.Replace(' ', '_').ToUpperInvariant();
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//================================================================================================================================================================================================
|
||||
// GUI Commands System
|
||||
//
|
||||
// Workaround to Material Property Drawers limitations:
|
||||
// - uses shader comments to organize the GUI, and show/hide properties based on conditions
|
||||
// - can use any character (unlike property drawers)
|
||||
// - parsed once at material editor initialization
|
||||
|
||||
internal class GUICommand
|
||||
{
|
||||
public virtual bool Visible() { return true; }
|
||||
public virtual void OnGUI() { }
|
||||
}
|
||||
|
||||
internal class GC_Separator : GUICommand { public override void OnGUI() { if(MaterialInspector.ShowNextProperty) Styles.MaterialDrawSeparator(); } }
|
||||
internal class GC_SeparatorDouble : GUICommand { public override void OnGUI() { if(MaterialInspector.ShowNextProperty) Styles.MaterialDrawSeparatorDouble(); } }
|
||||
internal class GC_Space : GUICommand { public override void OnGUI() { if(MaterialInspector.ShowNextProperty) GUILayout.Space(8); } }
|
||||
internal class GC_HelpBox : GUICommand
|
||||
{
|
||||
public string message { get; set; }
|
||||
public MessageType messageType { get; set; }
|
||||
|
||||
public override void OnGUI()
|
||||
{
|
||||
if(MaterialInspector.ShowNextProperty)
|
||||
Styles.HelpBoxRichText(message, messageType);
|
||||
}
|
||||
}
|
||||
internal class GC_Header : GUICommand
|
||||
{
|
||||
public string label { get; set; }
|
||||
GUIContent guiContent;
|
||||
|
||||
public override void OnGUI()
|
||||
{
|
||||
if(guiContent == null)
|
||||
guiContent = new GUIContent(label);
|
||||
|
||||
if(MaterialInspector.ShowNextProperty)
|
||||
Styles.MaterialDrawHeader(guiContent);
|
||||
}
|
||||
}
|
||||
internal class GC_Label : GUICommand
|
||||
{
|
||||
public string label { get; set; }
|
||||
GUIContent guiContent;
|
||||
|
||||
public override void OnGUI()
|
||||
{
|
||||
if(guiContent == null)
|
||||
guiContent = new GUIContent(label);
|
||||
|
||||
if(MaterialInspector.ShowNextProperty)
|
||||
GUILayout.Label(guiContent);
|
||||
}
|
||||
}
|
||||
internal class GC_IfKeyword : GUICommand
|
||||
{
|
||||
public string expression { get; set; }
|
||||
public Material[] materials { get; set; }
|
||||
public override void OnGUI()
|
||||
{
|
||||
bool show = ExpressionParser.EvaluateExpression(expression, (string s) =>
|
||||
{
|
||||
foreach(var m in materials)
|
||||
{
|
||||
if(m.IsKeywordEnabled(s))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
MaterialInspector.PushShowProperty(show);
|
||||
}
|
||||
}
|
||||
internal class GC_EndIf : GUICommand { public override void OnGUI() { MaterialInspector.PopShowProperty(); } }
|
||||
|
||||
internal class GC_IfProperty : GUICommand
|
||||
{
|
||||
string _expression;
|
||||
public string expression
|
||||
{
|
||||
get { return _expression; }
|
||||
set { _expression = value.Replace("!=", "<>"); }
|
||||
}
|
||||
public Material[] materials { get; set; }
|
||||
|
||||
public override void OnGUI()
|
||||
{
|
||||
bool show = ExpressionParser.EvaluateExpression(expression, EvaluatePropertyExpression);
|
||||
MaterialInspector.PushShowProperty(show);
|
||||
}
|
||||
|
||||
bool EvaluatePropertyExpression(string expr)
|
||||
{
|
||||
//expression is expected to be in the form of: property operator value
|
||||
var reader = new StringReader(expr);
|
||||
string property = "";
|
||||
string op = "";
|
||||
float value = 0f;
|
||||
|
||||
int overflow = 0;
|
||||
while(true)
|
||||
{
|
||||
char c = (char)reader.Read();
|
||||
|
||||
//operator
|
||||
if(c == '=' || c == '>' || c == '<' || c == '!')
|
||||
{
|
||||
op += c;
|
||||
//second operator character, if any
|
||||
char c2 = (char)reader.Peek();
|
||||
if(c2 == '=' || c2 == '>')
|
||||
{
|
||||
reader.Read();
|
||||
op += c2;
|
||||
}
|
||||
|
||||
//end of string is the value
|
||||
var end = reader.ReadToEnd();
|
||||
if(!float.TryParse(end, out value))
|
||||
{
|
||||
Debug.LogError("Couldn't parse float from property expression:\n" + end);
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
//property name
|
||||
property += c;
|
||||
|
||||
overflow++;
|
||||
if(overflow >= 9999)
|
||||
{
|
||||
Debug.LogError("Expression parsing overflow!\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//evaluate property
|
||||
bool conditionMet = false;
|
||||
foreach(var m in materials)
|
||||
{
|
||||
float propValue = 0f;
|
||||
if(property.Contains(".x") || property.Contains(".y") || property.Contains(".z") || property.Contains(".w"))
|
||||
{
|
||||
string[] split = property.Split('.');
|
||||
string component = split[1];
|
||||
switch(component)
|
||||
{
|
||||
case "x": propValue = m.GetVector(split[0]).x; break;
|
||||
case "y": propValue = m.GetVector(split[0]).y; break;
|
||||
case "z": propValue = m.GetVector(split[0]).z; break;
|
||||
case "w": propValue = m.GetVector(split[0]).w; break;
|
||||
default: Debug.LogError("Invalid component for vector property: '" + property + "'"); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
propValue = m.GetFloat(property);
|
||||
|
||||
switch(op)
|
||||
{
|
||||
case ">=": conditionMet = propValue >= value; break;
|
||||
case "<=": conditionMet = propValue <= value; break;
|
||||
case ">": conditionMet = propValue > value; break;
|
||||
case "<": conditionMet = propValue < value; break;
|
||||
case "<>": conditionMet = propValue != value; break; //not equal, "!=" is replaced by "<>" to prevent bug with leading ! ("not" operator)
|
||||
case "==": conditionMet = propValue == value; break;
|
||||
default:
|
||||
Debug.LogError("Invalid property expression:\n" + expr);
|
||||
break;
|
||||
}
|
||||
if(conditionMet)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4fb4c15e772a1cc4baecc7a958bf9cc7
|
||||
timeCreated: 1486392341
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,423 @@
|
||||
// #define SHOW_EXPORT_BUTTON
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Rendering;
|
||||
using UnityEngine;
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
using UnityEditor.AssetImporters;
|
||||
#else
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
#endif
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace CartoonFX
|
||||
{
|
||||
namespace CustomShaderImporter
|
||||
{
|
||||
static class Utils
|
||||
{
|
||||
public static bool IsUsingURP()
|
||||
{
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
var renderPipeline = GraphicsSettings.currentRenderPipeline;
|
||||
#else
|
||||
var renderPipeline = GraphicsSettings.renderPipelineAsset;
|
||||
#endif
|
||||
return renderPipeline != null && renderPipeline.GetType().Name.Contains("Universal");
|
||||
}
|
||||
}
|
||||
|
||||
[ScriptedImporter(0, FILE_EXTENSION)]
|
||||
public class CFXR_ShaderImporter : ScriptedImporter
|
||||
{
|
||||
public enum RenderPipeline
|
||||
{
|
||||
Auto,
|
||||
ForceBuiltInRenderPipeline,
|
||||
ForceUniversalRenderPipeline
|
||||
}
|
||||
|
||||
public const string FILE_EXTENSION = "cfxrshader";
|
||||
|
||||
[Tooltip("In case of errors when building the project or with addressables, you can try forcing a specific render pipeline")]
|
||||
public RenderPipeline renderPipelineDetection = RenderPipeline.Auto;
|
||||
public string detectedRenderPipeline = "Built-In Render Pipeline";
|
||||
public int strippedLinesCount = 0;
|
||||
public string shaderSourceCode;
|
||||
public string shaderName;
|
||||
public string[] shaderErrors;
|
||||
public ulong variantCount;
|
||||
public ulong variantCountUsed;
|
||||
|
||||
enum ComparisonOperator
|
||||
{
|
||||
Equal,
|
||||
Greater,
|
||||
GreaterOrEqual,
|
||||
Less,
|
||||
LessOrEqual
|
||||
}
|
||||
|
||||
#if UNITY_2022_2_OR_NEWER
|
||||
const int URP_VERSION = 14;
|
||||
#elif UNITY_2021_2_OR_NEWER
|
||||
const int URP_VERSION = 12;
|
||||
#elif UNITY_2021_1_OR_NEWER
|
||||
const int URP_VERSION = 11;
|
||||
#elif UNITY_2020_3_OR_NEWER
|
||||
const int URP_VERSION = 10;
|
||||
#else
|
||||
const int URP_VERSION = 7;
|
||||
#endif
|
||||
|
||||
static ComparisonOperator ParseComparisonOperator(string symbols)
|
||||
{
|
||||
switch (symbols)
|
||||
{
|
||||
case "==": return ComparisonOperator.Equal;
|
||||
case "<=": return ComparisonOperator.LessOrEqual;
|
||||
case "<": return ComparisonOperator.Less;
|
||||
case ">": return ComparisonOperator.Greater;
|
||||
case ">=": return ComparisonOperator.GreaterOrEqual;
|
||||
default: throw new Exception("Invalid comparison operator: " + symbols);
|
||||
}
|
||||
}
|
||||
|
||||
static bool CompareWithOperator(int value1, int value2, ComparisonOperator comparisonOperator)
|
||||
{
|
||||
switch (comparisonOperator)
|
||||
{
|
||||
case ComparisonOperator.Equal: return value1 == value2;
|
||||
case ComparisonOperator.Greater: return value1 > value2;
|
||||
case ComparisonOperator.GreaterOrEqual: return value1 >= value2;
|
||||
case ComparisonOperator.Less: return value1 < value2;
|
||||
case ComparisonOperator.LessOrEqual: return value1 <= value2;
|
||||
default: throw new Exception("Invalid comparison operator value: " + comparisonOperator);
|
||||
}
|
||||
}
|
||||
|
||||
bool StartsOrEndWithSpecialTag(string line)
|
||||
{
|
||||
bool startsWithTag = (line.Length > 4 && line[0] == '/' && line[1] == '*' && line[2] == '*' && line[3] == '*');
|
||||
if (startsWithTag) return true;
|
||||
|
||||
int l = line.Length-1;
|
||||
bool endsWithTag = (line.Length > 4 && line[l] == '/' && line[l-1] == '*' && line[l-2] == '*' && line[l-3] == '*');
|
||||
return endsWithTag;
|
||||
}
|
||||
|
||||
public override void OnImportAsset(AssetImportContext context)
|
||||
{
|
||||
bool isUsingURP;
|
||||
switch (renderPipelineDetection)
|
||||
{
|
||||
default:
|
||||
case RenderPipeline.Auto:
|
||||
{
|
||||
isUsingURP = Utils.IsUsingURP();
|
||||
detectedRenderPipeline = isUsingURP ? "Universal Render Pipeline" : "Built-In Render Pipeline";
|
||||
break;
|
||||
}
|
||||
case RenderPipeline.ForceBuiltInRenderPipeline:
|
||||
{
|
||||
detectedRenderPipeline = "Built-In Render Pipeline";
|
||||
isUsingURP = false;
|
||||
break;
|
||||
}
|
||||
case RenderPipeline.ForceUniversalRenderPipeline:
|
||||
{
|
||||
detectedRenderPipeline = "Universal Render Pipeline";
|
||||
isUsingURP = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
StringWriter shaderSource = new StringWriter();
|
||||
string[] sourceLines = File.ReadAllLines(context.assetPath);
|
||||
Stack<bool> excludeCurrentLines = new Stack<bool>();
|
||||
strippedLinesCount = 0;
|
||||
|
||||
for (int i = 0; i < sourceLines.Length; i++)
|
||||
{
|
||||
bool excludeThisLine = excludeCurrentLines.Count > 0 && excludeCurrentLines.Peek();
|
||||
|
||||
string line = sourceLines[i];
|
||||
if (StartsOrEndWithSpecialTag(line))
|
||||
{
|
||||
if (line.StartsWith("/*** BIRP ***/"))
|
||||
{
|
||||
excludeCurrentLines.Push(excludeThisLine || isUsingURP);
|
||||
}
|
||||
else if (line.StartsWith("/*** URP ***/"))
|
||||
{
|
||||
excludeCurrentLines.Push(excludeThisLine || !isUsingURP);
|
||||
}
|
||||
else if (line.StartsWith("/*** URP_VERSION "))
|
||||
{
|
||||
string subline = line.Substring("/*** URP_VERSION ".Length);
|
||||
int spaceIndex = subline.IndexOf(' ');
|
||||
string version = subline.Substring(spaceIndex, subline.LastIndexOf(' ') - spaceIndex);
|
||||
string op = subline.Substring(0, spaceIndex);
|
||||
|
||||
var compOp = ParseComparisonOperator(op);
|
||||
int compVersion = int.Parse(version);
|
||||
|
||||
bool isCorrectURP = CompareWithOperator(URP_VERSION, compVersion, compOp);
|
||||
excludeCurrentLines.Push(excludeThisLine || !isCorrectURP);
|
||||
}
|
||||
else if (excludeThisLine && line.StartsWith("/*** END"))
|
||||
{
|
||||
excludeCurrentLines.Pop();
|
||||
}
|
||||
else if (!excludeThisLine && line.StartsWith("/*** #define URP_VERSION ***/"))
|
||||
{
|
||||
shaderSource.WriteLine("\t\t\t#define URP_VERSION " + URP_VERSION);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (excludeThisLine)
|
||||
{
|
||||
strippedLinesCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
shaderSource.WriteLine(line);
|
||||
}
|
||||
}
|
||||
|
||||
// Get source code and extract name
|
||||
shaderSourceCode = shaderSource.ToString();
|
||||
int idx = shaderSourceCode.IndexOf("Shader \"", StringComparison.InvariantCulture) + 8;
|
||||
int idx2 = shaderSourceCode.IndexOf('"', idx);
|
||||
shaderName = shaderSourceCode.Substring(idx, idx2 - idx);
|
||||
shaderErrors = null;
|
||||
|
||||
Shader shader = ShaderUtil.CreateShaderAsset(context, shaderSourceCode, true);
|
||||
|
||||
if (ShaderUtil.ShaderHasError(shader))
|
||||
{
|
||||
string[] shaderSourceLines = shaderSourceCode.Split(new [] {'\n'}, StringSplitOptions.None);
|
||||
var errors = ShaderUtil.GetShaderMessages(shader);
|
||||
shaderErrors = Array.ConvertAll(errors, err => $"{err.message} (line {err.line})");
|
||||
foreach (ShaderMessage error in errors)
|
||||
{
|
||||
string message = error.line <= 0 ?
|
||||
string.Format("Shader Error in '{0}' (in file '{2}')\nError: {1}\n", shaderName, error.message, error.file) :
|
||||
string.Format("Shader Error in '{0}' (line {2} in file '{3}')\nError: {1}\nLine: {4}\n", shaderName, error.message, error.line, error.file, shaderSourceLines[error.line-1]);
|
||||
if (error.severity == ShaderCompilerMessageSeverity.Warning)
|
||||
{
|
||||
Debug.LogWarning(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShaderUtil.ClearShaderMessages(shader);
|
||||
}
|
||||
|
||||
context.AddObjectToAsset("MainAsset", shader);
|
||||
context.SetMainObject(shader);
|
||||
|
||||
// Try to count variant using reflection:
|
||||
// internal static extern ulong GetVariantCount(Shader s, bool usedBySceneOnly);
|
||||
variantCount = 0;
|
||||
variantCountUsed = 0;
|
||||
MethodInfo getVariantCountReflection = typeof(ShaderUtil).GetMethod("GetVariantCount", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
if (getVariantCountReflection != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
object result = getVariantCountReflection.Invoke(null, new object[] {shader, false});
|
||||
variantCount = (ulong)result;
|
||||
result = getVariantCountReflection.Invoke(null, new object[] {shader, true});
|
||||
variantCountUsed = (ulong)result;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Inspector
|
||||
{
|
||||
[CustomEditor(typeof(CFXR_ShaderImporter)), CanEditMultipleObjects]
|
||||
public class TCP2ShaderImporter_Editor : Editor
|
||||
{
|
||||
CFXR_ShaderImporter Importer => (CFXR_ShaderImporter) this.target;
|
||||
|
||||
// From: UnityEditor.ShaderInspectorPlatformsPopup
|
||||
static string FormatCount(ulong count)
|
||||
{
|
||||
bool flag = count > 1000000000uL;
|
||||
string result;
|
||||
if (flag)
|
||||
{
|
||||
result = (count / 1000000000.0).ToString("f2", CultureInfo.InvariantCulture.NumberFormat) + "B";
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag2 = count > 1000000uL;
|
||||
if (flag2)
|
||||
{
|
||||
result = (count / 1000000.0).ToString("f2", CultureInfo.InvariantCulture.NumberFormat) + "M";
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag3 = count > 1000uL;
|
||||
if (flag3)
|
||||
{
|
||||
result = (count / 1000.0).ToString("f2", CultureInfo.InvariantCulture.NumberFormat) + "k";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = count.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static GUIStyle _HelpBoxRichTextStyle;
|
||||
static GUIStyle HelpBoxRichTextStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_HelpBoxRichTextStyle == null)
|
||||
{
|
||||
_HelpBoxRichTextStyle = new GUIStyle("HelpBox");
|
||||
_HelpBoxRichTextStyle.richText = true;
|
||||
_HelpBoxRichTextStyle.margin = new RectOffset(4, 4, 0, 0);
|
||||
_HelpBoxRichTextStyle.padding = new RectOffset(4, 4, 4, 4);
|
||||
}
|
||||
return _HelpBoxRichTextStyle;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
bool multipleValues = serializedObject.isEditingMultipleObjects;
|
||||
|
||||
CFXR_ShaderImporter.RenderPipeline detection = ((CFXR_ShaderImporter)target).renderPipelineDetection;
|
||||
bool isUsingURP = Utils.IsUsingURP();
|
||||
serializedObject.Update();
|
||||
|
||||
GUILayout.Label(Importer.shaderName);
|
||||
string variantsText = "";
|
||||
if (Importer.variantCount > 0 && Importer.variantCountUsed > 0)
|
||||
{
|
||||
string variantsCount = multipleValues ? "-" : FormatCount(Importer.variantCount);
|
||||
string variantsCountUsed = multipleValues ? "-" : FormatCount(Importer.variantCountUsed);
|
||||
variantsText = $"\nVariants (currently used): <b>{variantsCountUsed}</b>\nVariants (including unused): <b>{variantsCount}</b>";
|
||||
}
|
||||
string strippedLinesCount = multipleValues ? "-" : Importer.strippedLinesCount.ToString();
|
||||
string renderPipeline = Importer.detectedRenderPipeline;
|
||||
if (targets is { Length: > 1 })
|
||||
{
|
||||
foreach (CFXR_ShaderImporter importer in targets)
|
||||
{
|
||||
if (importer.detectedRenderPipeline != renderPipeline)
|
||||
{
|
||||
renderPipeline = "-";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
GUILayout.Label($"{(detection == CFXR_ShaderImporter.RenderPipeline.Auto ? "Detected" : "Forced")} render pipeline: <b>{renderPipeline}</b>\nStripped lines: <b>{strippedLinesCount}</b>{variantsText}", HelpBoxRichTextStyle);
|
||||
|
||||
if (Importer.shaderErrors != null && Importer.shaderErrors.Length > 0)
|
||||
{
|
||||
GUILayout.Space(4);
|
||||
var color = GUI.color;
|
||||
GUI.color = new Color32(0xFF, 0x80, 0x80, 0xFF);
|
||||
GUILayout.Label($"<b>Errors:</b>\n{string.Join("\n", Importer.shaderErrors)}", HelpBoxRichTextStyle);
|
||||
GUI.color = color;
|
||||
}
|
||||
|
||||
bool shouldReimportShader = false;
|
||||
bool compiledForURP = Importer.detectedRenderPipeline.Contains("Universal");
|
||||
if (detection == CFXR_ShaderImporter.RenderPipeline.Auto
|
||||
&& ((isUsingURP && !compiledForURP) || (!isUsingURP && compiledForURP)))
|
||||
{
|
||||
GUILayout.Space(4);
|
||||
Color guiColor = GUI.color;
|
||||
GUI.color *= Color.yellow;
|
||||
EditorGUILayout.HelpBox("The detected render pipeline doesn't match the pipeline this shader was compiled for!\nPlease reimport the shaders for them to work in the current render pipeline.", MessageType.Warning);
|
||||
if (GUILayout.Button("Reimport Shader"))
|
||||
{
|
||||
shouldReimportShader = true;
|
||||
}
|
||||
GUI.color = guiColor;
|
||||
}
|
||||
|
||||
GUILayout.Space(4);
|
||||
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(CFXR_ShaderImporter.renderPipelineDetection)));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
shouldReimportShader = true;
|
||||
}
|
||||
|
||||
if (GUILayout.Button("View Source", GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
string path = Application.temporaryCachePath + "/" + Importer.shaderName.Replace("/", "-") + "_Source.shader";
|
||||
if (File.Exists(path))
|
||||
{
|
||||
File.SetAttributes(path, FileAttributes.Normal);
|
||||
}
|
||||
|
||||
File.WriteAllText(path, Importer.shaderSourceCode);
|
||||
File.SetAttributes(path, FileAttributes.ReadOnly);
|
||||
UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(path, 0);
|
||||
}
|
||||
|
||||
#if SHOW_EXPORT_BUTTON
|
||||
GUILayout.Space(8);
|
||||
|
||||
EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(importer.shaderSourceCode));
|
||||
{
|
||||
if (GUILayout.Button("Export .shader file", GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
string savePath = EditorUtility.SaveFilePanel("Export CFXR shader", Application.dataPath, "CFXR Shader","shader");
|
||||
if (!string.IsNullOrEmpty(savePath))
|
||||
{
|
||||
File.WriteAllText(savePath, importer.shaderSourceCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
#endif
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (shouldReimportShader)
|
||||
{
|
||||
ReimportShader();
|
||||
}
|
||||
}
|
||||
|
||||
void ReimportShader()
|
||||
{
|
||||
foreach (UnityEngine.Object t in targets)
|
||||
{
|
||||
string path = AssetDatabase.GetAssetPath(t);
|
||||
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceSynchronousImport);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe56ec25963759b49955809beeb4324b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace CartoonFX
|
||||
{
|
||||
namespace CustomShaderImporter
|
||||
{
|
||||
public class CFXR_ShaderPostProcessor : AssetPostprocessor
|
||||
{
|
||||
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
|
||||
{
|
||||
CleanCFXRShaders(importedAssets);
|
||||
}
|
||||
|
||||
static void CleanCFXRShaders(string[] paths)
|
||||
{
|
||||
foreach (var assetPath in paths)
|
||||
{
|
||||
if (!assetPath.EndsWith(CFXR_ShaderImporter.FILE_EXTENSION, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var shader = AssetDatabase.LoadMainAssetAtPath(assetPath) as Shader;
|
||||
if (shader != null)
|
||||
{
|
||||
ShaderUtil.ClearShaderMessages(shader);
|
||||
if (!ShaderUtil.ShaderHasError(shader))
|
||||
{
|
||||
ShaderUtil.RegisterShader(shader);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29d46695388f9a84d9ae71b5140727a3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26306333afc273640814fd7a7b3968e0
|
||||
timeCreated: 1501149213
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8406aaacddc00584da67f20f62c179bd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,113 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: cfxr aura runic hdr ab nosp
|
||||
m_Shader: {fileID: -6465566751694194690, guid: 1a29b4d27eb8b04479ef89c00dea533d,
|
||||
type: 3}
|
||||
m_ValidKeywords:
|
||||
- _ALPHABLEND_ON
|
||||
- _CFXR_HDR_BOOST
|
||||
- _CFXR_SINGLE_CHANNEL
|
||||
m_InvalidKeywords:
|
||||
- _
|
||||
- _CFXR_DITHERED_SHADOWS_OFF
|
||||
- _CFXR_OVERLAYBLEND_RGBA
|
||||
- _CFXR_OVERLAYTEX_OFF
|
||||
m_LightmapFlags: 0
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DissolveTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DistortTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DitherCustom:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: ccb58def4933d4e46b7a1fc023bf6259, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OverlayTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SecondColorTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BacklightTransmittance: 1
|
||||
- _BlendingType: 0
|
||||
- _BumpScale: 1
|
||||
- _CFXR_DITHERED_SHADOWS: 0
|
||||
- _CFXR_OVERLAYBLEND: 0
|
||||
- _CFXR_OVERLAYTEX: 0
|
||||
- _Cutoff: 0.1
|
||||
- _DirLightScreenAtten: 1
|
||||
- _DirectLightingRamp: 1
|
||||
- _DissolveSmooth: 0.1
|
||||
- _Distort: 0.1
|
||||
- _DoubleDissolve: 0
|
||||
- _DstBlend: 10
|
||||
- _EdgeFadePow: 1
|
||||
- _FadeAlongU: 0
|
||||
- _HdrBoost: 1
|
||||
- _HdrMultiply: 2
|
||||
- _IndirectLightingMix: 0.5
|
||||
- _InvertDissolveTex: 0
|
||||
- _LightingWorldPosStrength: 0.2
|
||||
- _OVERLAYBLEND: 0
|
||||
- _OVERLAYTEX: 0
|
||||
- _SecondColorSmooth: 0.2
|
||||
- _ShadowStrength: 1
|
||||
- _SingleChannel: 1
|
||||
- _SoftParticlesFadeDistanceFar: 1
|
||||
- _SoftParticlesFadeDistanceNear: 0
|
||||
- _SrcBlend: 5
|
||||
- _UVDistortionAdd: 0
|
||||
- _UseAlphaClip: 0
|
||||
- _UseBackLighting: 0
|
||||
- _UseDissolve: 0
|
||||
- _UseDissolveOffsetUV: 0
|
||||
- _UseEF: 0
|
||||
- _UseEmission: 0
|
||||
- _UseFB: 0
|
||||
- _UseFontColor: 0
|
||||
- _UseLighting: 0
|
||||
- _UseLightingWorldPosOffset: 0
|
||||
- _UseNormalMap: 0
|
||||
- _UseSP: 0
|
||||
- _UseSecondColor: 0
|
||||
- _UseUV2Distortion: 0
|
||||
- _UseUVDistortion: 0
|
||||
- _ZWrite: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 4.237095, g: 4.237095, b: 4.237095, a: 1}
|
||||
- _DissolveScroll: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _DistortScrolling: {r: 0, g: 0, b: 1, a: 1}
|
||||
- _OverlayTex_Scroll: {r: 0.1, g: 0.1, b: 1, a: 1}
|
||||
- _ShadowColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SoftParticlesFadeDistance: {r: 0, g: 1, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cbb6f419bbe7c6e4d9ce7e0322aa267d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
After Width: | Height: | Size: 101 KiB |
@ -0,0 +1,121 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ccb58def4933d4e46b7a1fc023bf6259
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 9
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
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
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
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: 2
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 10
|
||||
textureShape: 1
|
||||
singleChannelComponent: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 256
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 256
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Android
|
||||
maxTextureSize: 256
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: 63
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 1
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,120 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: cfxr magic star hdr ab
|
||||
m_Shader: {fileID: -6465566751694194690, guid: 1a29b4d27eb8b04479ef89c00dea533d,
|
||||
type: 3}
|
||||
m_ValidKeywords:
|
||||
- _ALPHABLEND_ON
|
||||
- _CFXR_DITHERED_SHADOWS_ON
|
||||
- _FADING_ON
|
||||
m_InvalidKeywords:
|
||||
- _
|
||||
- _CFXR_HDR_BOOST
|
||||
- _CFXR_OVERLAYBLEND_RGBA
|
||||
- _CFXR_OVERLAYTEX_OFF
|
||||
- _CFXR_SINGLE_CHANNEL
|
||||
- _SINGLECHANNEL_ON
|
||||
m_LightmapFlags: 0
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DissolveTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DistortTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DitherCustom:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _GradientMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: 081073d8f2209c949819e1e5872845b3, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OverlayTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SecondColorTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BacklightTransmittance: 1
|
||||
- _BlendingType: 0
|
||||
- _BumpScale: 1
|
||||
- _CFXR_DITHERED_SHADOWS: 1
|
||||
- _CFXR_OVERLAYBLEND: 0
|
||||
- _CFXR_OVERLAYTEX: 0
|
||||
- _Cutoff: 0.1
|
||||
- _DirLightScreenAtten: 1
|
||||
- _DirectLightingRamp: 1
|
||||
- _DissolveSmooth: 0.1
|
||||
- _Distort: 0.1
|
||||
- _DoubleDissolve: 0
|
||||
- _DstBlend: 10
|
||||
- _EdgeFadePow: 1
|
||||
- _FadeAlongU: 0
|
||||
- _HdrBoost: 1
|
||||
- _HdrMultiply: 10
|
||||
- _IndirectLightingMix: 0.5
|
||||
- _InvertDissolveTex: 0
|
||||
- _LightingWorldPosStrength: 0.2
|
||||
- _OVERLAYBLEND: 0
|
||||
- _OVERLAYTEX: 0
|
||||
- _SecondColorSmooth: 0.2
|
||||
- _ShadowStrength: 0.5
|
||||
- _SingleChannel: 1
|
||||
- _SoftParticlesFadeDistanceFar: 2
|
||||
- _SoftParticlesFadeDistanceNear: 0
|
||||
- _SrcBlend: 5
|
||||
- _UVDistortionAdd: 0
|
||||
- _UseAlphaClip: 0
|
||||
- _UseBackLighting: 0
|
||||
- _UseDissolve: 0
|
||||
- _UseDissolveOffsetUV: 0
|
||||
- _UseEF: 0
|
||||
- _UseEmission: 0
|
||||
- _UseFB: 0
|
||||
- _UseFontColor: 0
|
||||
- _UseGradientMap: 0
|
||||
- _UseLighting: 0
|
||||
- _UseLightingWorldPosOffset: 0
|
||||
- _UseNormalMap: 0
|
||||
- _UseSP: 1
|
||||
- _UseSecondColor: 0
|
||||
- _UseUV2Distortion: 0
|
||||
- _UseUVDistortion: 0
|
||||
- _ZWrite: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 3.8792846, g: 3.8792846, b: 3.8792846, a: 0}
|
||||
- _DissolveScroll: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _DistortScrolling: {r: 0, g: 0, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _OverlayTex_Scroll: {r: 0.1, g: 0.1, b: 1, a: 1}
|
||||
- _ShadowColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 41e018a6cf0c896418fc0b89dda748c6
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,162 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!43 &4300000
|
||||
Mesh:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: cfxr magic star mesh
|
||||
serializedVersion: 9
|
||||
m_SubMeshes:
|
||||
- serializedVersion: 2
|
||||
firstByte: 0
|
||||
indexCount: 78
|
||||
topology: 0
|
||||
baseVertex: 0
|
||||
firstVertex: 0
|
||||
vertexCount: 28
|
||||
localAABB:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0.4375, y: 0.4375, z: 0}
|
||||
m_Shapes:
|
||||
vertices: []
|
||||
shapes: []
|
||||
channels: []
|
||||
fullWeights: []
|
||||
m_BindPose: []
|
||||
m_BoneNameHashes:
|
||||
m_RootBoneNameHash: 0
|
||||
m_MeshCompression: 0
|
||||
m_IsReadable: 1
|
||||
m_KeepVertices: 1
|
||||
m_KeepIndices: 1
|
||||
m_IndexFormat: 0
|
||||
m_IndexBuffer: 120005001a001a001300120012000b000500050004001a001a001400130012000c000b000b000a00050004001b001a001a001700140012000f000c000a0006000500040002001b001a0019001700170015001400120011000f000f000d000c000a0008000600020000001b00190018001700170016001500110010000f000f000e000d000a0009000800080007000600040003000200020001000000
|
||||
m_VertexData:
|
||||
serializedVersion: 2
|
||||
m_VertexCount: 28
|
||||
m_Channels:
|
||||
- stream: 0
|
||||
offset: 0
|
||||
format: 0
|
||||
dimension: 3
|
||||
- stream: 0
|
||||
offset: 12
|
||||
format: 0
|
||||
dimension: 3
|
||||
- stream: 0
|
||||
offset: 0
|
||||
format: 0
|
||||
dimension: 0
|
||||
- stream: 0
|
||||
offset: 0
|
||||
format: 0
|
||||
dimension: 0
|
||||
- stream: 0
|
||||
offset: 24
|
||||
format: 0
|
||||
dimension: 2
|
||||
- stream: 0
|
||||
offset: 0
|
||||
format: 0
|
||||
dimension: 0
|
||||
- stream: 0
|
||||
offset: 0
|
||||
format: 0
|
||||
dimension: 0
|
||||
- stream: 0
|
||||
offset: 0
|
||||
format: 0
|
||||
dimension: 0
|
||||
- stream: 0
|
||||
offset: 0
|
||||
format: 0
|
||||
dimension: 0
|
||||
- stream: 0
|
||||
offset: 0
|
||||
format: 0
|
||||
dimension: 0
|
||||
- stream: 0
|
||||
offset: 0
|
||||
format: 0
|
||||
dimension: 0
|
||||
- stream: 0
|
||||
offset: 0
|
||||
format: 0
|
||||
dimension: 0
|
||||
- stream: 0
|
||||
offset: 0
|
||||
format: 0
|
||||
dimension: 0
|
||||
- stream: 0
|
||||
offset: 0
|
||||
format: 0
|
||||
dimension: 0
|
||||
m_DataSize: 896
|
||||
_typelessdata: 0000b43e000000bd000000000000000000000000000080bf00005a3f0000f03e0000dc3e0000c0bc000000000000000000000000000080bf00006e3f0000f43e0000e03e000000bc000000000000000000000000000080bf0000703f0000fc3e0000e03e0000c03c000000000000000000000000000080bf0000703f0000063f0000703e0000903d000000000000000000000000000080bf00003c3f0000123f0000c03d0000083e000000000000000000000000000080bf0000183f0000223f0000603d0000703e000000000000000000000000ffff7fbf00000e3f00003c3f0000c03c0000d83e000000000000000000000000000080bf0000063f00006c3f0000003c0000e03e000000000000000000000000000080bf0000023f0000703f0000c0bc0000e03e000000000000000000000000000080bf0000f43e0000703f000090bd0000703e000000000000000000000000000080bf0000dc3e00003c3f000008be0000c03d000000000000000000000000000080bf0000bc3e0000183f000070be0000603d000000000000000000000000000080bf0000883e00000e3f0000b4be0000003d000000000000000000000000000080bf0000183e0000083f0000dcbe0000003d000000000000000000000000000080bf0000903d0000083f0000e0be0000003c000000000000000000000000000080bf0000803d0000023f0000e0be000080bc000000000000000000000000000080bf0000803d0000f83e0000d8be0000c0bc000000000000000000000000ffff7fbf0000a03d0000f43e000050be000060bd000000000000000000000000000080bf0000983e0000e43e0000c0bd000008be000000000000000000000000000080bf0000d03e0000bc3e000060bd000070be000000000000000000000000000080bf0000e43e0000883e000000bd0000b4be000000000000000000000000000080bf0000f03e0000183e000000bd0000dcbe000000000000000000000000000080bf0000f03e0000903d000000bc0000e0be000000000000000000000000000080bf0000fc3e0000803d0000803c0000e0be000000000000000000000000000080bf0000043f0000803d0000c03c0000d8be000000000000000000000000ffff7fbf0000063f0000a03d0000603d000050be000000000000000000000000000080bf00000e3f0000983e0000303e0000a0bd000000000000000000000000000080bf00002c3f0000d83e
|
||||
m_CompressedMesh:
|
||||
m_Vertices:
|
||||
m_NumItems: 0
|
||||
m_Range: 0
|
||||
m_Start: 0
|
||||
m_Data:
|
||||
m_BitSize: 0
|
||||
m_UV:
|
||||
m_NumItems: 0
|
||||
m_Range: 0
|
||||
m_Start: 0
|
||||
m_Data:
|
||||
m_BitSize: 0
|
||||
m_Normals:
|
||||
m_NumItems: 0
|
||||
m_Range: 0
|
||||
m_Start: 0
|
||||
m_Data:
|
||||
m_BitSize: 0
|
||||
m_Tangents:
|
||||
m_NumItems: 0
|
||||
m_Range: 0
|
||||
m_Start: 0
|
||||
m_Data:
|
||||
m_BitSize: 0
|
||||
m_Weights:
|
||||
m_NumItems: 0
|
||||
m_Data:
|
||||
m_BitSize: 0
|
||||
m_NormalSigns:
|
||||
m_NumItems: 0
|
||||
m_Data:
|
||||
m_BitSize: 0
|
||||
m_TangentSigns:
|
||||
m_NumItems: 0
|
||||
m_Data:
|
||||
m_BitSize: 0
|
||||
m_FloatColors:
|
||||
m_NumItems: 0
|
||||
m_Range: 0
|
||||
m_Start: 0
|
||||
m_Data:
|
||||
m_BitSize: 0
|
||||
m_BoneIndices:
|
||||
m_NumItems: 0
|
||||
m_Data:
|
||||
m_BitSize: 0
|
||||
m_Triangles:
|
||||
m_NumItems: 0
|
||||
m_Data:
|
||||
m_BitSize: 0
|
||||
m_UVInfo: 0
|
||||
m_LocalAABB:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0.4375, y: 0.4375, z: 0}
|
||||
m_MeshUsageFlags: 0
|
||||
m_BakedConvexCollisionMesh:
|
||||
m_BakedTriangleCollisionMesh:
|
||||
m_MeshMetrics[0]: 1
|
||||
m_MeshMetrics[1]: 1
|
||||
m_MeshOptimized: 0
|
||||
m_StreamData:
|
||||
offset: 0
|
||||
size: 0
|
||||
path:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd8a92b47db41f644ae7188f06a986a2
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 4300000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
@ -0,0 +1,121 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 081073d8f2209c949819e1e5872845b3
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 9
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
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
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
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: 2
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 10
|
||||
textureShape: 1
|
||||
singleChannelComponent: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 128
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 128
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Android
|
||||
maxTextureSize: 128
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 128
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: 63
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 1
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,122 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: cfxr stretch ray blur hdr ab
|
||||
m_Shader: {fileID: -6465566751694194690, guid: 1a29b4d27eb8b04479ef89c00dea533d,
|
||||
type: 3}
|
||||
m_ValidKeywords:
|
||||
- _ALPHABLEND_ON
|
||||
- _CFXR_HDR_BOOST
|
||||
- _CFXR_SINGLE_CHANNEL
|
||||
- _FADING_ON
|
||||
m_InvalidKeywords:
|
||||
- _
|
||||
- _CFXR_DITHERED_SHADOWS_OFF
|
||||
- _CFXR_OVERLAYBLEND_RGBA
|
||||
- _CFXR_OVERLAYTEX_OFF
|
||||
m_LightmapFlags: 0
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DissolveTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DistortTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DitherCustom:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _GradientMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: ea08f0da7f459e147ba80e6dd6e38bb9, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OverlayTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SecondColorTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _AmbientColor: 0.5
|
||||
- _AmbientIntensity: 1
|
||||
- _BacklightTransmittance: 1
|
||||
- _BlendingType: 0
|
||||
- _BumpScale: 1
|
||||
- _CFXR_DITHERED_SHADOWS: 0
|
||||
- _CFXR_OVERLAYBLEND: 0
|
||||
- _CFXR_OVERLAYTEX: 0
|
||||
- _Cutoff: 0.1
|
||||
- _DirLightScreenAtten: 1
|
||||
- _DirectLightingRamp: 1
|
||||
- _DissolveSmooth: 0.1
|
||||
- _Distort: 0.1
|
||||
- _DoubleDissolve: 0
|
||||
- _DstBlend: 10
|
||||
- _EdgeFadePow: 1
|
||||
- _FadeAlongU: 0
|
||||
- _HdrBoost: 1
|
||||
- _HdrMultiply: 4
|
||||
- _IndirectLightingMix: 0.5
|
||||
- _InvertDissolveTex: 0
|
||||
- _LightingWorldPosStrength: 0.2
|
||||
- _OVERLAYBLEND: 0
|
||||
- _OVERLAYTEX: 0
|
||||
- _ReceivedShadowsStrength: 0.5
|
||||
- _SecondColorSmooth: 0.2
|
||||
- _ShadowStrength: 0.5
|
||||
- _SingleChannel: 1
|
||||
- _SoftParticlesFadeDistanceFar: 1
|
||||
- _SoftParticlesFadeDistanceNear: 0
|
||||
- _SrcBlend: 5
|
||||
- _UVDistortionAdd: 0
|
||||
- _UseAlphaClip: 0
|
||||
- _UseBackLighting: 0
|
||||
- _UseDissolve: 0
|
||||
- _UseDissolveOffsetUV: 0
|
||||
- _UseEF: 0
|
||||
- _UseEmission: 0
|
||||
- _UseFB: 0
|
||||
- _UseFontColor: 0
|
||||
- _UseGradientMap: 0
|
||||
- _UseLighting: 0
|
||||
- _UseLightingWorldPosOffset: 0
|
||||
- _UseNormalMap: 0
|
||||
- _UseSP: 1
|
||||
- _UseSecondColor: 0
|
||||
- _UseUV2Distortion: 0
|
||||
- _UseUVDistortion: 0
|
||||
- _ZWrite: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 2, g: 2, b: 2, a: 0}
|
||||
- _DissolveScroll: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _DistortScrolling: {r: 0, g: 0, b: 1, a: 1}
|
||||
- _OverlayTex_Scroll: {r: 0.1, g: 0.1, b: 1, a: 1}
|
||||
- _ShadowColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SoftParticlesFadeDistance: {r: 0, g: 1, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 935ab430b9a17de4caf00054e74116f4
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
@ -0,0 +1,121 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea08f0da7f459e147ba80e6dd6e38bb9
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 9
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
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
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
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: 2
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 10
|
||||
textureShape: 1
|
||||
singleChannelComponent: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Android
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: 63
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 1
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 01151e36115d4404180e5c816ab7907b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04efd1cc0f5c31c4da57d931c6665976
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9205bc1bbacc90040a998067b5643d16
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 403cb51292a8b3c4c870cccfc0e68659
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 03c8102322ad0d04fa6ae3f17887e967
|
||||
timeCreated: 1535104615
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ffbf5f8b3f8ff3e49bbbf5495becc6b3
|
||||
timeCreated: 1535104615
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8cae0f0a83438824eb3829def92d2ae6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,422 @@
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
// Cartoon FX
|
||||
// (c) 2012-2020 Jean Moreno
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Shader "Cartoon FX/Remaster/Particle Ubershader"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
//# Blending
|
||||
//#
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Blend Source", Float) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Blend Destination", Float) = 10
|
||||
[KeywordEnumNoPrefix(Alpha Blending, _ALPHABLEND_ON, Alpha Blending Premultiplied, _ALPHAPREMULTIPLY_ON, Multiplicative, _ALPHAMODULATE_ON, Additive, _CFXR_ADDITIVE)] _BlendingType ("Blending Type", Float) = 0
|
||||
|
||||
//#
|
||||
[ToggleNoKeyword] _ZWrite ("Depth Write", Float) = 0
|
||||
[Toggle(_ALPHATEST_ON)] _UseAlphaClip ("Alpha Clipping (Cutout)", Float) = 0
|
||||
//# IF_KEYWORD _ALPHATEST_ON
|
||||
_Cutoff ("Cutoff Threshold", Range(0.001,1)) = 0.1
|
||||
//# END_IF
|
||||
|
||||
//# --------------------------------------------------------
|
||||
|
||||
[Toggle(_FADING_ON)] _UseSP ("Soft Particles", Float) = 0
|
||||
//# IF_KEYWORD _FADING_ON
|
||||
_SoftParticlesFadeDistanceNear ("Near Fade", Float) = 0
|
||||
_SoftParticlesFadeDistanceFar ("Far Fade", Float) = 1
|
||||
//# END_IF
|
||||
|
||||
//#
|
||||
|
||||
[Toggle(_CFXR_EDGE_FADING)] _UseEF ("Edge Fade", Float) = 0
|
||||
//# IF_KEYWORD _CFXR_EDGE_FADING
|
||||
_EdgeFadePow ("Edge Fade Power", Float) = 1
|
||||
//# END_IF
|
||||
|
||||
//#
|
||||
|
||||
//# ========================================================
|
||||
|
||||
//# Effects
|
||||
//#
|
||||
|
||||
[Toggle(_CFXR_DISSOLVE)] _UseDissolve ("Enable Dissolve", Float) = 0
|
||||
//# IF_KEYWORD _CFXR_DISSOLVE
|
||||
_DissolveTex ("Dissolve Texture", 2D) = "gray" {}
|
||||
_DissolveSmooth ("Dissolve Smoothing", Range(0.0001,0.5)) = 0.1
|
||||
[ToggleNoKeyword] _InvertDissolveTex ("Invert Dissolve Texture", Float) = 0
|
||||
[ToggleNoKeyword] _DoubleDissolve ("Double Dissolve", Float) = 0
|
||||
[Toggle] _UseDissolveOffsetUV ("Dissolve offset along X", Float) = 0
|
||||
//# IF_PROPERTY _UseDissolveOffsetUV > 0
|
||||
_DissolveScroll ("UV Scrolling", Vector) = (0,0,0,0)
|
||||
//# END_IF
|
||||
//# END_IF
|
||||
|
||||
//# --------------------------------------------------------
|
||||
|
||||
[Toggle(_CFXR_UV_DISTORTION)] _UseUVDistortion ("Enable UV Distortion", Float) = 0
|
||||
//# IF_KEYWORD _CFXR_UV_DISTORTION
|
||||
|
||||
[NoScaleOffset] _DistortTex ("Distortion Texture", 2D) = "gray" {}
|
||||
_DistortScrolling ("Scroll (XY) Tile (ZW)", Vector) = (0,0,1,1)
|
||||
[Toggle] _UseUV2Distortion ("Use UV2", Float) = 0
|
||||
_Distort ("Distortion Strength", Range(0,2.0)) = 0.1
|
||||
[ToggleNoKeyword] _FadeAlongU ("Fade along Y", Float) = 0
|
||||
[Toggle] _UVDistortionAdd ("Add to base UV", Float) = 0
|
||||
//# END_IF
|
||||
|
||||
//# ========================================================
|
||||
|
||||
//# Colors
|
||||
//#
|
||||
|
||||
[NoScaleOffset] _MainTex ("Texture", 2D) = "white" {}
|
||||
[Toggle] _SingleChannel ("Single Channel Texture", Float) = 0
|
||||
|
||||
//# --------------------------------------------------------
|
||||
|
||||
[KeywordEnum(Off,1x,2x)] _CFXR_OVERLAYTEX ("Enable Overlay Texture", Float) = 0
|
||||
//# IF_KEYWORD _CFXR_OVERLAYTEX_1X || _CFXR_OVERLAYTEX_2X
|
||||
[Enum(RGBA,0,RGB,1,A,2)] _CFXR_OVERLAYBLEND ("Overlay Blend Channels", Float) = 0
|
||||
[NoScaleOffset] _OverlayTex ("Overlay Texture", 2D) = "white" {}
|
||||
_OverlayTex_Scroll ("Overlay Scrolling / Scale", Vector) = (0.1,0.1,1,1)
|
||||
//# END_IF
|
||||
|
||||
//# --------------------------------------------------------
|
||||
|
||||
[Toggle(_FLIPBOOK_BLENDING)] _UseFB ("Flipbook Blending", Float) = 0
|
||||
|
||||
//# --------------------------------------------------------
|
||||
|
||||
[Toggle(_CFXR_SECONDCOLOR_LERP)] _UseSecondColor ("Secondary Vertex Color (TEXCOORD2)", Float) = 0
|
||||
//# IF_KEYWORD _CFXR_SECONDCOLOR_LERP
|
||||
[NoScaleOffset] _SecondColorTex ("Second Color Map", 2D) = "black" {}
|
||||
_SecondColorSmooth ("Second Color Smoothing", Range(0.0001,0.5)) = 0.2
|
||||
//# END_IF
|
||||
|
||||
//# --------------------------------------------------------
|
||||
|
||||
[Toggle(_CFXR_FONT_COLORS)] _UseFontColor ("Use Font Colors", Float) = 0
|
||||
|
||||
// //# --------------------------------------------------------
|
||||
//
|
||||
// [Toggle(_CFXR_GRADIENTMAP)] _UseGradientMap ("Gradient Map", Float) = 0
|
||||
// //# IF_KEYWORD _CFXR_GRADIENTMAP
|
||||
// [NoScaleOffset] _GradientMap ("Gradient Map", 2D) = "black" {}
|
||||
// //# END_IF
|
||||
|
||||
//# --------------------------------------------------------
|
||||
|
||||
_HdrMultiply ("HDR Multiplier", Float) = 1
|
||||
|
||||
//# --------------------------------------------------------
|
||||
|
||||
//# Lighting
|
||||
//#
|
||||
|
||||
[KeywordEnumNoPrefix(Off, _, Direct, _CFXR_LIGHTING_DIRECT, Indirect, _CFXR_LIGHTING_INDIRECT, Both, _CFXR_LIGHTING_ALL)] _UseLighting ("Mode", Float) = 0
|
||||
//# IF_KEYWORD _CFXR_LIGHTING_DIRECT || _CFXR_LIGHTING_ALL
|
||||
_DirectLightingRamp ("Direct Lighting Ramp", Range(0,1)) = 1.0
|
||||
//# END_IF
|
||||
//#
|
||||
//# IF_KEYWORD _CFXR_LIGHTING_DIRECT || _CFXR_LIGHTING_INDIRECT || _CFXR_LIGHTING_ALL
|
||||
[Toggle(_NORMALMAP)] _UseNormalMap ("Enable Normal Map", Float) = 0
|
||||
//# IF_KEYWORD _NORMALMAP
|
||||
[NoScaleOffset] _BumpMap ("Normal Map", 2D) = "bump" {}
|
||||
_BumpScale ("Normal Scale", Range(-1, 1)) = 1.0
|
||||
//# END_IF
|
||||
//#
|
||||
[Toggle(_EMISSION)] _UseEmission ("Enable Emission (TEXCOORD2)", Float) = 0
|
||||
//#
|
||||
[Toggle(_CFXR_LIGHTING_WPOS_OFFSET)] _UseLightingWorldPosOffset ("Enable World Pos. Offset", Float) = 0
|
||||
//# IF_KEYWORD _CFXR_LIGHTING_WPOS_OFFSET
|
||||
_LightingWorldPosStrength ("Offset Strength", Range(0,1)) = 0.2
|
||||
//# END_IF
|
||||
//#
|
||||
[Toggle(_CFXR_LIGHTING_BACK)] _UseBackLighting ("Enable Backlighting", Float) = 0
|
||||
//# IF_KEYWORD _CFXR_LIGHTING_BACK
|
||||
_DirLightScreenAtten ("Dir. Light Screen Attenuation", Range(0, 5)) = 1.0
|
||||
_BacklightTransmittance ("Backlight Transmittance", Range(0, 2)) = 1.0
|
||||
//# END_IF
|
||||
//#
|
||||
//# IF_KEYWORD _CFXR_LIGHTING_INDIRECT || _CFXR_LIGHTING_ALL
|
||||
_IndirectLightingMix ("Indirect Lighting Mix", Range(0,1)) = 0.5
|
||||
//# END_IF
|
||||
_ShadowColor ("Shadow Color", Color) = (0,0,0,1)
|
||||
//#
|
||||
//# END_IF
|
||||
|
||||
//# ========================================================
|
||||
//# Shadows
|
||||
//#
|
||||
|
||||
[KeywordEnum(Off,On,CustomTexture)] _CFXR_DITHERED_SHADOWS ("Dithered Shadows", Float) = 0
|
||||
//# IF_KEYWORD _CFXR_DITHERED_SHADOWS_ON || _CFXR_DITHERED_SHADOWS_CUSTOMTEXTURE
|
||||
_ShadowStrength ("Shadows Strength Max", Range(0,1)) = 1.0
|
||||
//# IF_KEYWORD _CFXR_DITHERED_SHADOWS_CUSTOMTEXTURE
|
||||
_DitherCustom ("Dithering 3D Texture", 3D) = "black" {}
|
||||
//# END_IF
|
||||
//# END_IF
|
||||
|
||||
// _ReceivedShadowsStrength ("Received Shadows Strength", Range(0,1)) = 0.5
|
||||
}
|
||||
|
||||
Category
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
}
|
||||
|
||||
Blend [_SrcBlend] [_DstBlend], One One
|
||||
ZWrite [_ZWrite]
|
||||
Cull Off
|
||||
|
||||
/*** URP ***/
|
||||
//====================================================================================================================================
|
||||
// Universal Rendering Pipeline
|
||||
|
||||
Subshader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
Name "BASE_URP"
|
||||
Tags { "LightMode"="UniversalForward" }
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertex_program
|
||||
#pragma fragment fragment_program
|
||||
|
||||
#pragma target 2.0
|
||||
|
||||
// #pragma multi_compile_instancing
|
||||
// #pragma instancing_options procedural:ParticleInstancingSetup
|
||||
|
||||
#pragma multi_compile_fog
|
||||
//#pragma multi_compile_fwdbase
|
||||
//#pragma multi_compile SHADOWS_SCREEN
|
||||
|
||||
#pragma shader_feature_local _ _CFXR_DISSOLVE
|
||||
#pragma shader_feature_local_fragment _ _CFXR_UV_DISTORTION
|
||||
// #pragma shader_feature_local _ _CFXR_GRADIENTMAP
|
||||
#pragma shader_feature_local _ _CFXR_SECONDCOLOR_LERP _CFXR_FONT_COLORS
|
||||
#pragma shader_feature_local_fragment _ _CFXR_OVERLAYTEX_1X _CFXR_OVERLAYTEX_2X
|
||||
#pragma shader_feature_local _ _CFXR_EDGE_FADING
|
||||
#pragma shader_feature_local _ _CFXR_LIGHTING_DIRECT _CFXR_LIGHTING_INDIRECT _CFXR_LIGHTING_ALL
|
||||
#pragma shader_feature_local _ _CFXR_LIGHTING_WPOS_OFFSET
|
||||
#pragma shader_feature_local _ _CFXR_LIGHTING_BACK
|
||||
|
||||
// Using the same keywords as Unity's Standard Particle shader to minimize project-wide keyword usage
|
||||
#pragma shader_feature_local _ _NORMALMAP
|
||||
#pragma shader_feature_local _ _EMISSION
|
||||
#pragma shader_feature_local_fragment _ _FLIPBOOK_BLENDING
|
||||
#pragma shader_feature_local _ _FADING_ON
|
||||
#pragma shader_feature_local_fragment _ _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON _CFXR_ADDITIVE
|
||||
|
||||
#define CFXR_URP
|
||||
#define CFXR_UBERSHADER
|
||||
#include "CFXR_PASSES.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// Same as above with 'Universal2D' instead and DISABLE_SOFT_PARTICLES keyword
|
||||
Pass
|
||||
{
|
||||
Name "BASE_URP"
|
||||
Tags { "LightMode"="Universal2D" }
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertex_program
|
||||
#pragma fragment fragment_program
|
||||
|
||||
#pragma target 2.0
|
||||
|
||||
// #pragma multi_compile_instancing
|
||||
// #pragma instancing_options procedural:ParticleInstancingSetup
|
||||
|
||||
#pragma multi_compile_fog
|
||||
//#pragma multi_compile_fwdbase
|
||||
//#pragma multi_compile SHADOWS_SCREEN
|
||||
|
||||
#pragma shader_feature_local _ _CFXR_DISSOLVE
|
||||
#pragma shader_feature_local_fragment _ _CFXR_UV_DISTORTION
|
||||
// #pragma shader_feature_local _ _CFXR_GRADIENTMAP
|
||||
#pragma shader_feature_local _ _CFXR_SECONDCOLOR_LERP _CFXR_FONT_COLORS
|
||||
#pragma shader_feature_local_fragment _ _CFXR_OVERLAYTEX_1X _CFXR_OVERLAYTEX_2X
|
||||
#pragma shader_feature_local _ _CFXR_EDGE_FADING
|
||||
#pragma shader_feature_local _ _CFXR_LIGHTING_DIRECT _CFXR_LIGHTING_INDIRECT _CFXR_LIGHTING_ALL
|
||||
#pragma shader_feature_local _ _CFXR_LIGHTING_WPOS_OFFSET
|
||||
#pragma shader_feature_local _ _CFXR_LIGHTING_BACK
|
||||
|
||||
// Using the same keywords as Unity's Standard Particle shader to minimize project-wide keyword usage
|
||||
#pragma shader_feature_local _ _NORMALMAP
|
||||
#pragma shader_feature_local _ _EMISSION
|
||||
#pragma shader_feature_local_fragment _ _FLIPBOOK_BLENDING
|
||||
#pragma shader_feature_local _ _FADING_ON
|
||||
#pragma shader_feature_local_fragment _ _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON _CFXR_ADDITIVE
|
||||
|
||||
#define CFXR_UPR
|
||||
#define DISABLE_SOFT_PARTICLES
|
||||
#define CFXR_UBERSHADER
|
||||
#include "CFXR_PASSES.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "ShadowCaster"
|
||||
Tags { "LightMode" = "ShadowCaster" }
|
||||
|
||||
BlendOp Add
|
||||
Blend One Zero
|
||||
ZWrite On
|
||||
Cull Off
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertex_program
|
||||
#pragma fragment fragment_program
|
||||
|
||||
#pragma shader_feature_local _ _CFXR_DISSOLVE
|
||||
#pragma shader_feature_local_fragment _ _CFXR_UV_DISTORTION
|
||||
#pragma shader_feature_local_fragment _ _CFXR_OVERLAYTEX_1X _CFXR_OVERLAYTEX_2X
|
||||
#pragma shader_feature_local_fragment _ _FLIPBOOK_BLENDING
|
||||
|
||||
#pragma shader_feature_local_fragment _ _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON _CFXR_ADDITIVE
|
||||
|
||||
#pragma multi_compile_shadowcaster
|
||||
#pragma shader_feature_local _ _CFXR_DITHERED_SHADOWS_ON _CFXR_DITHERED_SHADOWS_CUSTOMTEXTURE
|
||||
|
||||
#if (_CFXR_DITHERED_SHADOWS_ON || _CFXR_DITHERED_SHADOWS_CUSTOMTEXTURE) && !defined(SHADER_API_GLES)
|
||||
#pragma target 3.0 //needed for VPOS
|
||||
#endif
|
||||
|
||||
#define CFXR_UPR
|
||||
#define PASS_SHADOW_CASTER
|
||||
#define CFXR_UBERSHADER
|
||||
#include "CFXR_PASSES.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
/*** END URP ***/
|
||||
|
||||
/*** BIRP ***/
|
||||
//====================================================================================================================================
|
||||
// Built-in Rendering Pipeline
|
||||
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
Name "BASE"
|
||||
Tags { "LightMode"="ForwardBase" }
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertex_program
|
||||
#pragma fragment fragment_program
|
||||
|
||||
//vertInstancingSetup writes to global, not allowed with DXC
|
||||
// #pragma never_use_dxc
|
||||
// #pragma target 2.5
|
||||
// #pragma multi_compile_instancing
|
||||
// #pragma instancing_options procedural:vertInstancingSetup
|
||||
|
||||
#pragma multi_compile_particles
|
||||
#pragma multi_compile_fog
|
||||
//#pragma multi_compile_fwdbase
|
||||
//#pragma multi_compile SHADOWS_SCREEN
|
||||
|
||||
#pragma shader_feature_local _ _CFXR_DISSOLVE
|
||||
#pragma shader_feature_local_fragment _ _CFXR_UV_DISTORTION
|
||||
// #pragma shader_feature_local _ _CFXR_GRADIENTMAP
|
||||
#pragma shader_feature_local _ _CFXR_SECONDCOLOR_LERP _CFXR_FONT_COLORS
|
||||
#pragma shader_feature_local_fragment _ _CFXR_OVERLAYTEX_1X _CFXR_OVERLAYTEX_2X
|
||||
#pragma shader_feature_local _ _CFXR_EDGE_FADING
|
||||
#pragma shader_feature_local _ _CFXR_LIGHTING_DIRECT _CFXR_LIGHTING_INDIRECT _CFXR_LIGHTING_ALL
|
||||
#pragma shader_feature_local _ _CFXR_LIGHTING_WPOS_OFFSET
|
||||
#pragma shader_feature_local _ _CFXR_LIGHTING_BACK
|
||||
|
||||
// Using the same keywords as Unity's Standard Particle shader to minimize project-wide keyword usage
|
||||
#pragma shader_feature_local _ _NORMALMAP
|
||||
#pragma shader_feature_local _ _EMISSION
|
||||
#pragma shader_feature_local_fragment _ _FLIPBOOK_BLENDING
|
||||
#pragma shader_feature_local _ _FADING_ON
|
||||
#pragma shader_feature_local_fragment _ _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON _CFXR_ADDITIVE
|
||||
|
||||
#include "UnityStandardParticleInstancing.cginc"
|
||||
#define CFXR_UBERSHADER
|
||||
#include "CFXR_PASSES.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "ShadowCaster"
|
||||
Tags { "LightMode" = "ShadowCaster" }
|
||||
|
||||
BlendOp Add
|
||||
Blend One Zero
|
||||
ZWrite On
|
||||
Cull Off
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertex_program
|
||||
#pragma fragment fragment_program
|
||||
|
||||
//vertInstancingSetup writes to global, not allowed with DXC
|
||||
// #pragma never_use_dxc
|
||||
// #pragma target 2.5
|
||||
// #pragma multi_compile_instancing
|
||||
// #pragma instancing_options procedural:vertInstancingSetup
|
||||
|
||||
#pragma shader_feature_local _ _CFXR_DISSOLVE
|
||||
#pragma shader_feature_local_fragment _ _CFXR_UV_DISTORTION
|
||||
#pragma shader_feature_local_fragment _ _CFXR_OVERLAYTEX_1X _CFXR_OVERLAYTEX_2X
|
||||
#pragma shader_feature_local_fragment _ _FLIPBOOK_BLENDING
|
||||
|
||||
#pragma shader_feature_local_fragment _ _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON _CFXR_ADDITIVE
|
||||
|
||||
#pragma multi_compile_shadowcaster
|
||||
#pragma shader_feature_local _ _CFXR_DITHERED_SHADOWS_ON _CFXR_DITHERED_SHADOWS_CUSTOMTEXTURE
|
||||
|
||||
#if (_CFXR_DITHERED_SHADOWS_ON || _CFXR_DITHERED_SHADOWS_CUSTOMTEXTURE) && !defined(SHADER_API_GLES)
|
||||
#pragma target 3.0 //needed for VPOS
|
||||
#endif
|
||||
|
||||
#include "UnityStandardParticleInstancing.cginc"
|
||||
|
||||
#define PASS_SHADOW_CASTER
|
||||
#define CFXR_UBERSHADER
|
||||
#include "CFXR_PASSES.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
/*** END BIRP ***/
|
||||
}
|
||||
|
||||
CustomEditor "CartoonFX.MaterialInspector"
|
||||
}
|
||||
|
@ -0,0 +1,206 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a29b4d27eb8b04479ef89c00dea533d
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: fe56ec25963759b49955809beeb4324b, type: 3}
|
||||
detectedRenderPipeline: Built-In Render Pipeline
|
||||
strippedLinesCount: 0
|
||||
shaderSourceCode: "//--------------------------------------------------------------------------------------------------------------------------------\r\n//
|
||||
Cartoon FX\r\n// (c) 2012-2020 Jean Moreno\r\n//--------------------------------------------------------------------------------------------------------------------------------\r\n\r\nShader
|
||||
\"Cartoon FX/Remaster/Particle Ubershader\"\r\n{\r\n\tProperties\r\n\t{\r\n\t//#
|
||||
Blending\r\n\t//#\r\n\t\t[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend (\"Blend
|
||||
Source\", Float) = 5\r\n\t\t[Enum(UnityEngine.Rendering.BlendMode)] _DstBlend
|
||||
(\"Blend Destination\", Float) = 10\r\n\t\t[KeywordEnumNoPrefix(Alpha Blending,
|
||||
_ALPHABLEND_ON, Alpha Blending Premultiplied, _ALPHAPREMULTIPLY_ON, Multiplicative,
|
||||
_ALPHAMODULATE_ON, Additive, _CFXR_ADDITIVE)] _BlendingType (\"Blending Type\",
|
||||
Float) = 0\r\n\r\n\t//# \r\n\t\t[ToggleNoKeyword] _ZWrite (\"Depth Write\", Float)
|
||||
= 0\r\n\t\t[Toggle(_ALPHATEST_ON)] _UseAlphaClip (\"Alpha Clipping (Cutout)\",
|
||||
Float) = 0\r\n\t//# IF_KEYWORD _ALPHATEST_ON\r\n\t\t_Cutoff (\"Cutoff Threshold\",
|
||||
Range(0.001,1)) = 0.1\r\n\t//# END_IF\r\n\t\r\n\t//# --------------------------------------------------------\r\n\t\r\n\t\t[Toggle(_FADING_ON)]
|
||||
_UseSP (\"Soft Particles\", Float) = 0\r\n\t//# IF_KEYWORD _FADING_ON\r\n\t\t_SoftParticlesFadeDistanceNear
|
||||
(\"Near Fade\", Float) = 0\r\n\t\t_SoftParticlesFadeDistanceFar (\"Far Fade\",
|
||||
Float) = 1\r\n\t//# END_IF\r\n\r\n\t//# \r\n\r\n\t\t[Toggle(_CFXR_EDGE_FADING)]
|
||||
_UseEF (\"Edge Fade\", Float) = 0\r\n\t//# IF_KEYWORD _CFXR_EDGE_FADING\r\n\t\t_EdgeFadePow
|
||||
(\"Edge Fade Power\", Float) = 1\r\n\t//# END_IF\r\n\r\n\t//# \r\n\r\n\t//# ========================================================\r\n\r\n\t//#
|
||||
Effects\r\n\t//#\r\n\r\n\t\t[Toggle(_CFXR_DISSOLVE)] _UseDissolve (\"Enable Dissolve\",
|
||||
Float) = 0\r\n\t//# IF_KEYWORD _CFXR_DISSOLVE\r\n\t\t_DissolveTex (\"Dissolve
|
||||
Texture\", 2D) = \"gray\" {}\r\n\t\t_DissolveSmooth (\"Dissolve Smoothing\",
|
||||
Range(0.0001,0.5)) = 0.1\r\n\t\t[ToggleNoKeyword] _InvertDissolveTex (\"Invert
|
||||
Dissolve Texture\", Float) = 0\r\n\t\t[ToggleNoKeyword] _DoubleDissolve (\"Double
|
||||
Dissolve\", Float) = 0\r\n\t\t[Toggle(_CFXR_DISSOLVE_ALONG_UV_X)] _UseDissolveOffsetUV
|
||||
(\"Dissolve offset along X\", Float) = 0\r\n\t//# IF_KEYWORD _CFXR_DISSOLVE_ALONG_UV_X\r\n\t\t_DissolveScroll
|
||||
(\"UV Scrolling\", Vector) = (0,0,0,0)\r\n\t//# END_IF\r\n\t//# END_IF\r\n\r\n\t//#
|
||||
--------------------------------------------------------\r\n\r\n\t\t[Toggle(_CFXR_UV_DISTORTION)]
|
||||
_UseUVDistortion (\"Enable UV Distortion\", Float) = 0\r\n\t//# IF_KEYWORD _CFXR_UV_DISTORTION\r\n\t\t\r\n\t\t[NoScaleOffset]
|
||||
_DistortTex (\"Distortion Texture\", 2D) = \"gray\" {}\r\n\t\t_DistortScrolling
|
||||
(\"Scroll (XY) Tile (ZW)\", Vector) = (0,0,1,1)\r\n\t\t[Toggle(_CFXR_UV2_DISTORTION)]
|
||||
_UseUV2Distortion (\"Use UV2\", Float) = 0\r\n\t\t_Distort (\"Distortion Strength\",
|
||||
Range(0,2.0)) = 0.1\r\n\t\t[ToggleNoKeyword] _FadeAlongU (\"Fade along Y\", Float)
|
||||
= 0\r\n\t\t[Toggle(_CFXR_UV_DISTORTION_ADD)] _UVDistortionAdd (\"Add to base
|
||||
UV\", Float) = 0\r\n\t//# END_IF\r\n\r\n\t//# ========================================================\r\n\r\n\t//#
|
||||
Colors\r\n\t//#\r\n\r\n\t\t[NoScaleOffset] _MainTex (\"Texture\", 2D) = \"white\"
|
||||
{}\r\n\t\t[Toggle(_CFXR_SINGLE_CHANNEL)] _SingleChannel (\"Single Channel Texture\",
|
||||
Float) = 0\r\n\r\n\t//# --------------------------------------------------------\r\n\r\n\t\t[KeywordEnum(Off,1x,2x)]
|
||||
_CFXR_OVERLAYTEX (\"Enable Overlay Texture\", Float) = 0\r\n\t//# IF_KEYWORD
|
||||
_CFXR_OVERLAYTEX_1X || _CFXR_OVERLAYTEX_2X\r\n\t\t[KeywordEnum(RGBA,RGB,A)] _CFXR_OVERLAYBLEND
|
||||
(\"Overlay Blend Channels\", Float) = 0\r\n\t\t[NoScaleOffset] _OverlayTex (\"Overlay
|
||||
Texture\", 2D) = \"white\" {}\r\n\t\t_OverlayTex_Scroll (\"Overlay Scrolling
|
||||
/ Scale\", Vector) = (0.1,0.1,1,1)\r\n\t//# END_IF\r\n\r\n\t//# --------------------------------------------------------\r\n\r\n\t\t[Toggle(_FLIPBOOK_BLENDING)]
|
||||
_UseFB (\"Flipbook Blending\", Float) = 0\r\n\r\n\t//# --------------------------------------------------------\r\n\r\n\t\t[Toggle(_CFXR_SECONDCOLOR_LERP)]
|
||||
_UseSecondColor (\"Secondary Vertex Color (TEXCOORD2)\", Float) = 0\r\n\t//#
|
||||
IF_KEYWORD _CFXR_SECONDCOLOR_LERP\r\n\t\t[NoScaleOffset] _SecondColorTex (\"Second
|
||||
Color Map\", 2D) = \"black\" {}\r\n\t\t_SecondColorSmooth (\"Second Color Smoothing\",
|
||||
Range(0.0001,0.5)) = 0.2\r\n\t//# END_IF\r\n\r\n\t//# --------------------------------------------------------\r\n\r\n\t\t[Toggle(_CFXR_FONT_COLORS)]
|
||||
_UseFontColor (\"Use Font Colors\", Float) = 0\r\n\r\n//\t//# --------------------------------------------------------\r\n//\r\n//\t[Toggle(_CFXR_GRADIENTMAP)]
|
||||
_UseGradientMap (\"Gradient Map\", Float) = 0\r\n//\t//# IF_KEYWORD _CFXR_GRADIENTMAP\r\n//\t\t[NoScaleOffset]
|
||||
_GradientMap (\"Gradient Map\", 2D) = \"black\" {}\r\n//\t//# END_IF\r\n\r\n\t//#
|
||||
--------------------------------------------------------\r\n\r\n\t\t[Toggle(_CFXR_HDR_BOOST)]
|
||||
_HdrBoost (\"Enable HDR Multiplier\", Float) = 0\r\n\t//# IF_KEYWORD _CFXR_HDR_BOOST\r\n\t\t
|
||||
_HdrMultiply (\"HDR Multiplier\", Float) = 2\r\n\t//# END_IF\r\n\r\n\t//# --------------------------------------------------------\r\n\t\r\n\t//#
|
||||
Lighting\r\n\t//#\r\n\r\n\t\t[KeywordEnumNoPrefix(Off, _, Direct, _CFXR_LIGHTING_DIRECT,
|
||||
Indirect, _CFXR_LIGHTING_INDIRECT, Both, _CFXR_LIGHTING_ALL)] _UseLighting (\"Mode\",
|
||||
Float) = 0\r\n\t//# IF_KEYWORD _CFXR_LIGHTING_DIRECT || _CFXR_LIGHTING_ALL\r\n\t\t_DirectLightingRamp
|
||||
(\"Direct Lighting Ramp\", Range(0,1)) = 1.0\r\n\t//# END_IF\r\n\t//# \r\n\t//#
|
||||
IF_KEYWORD _CFXR_LIGHTING_DIRECT || _CFXR_LIGHTING_INDIRECT || _CFXR_LIGHTING_ALL\r\n\t\t[Toggle(_NORMALMAP)]
|
||||
_UseNormalMap (\"Enable Normal Map\", Float) = 0\r\n\t//# IF_KEYWORD _NORMALMAP\r\n\t\t[NoScaleOffset]
|
||||
_BumpMap (\"Normal Map\", 2D) = \"bump\" {}\r\n\t\t_BumpScale (\"Normal Scale\",
|
||||
Range(-1, 1)) = 1.0\r\n\t//# END_IF\r\n\t//# \r\n\t\t[Toggle(_EMISSION)] _UseEmission
|
||||
(\"Enable Emission (TEXCOORD2)\", Float) = 0\r\n\t//# \r\n\t\t[Toggle(_CFXR_LIGHTING_WPOS_OFFSET)]
|
||||
_UseLightingWorldPosOffset (\"Enable World Pos. Offset\", Float) = 0\r\n\t//#
|
||||
IF_KEYWORD _CFXR_LIGHTING_WPOS_OFFSET\r\n\t\t_LightingWorldPosStrength (\"Offset
|
||||
Strength\", Range(0,1)) = 0.2\r\n\t//# END_IF\r\n\t//# \r\n\t\t[Toggle(_CFXR_LIGHTING_BACK)]
|
||||
_UseBackLighting (\"Enable Backlighting\", Float) = 0\r\n\t//# IF_KEYWORD _CFXR_LIGHTING_BACK\r\n\t\t_DirLightScreenAtten
|
||||
(\"Dir. Light Screen Attenuation\", Range(0, 5)) = 1.0\r\n\t\t_BacklightTransmittance
|
||||
(\"Backlight Transmittance\", Range(0, 2)) = 1.0\r\n\t//# END_IF\r\n\t//# \r\n\t//#
|
||||
IF_KEYWORD _CFXR_LIGHTING_INDIRECT || _CFXR_LIGHTING_ALL\r\n\t\t_IndirectLightingMix
|
||||
(\"Indirect Lighting Mix\", Range(0,1)) = 0.5\r\n\t//# END_IF\r\n\t\t_ShadowColor
|
||||
(\"Shadow Color\", Color) = (0,0,0,1)\r\n\t//# \r\n\t//# END_IF\r\n\r\n\t//#
|
||||
========================================================\r\n\t//# Shadows\r\n\t//#\r\n\r\n\t\t[KeywordEnum(Off,On,CustomTexture)]
|
||||
_CFXR_DITHERED_SHADOWS (\"Dithered Shadows\", Float) = 0\r\n\t//# IF_KEYWORD
|
||||
_CFXR_DITHERED_SHADOWS_ON || _CFXR_DITHERED_SHADOWS_CUSTOMTEXTURE\r\n\t\t_ShadowStrength\t\t(\"Shadows
|
||||
Strength Max\", Range(0,1)) = 1.0\r\n\t\t//#\tIF_KEYWORD _CFXR_DITHERED_SHADOWS_CUSTOMTEXTURE\r\n\t\t_DitherCustom\t\t(\"Dithering
|
||||
3D Texture\", 3D) = \"black\" {}\r\n\t\t//#\tEND_IF\r\n\t//# END_IF\r\n\r\n//\t\t_ReceivedShadowsStrength
|
||||
(\"Received Shadows Strength\", Range(0,1)) = 0.5\r\n\t}\r\n\t\r\n\tCategory\r\n\t{\r\n\t\tTags\r\n\t\t{\r\n\t\t\t\"Queue\"=\"Transparent\"\r\n\t\t\t\"IgnoreProjector\"=\"True\"\r\n\t\t\t\"RenderType\"=\"Transparent\"\r\n\t\t\t\"PreviewType\"=\"Plane\"\r\n\t\t}\r\n\r\n\t\tBlend
|
||||
[_SrcBlend] [_DstBlend], One One\r\n\t\tZWrite [_ZWrite]\r\n\t\tCull Off\r\n\r\n\t\t//====================================================================================================================================\r\n\t\t//
|
||||
Universal Rendering Pipeline\r\n\r\n\t\tSubshader\r\n\t\t{\r\n\t\t\tPass\r\n\t\t\t{\r\n\t\t\t\tName
|
||||
\"BASE_URP\"\r\n\t\t\t\tTags { \"LightMode\"=\"UniversalForward\" }\r\n\r\n\t\t\t\tCGPROGRAM\r\n\r\n\t\t\t\t#pragma
|
||||
vertex vertex_program\r\n\t\t\t\t#pragma fragment fragment_program\r\n\t\t\t\t\r\n\t\t\t\t#pragma
|
||||
target 2.0\r\n\t\t\t\t\r\n\t\t\t\t// #pragma multi_compile_instancing\r\n\t\t\t\t//
|
||||
#pragma instancing_options procedural:ParticleInstancingSetup\r\n\r\n\t\t\t\t#pragma
|
||||
multi_compile_fog\r\n\t\t\t\t//#pragma multi_compile_fwdbase\r\n\t\t\t\t//#pragma
|
||||
multi_compile SHADOWS_SCREEN\r\n\r\n\t\t\t\t#pragma shader_feature_local _ _CFXR_SINGLE_CHANNEL\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_DISSOLVE\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_DISSOLVE_ALONG_UV_X\r\n\t\t\t\t#pragma shader_feature_local _ _CFXR_UV_DISTORTION\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_UV2_DISTORTION\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_UV_DISTORTION_ADD\r\n\t\t\t\t// #pragma shader_feature_local _ _CFXR_GRADIENTMAP\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_SECONDCOLOR_LERP _CFXR_FONT_COLORS\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_OVERLAYTEX_1X _CFXR_OVERLAYTEX_2X\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_OVERLAYBLEND_A _CFXR_OVERLAYBLEND_RGB\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_HDR_BOOST\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_EDGE_FADING\r\n\t\t\t\t#pragma shader_feature_local _ _CFXR_LIGHTING_DIRECT
|
||||
_CFXR_LIGHTING_INDIRECT _CFXR_LIGHTING_ALL\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_LIGHTING_WPOS_OFFSET\r\n\t\t\t\t#pragma shader_feature_local _ _CFXR_LIGHTING_BACK\r\n\r\n\t\t\t\t//
|
||||
Using the same keywords as Unity's Standard Particle shader to minimize project-wide
|
||||
keyword usage\r\n\t\t\t\t#pragma shader_feature_local _ _NORMALMAP\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _EMISSION\r\n\t\t\t\t#pragma shader_feature_local _ _FLIPBOOK_BLENDING\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _FADING_ON\r\n\t\t\t\t#pragma shader_feature_local _ _ALPHATEST_ON\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON
|
||||
_CFXR_ADDITIVE\r\n\r\n\t\t\t\t#define CFXR_URP\r\n\t\t\t\t#define CFXR_UBERSHADER\r\n\t\t\t\t#include
|
||||
\"CFXR_PASSES.cginc\"\r\n\r\n\t\t\t\tENDCG\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Same
|
||||
as above with 'Universal2D' instead and DISABLE_SOFT_PARTICLES keyword\r\n\t\t\tPass\r\n\t\t\t{\r\n\t\t\t\tName
|
||||
\"BASE_URP\"\r\n\t\t\t\tTags { \"LightMode\"=\"Universal2D\" }\r\n\r\n\t\t\t\tCGPROGRAM\r\n\r\n\t\t\t\t#pragma
|
||||
vertex vertex_program\r\n\t\t\t\t#pragma fragment fragment_program\r\n\t\t\t\t\r\n\t\t\t\t#pragma
|
||||
target 2.0\r\n\t\t\t\t\r\n\t\t\t\t// #pragma multi_compile_instancing\r\n\t\t\t\t//
|
||||
#pragma instancing_options procedural:ParticleInstancingSetup\r\n\r\n\t\t\t\t#pragma
|
||||
multi_compile_fog\r\n\t\t\t\t//#pragma multi_compile_fwdbase\r\n\t\t\t\t//#pragma
|
||||
multi_compile SHADOWS_SCREEN\r\n\r\n\t\t\t\t#pragma shader_feature_local _ _CFXR_SINGLE_CHANNEL\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_DISSOLVE\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_DISSOLVE_ALONG_UV_X\r\n\t\t\t\t#pragma shader_feature_local _ _CFXR_UV_DISTORTION\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_UV2_DISTORTION\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_UV_DISTORTION_ADD\r\n\t\t\t\t// #pragma shader_feature_local _ _CFXR_GRADIENTMAP\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_SECONDCOLOR_LERP _CFXR_FONT_COLORS\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_OVERLAYTEX_1X _CFXR_OVERLAYTEX_2X\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_OVERLAYBLEND_A _CFXR_OVERLAYBLEND_RGB\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_HDR_BOOST\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_EDGE_FADING\r\n\t\t\t\t#pragma shader_feature_local _ _CFXR_LIGHTING_DIRECT
|
||||
_CFXR_LIGHTING_INDIRECT _CFXR_LIGHTING_ALL\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_LIGHTING_WPOS_OFFSET\r\n\t\t\t\t#pragma shader_feature_local _ _CFXR_LIGHTING_BACK\r\n\r\n\t\t\t\t//
|
||||
Using the same keywords as Unity's Standard Particle shader to minimize project-wide
|
||||
keyword usage\r\n\t\t\t\t#pragma shader_feature_local _ _NORMALMAP\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _EMISSION\r\n\t\t\t\t#pragma shader_feature_local _ _FLIPBOOK_BLENDING\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _FADING_ON\r\n\t\t\t\t#pragma shader_feature_local _ _ALPHATEST_ON\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON
|
||||
_CFXR_ADDITIVE\r\n\r\n\t\t\t\t#define CFXR_UPR\r\n\t\t\t\t#define DISABLE_SOFT_PARTICLES\r\n\t\t\t\t#define
|
||||
CFXR_UBERSHADER\r\n\t\t\t\t#include \"CFXR_PASSES.cginc\"\r\n\r\n\t\t\t\tENDCG\r\n\t\t\t}\r\n\r\n\t\t\t//--------------------------------------------------------------------------------------------------------------------------------\r\n\r\n\t\t\tPass\r\n\t\t\t{\r\n\t\t\t\tName
|
||||
\"ShadowCaster\"\r\n\t\t\t\tTags { \"LightMode\" = \"ShadowCaster\" }\r\n\r\n\t\t\t\tBlendOp
|
||||
Add\r\n\t\t\t\tBlend One Zero\r\n\t\t\t\tZWrite On\r\n\t\t\t\tCull Off\r\n\r\n\t\t\t\tCGPROGRAM\r\n\r\n\t\t\t\t#pragma
|
||||
vertex vertex_program\r\n\t\t\t\t#pragma fragment fragment_program\r\n\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_SINGLE_CHANNEL\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_DISSOLVE\r\n\t\t\t\t#pragma shader_feature_local _ _CFXR_DISSOLVE_ALONG_UV_X\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_UV_DISTORTION\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_UV2_DISTORTION\r\n\t\t\t\t#pragma shader_feature_local _ _CFXR_UV_DISTORTION_ADD\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_OVERLAYTEX_1X _CFXR_OVERLAYTEX_2X\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_OVERLAYBLEND_A _CFXR_OVERLAYBLEND_RGB\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _FLIPBOOK_BLENDING\r\n\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _ALPHATEST_ON\r\n\t\t\t\t#pragma shader_feature_local _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
|
||||
_ALPHAMODULATE_ON _CFXR_ADDITIVE\r\n\r\n\t\t\t\t#pragma multi_compile_shadowcaster\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_DITHERED_SHADOWS_ON _CFXR_DITHERED_SHADOWS_CUSTOMTEXTURE\r\n\r\n\t\t\t#if
|
||||
(_CFXR_DITHERED_SHADOWS_ON || _CFXR_DITHERED_SHADOWS_CUSTOMTEXTURE) && !defined(SHADER_API_GLES)\r\n\t\t\t\t#pragma
|
||||
target 3.0\t\t//needed for VPOS\r\n\t\t\t#endif\r\n\r\n\t\t\t\t#define CFXR_UPR\r\n\t\t\t\t#define
|
||||
PASS_SHADOW_CASTER\r\n\t\t\t\t#define CFXR_UBERSHADER\r\n\t\t\t\t#include \"CFXR_PASSES.cginc\"\r\n\r\n\t\t\t\tENDCG\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//====================================================================================================================================\r\n\t\t//
|
||||
Built-in Rendering Pipeline\r\n\r\n\t\tSubShader\r\n\t\t{\r\n\t\t\tPass\r\n\t\t\t{\r\n\t\t\t\tName
|
||||
\"BASE\"\r\n\t\t\t\tTags { \"LightMode\"=\"ForwardBase\" }\r\n\r\n\t\t\t\tCGPROGRAM\r\n\r\n\t\t\t\t#pragma
|
||||
vertex vertex_program\r\n\t\t\t\t#pragma fragment fragment_program\r\n\r\n\t\t\t\t//vertInstancingSetup
|
||||
writes to global, not allowed with DXC\r\n\t\t\t\t// #pragma never_use_dxc\r\n\t\t\t\t//
|
||||
#pragma target 2.5\r\n\t\t\t\t// #pragma multi_compile_instancing\r\n\t\t\t\t//
|
||||
#pragma instancing_options procedural:vertInstancingSetup\r\n\r\n\t\t\t\t#pragma
|
||||
multi_compile_particles\r\n\t\t\t\t#pragma multi_compile_fog\r\n\t\t\t\t//#pragma
|
||||
multi_compile_fwdbase\r\n\t\t\t\t//#pragma multi_compile SHADOWS_SCREEN\r\n\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_SINGLE_CHANNEL\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_DISSOLVE\r\n\t\t\t\t#pragma shader_feature_local _ _CFXR_DISSOLVE_ALONG_UV_X\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_UV_DISTORTION\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_UV2_DISTORTION\r\n\t\t\t\t#pragma shader_feature_local _ _CFXR_UV_DISTORTION_ADD\r\n\t\t\t\t//
|
||||
#pragma shader_feature_local _ _CFXR_GRADIENTMAP\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_SECONDCOLOR_LERP _CFXR_FONT_COLORS\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_OVERLAYTEX_1X _CFXR_OVERLAYTEX_2X\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_OVERLAYBLEND_A _CFXR_OVERLAYBLEND_RGB\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_HDR_BOOST\r\n\t\t\t\t#pragma shader_feature_local _ _CFXR_EDGE_FADING\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_LIGHTING_DIRECT _CFXR_LIGHTING_INDIRECT _CFXR_LIGHTING_ALL\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_LIGHTING_WPOS_OFFSET\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_LIGHTING_BACK\r\n\r\n\t\t\t\t// Using the same keywords as Unity's Standard
|
||||
Particle shader to minimize project-wide keyword usage\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _NORMALMAP\r\n\t\t\t\t#pragma shader_feature_local _ _EMISSION\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _FLIPBOOK_BLENDING\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _FADING_ON\r\n\t\t\t\t#pragma shader_feature_local _ _ALPHATEST_ON\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON
|
||||
_CFXR_ADDITIVE\r\n\r\n\t\t\t\t#include \"UnityStandardParticleInstancing.cginc\"\r\n\t\t\t\t#define
|
||||
CFXR_UBERSHADER\r\n\t\t\t\t#include \"CFXR_PASSES.cginc\"\r\n\r\n\t\t\t\tENDCG\r\n\t\t\t}\r\n\r\n\t\t\t//--------------------------------------------------------------------------------------------------------------------------------\r\n\r\n\t\t\tPass\r\n\t\t\t{\r\n\t\t\t\tName
|
||||
\"ShadowCaster\"\r\n\t\t\t\tTags { \"LightMode\" = \"ShadowCaster\" }\r\n\r\n\t\t\t\tBlendOp
|
||||
Add\r\n\t\t\t\tBlend One Zero\r\n\t\t\t\tZWrite On\r\n\t\t\t\tCull Off\r\n\r\n\t\t\t\tCGPROGRAM\r\n\r\n\t\t\t\t#pragma
|
||||
vertex vertex_program\r\n\t\t\t\t#pragma fragment fragment_program\r\n\r\n\t\t\t\t//vertInstancingSetup
|
||||
writes to global, not allowed with DXC\r\n\t\t\t\t// #pragma never_use_dxc\r\n\t\t\t\t//
|
||||
#pragma target 2.5\r\n\t\t\t\t// #pragma multi_compile_instancing\r\n\t\t\t\t//
|
||||
#pragma instancing_options procedural:vertInstancingSetup\r\n\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_SINGLE_CHANNEL\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_DISSOLVE\r\n\t\t\t\t#pragma shader_feature_local _ _CFXR_DISSOLVE_ALONG_UV_X\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_UV_DISTORTION\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _CFXR_UV2_DISTORTION\r\n\t\t\t\t#pragma shader_feature_local _ _CFXR_UV_DISTORTION_ADD\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_OVERLAYTEX_1X _CFXR_OVERLAYTEX_2X\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_OVERLAYBLEND_A _CFXR_OVERLAYBLEND_RGB\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _FLIPBOOK_BLENDING\r\n\r\n\t\t\t\t#pragma shader_feature_local
|
||||
_ _ALPHATEST_ON\r\n\t\t\t\t#pragma shader_feature_local _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
|
||||
_ALPHAMODULATE_ON _CFXR_ADDITIVE\r\n\r\n\t\t\t\t#pragma multi_compile_shadowcaster\r\n\t\t\t\t#pragma
|
||||
shader_feature_local _ _CFXR_DITHERED_SHADOWS_ON _CFXR_DITHERED_SHADOWS_CUSTOMTEXTURE\r\n\r\n\t\t\t#if
|
||||
(_CFXR_DITHERED_SHADOWS_ON || _CFXR_DITHERED_SHADOWS_CUSTOMTEXTURE) && !defined(SHADER_API_GLES)\r\n\t\t\t\t#pragma
|
||||
target 3.0\t\t//needed for VPOS\r\n\t\t\t#endif\r\n\r\n\t\t\t\t#include \"UnityStandardParticleInstancing.cginc\"\r\n\r\n\t\t\t\t#define
|
||||
PASS_SHADOW_CASTER\r\n\t\t\t\t#define CFXR_UBERSHADER\r\n\t\t\t\t#include \"CFXR_PASSES.cginc\"\r\n\r\n\t\t\t\tENDCG\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tCustomEditor
|
||||
\"CartoonFX.MaterialInspector\"\r\n}\r\n\r\n"
|
||||
shaderName: Cartoon FX/Remaster/Particle Ubershader
|
||||
shaderErrors: []
|
||||
variantCount: 283253760
|
||||
variantCountUsed: 8
|
@ -0,0 +1,366 @@
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
// Cartoon FX
|
||||
// (c) 2012-2020 Jean Moreno
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#if defined(UNITY_PARTICLE_INSTANCING_ENABLED)
|
||||
#pragma exclude_renderers gles
|
||||
#endif
|
||||
|
||||
#if defined(GLOBAL_DISABLE_SOFT_PARTICLES) && !defined(DISABLE_SOFT_PARTICLES)
|
||||
#define DISABLE_SOFT_PARTICLES
|
||||
#endif
|
||||
|
||||
#if defined(CFXR_URP)
|
||||
float LinearEyeDepthURP(float depth, float4 zBufferParam)
|
||||
{
|
||||
return 1.0 / (zBufferParam.z * depth + zBufferParam.w);
|
||||
}
|
||||
|
||||
float SoftParticles(float near, float far, float4 projection)
|
||||
{
|
||||
float sceneZ = SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(projection)).r;
|
||||
|
||||
if (unity_OrthoParams.w == 1)
|
||||
{
|
||||
// orthographic camera
|
||||
#if defined(UNITY_REVERSED_Z)
|
||||
sceneZ = 1.0f - sceneZ;
|
||||
#endif
|
||||
sceneZ = (sceneZ * _ProjectionParams.z) + _ProjectionParams.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
// perspective camera
|
||||
sceneZ = LinearEyeDepthURP(sceneZ, _ZBufferParams);
|
||||
}
|
||||
|
||||
float fade = saturate (far * ((sceneZ - near) - projection.z));
|
||||
return fade;
|
||||
}
|
||||
#else
|
||||
float SoftParticles(float near, float far, float4 projection)
|
||||
{
|
||||
float sceneZ = (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(projection)));
|
||||
if (unity_OrthoParams.w == 1)
|
||||
{
|
||||
// orthographic camera
|
||||
#if defined(UNITY_REVERSED_Z)
|
||||
sceneZ = 1.0f - sceneZ;
|
||||
#endif
|
||||
sceneZ = (sceneZ * _ProjectionParams.z) + _ProjectionParams.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
// perspective camera
|
||||
sceneZ = LinearEyeDepth(sceneZ);
|
||||
}
|
||||
|
||||
float fade = saturate (far * ((sceneZ - near) - projection.z));
|
||||
return fade;
|
||||
}
|
||||
#endif
|
||||
|
||||
float LinearToGammaSpaceApprox(float value)
|
||||
{
|
||||
return max(1.055h * pow(value, 0.416666667h) - 0.055h, 0.h);
|
||||
}
|
||||
|
||||
// Same as UnityStandardUtils.cginc, but without the SHADER_TARGET limitation
|
||||
half3 UnpackScaleNormal_CFXR(half4 packednormal, half bumpScale)
|
||||
{
|
||||
#if defined(UNITY_NO_DXT5nm)
|
||||
half3 normal = packednormal.xyz * 2 - 1;
|
||||
// #if (SHADER_TARGET >= 30)
|
||||
// SM2.0: instruction count limitation
|
||||
// SM2.0: normal scaler is not supported
|
||||
normal.xy *= bumpScale;
|
||||
// #endif
|
||||
return normal;
|
||||
#else
|
||||
// This do the trick
|
||||
packednormal.x *= packednormal.w;
|
||||
|
||||
half3 normal;
|
||||
normal.xy = (packednormal.xy * 2 - 1);
|
||||
// #if (SHADER_TARGET >= 30)
|
||||
// SM2.0: instruction count limitation
|
||||
// SM2.0: normal scaler is not supported
|
||||
normal.xy *= bumpScale;
|
||||
// #endif
|
||||
normal.z = sqrt(1.0 - saturate(dot(normal.xy, normal.xy)));
|
||||
return normal;
|
||||
#endif
|
||||
}
|
||||
|
||||
//Macros
|
||||
|
||||
// Project Position
|
||||
#if !defined(PASS_SHADOW_CASTER) && !defined(GLOBAL_DISABLE_SOFT_PARTICLES) && !defined(DISABLE_SOFT_PARTICLES) && ( (defined(SOFTPARTICLES_ON) || defined(CFXR_URP) || defined(SOFT_PARTICLES_ORTHOGRAPHIC)) && defined(_FADING_ON) )
|
||||
#define vertProjPos(o, clipPos) \
|
||||
o.projPos = ComputeScreenPos(clipPos); \
|
||||
COMPUTE_EYEDEPTH(o.projPos.z);
|
||||
#else
|
||||
#define vertProjPos(o, clipPos)
|
||||
#endif
|
||||
|
||||
// Soft Particles
|
||||
#if !defined(PASS_SHADOW_CASTER) && !defined(GLOBAL_DISABLE_SOFT_PARTICLES) && !defined(DISABLE_SOFT_PARTICLES) && ((defined(SOFTPARTICLES_ON) || defined(CFXR_URP) || defined(SOFT_PARTICLES_ORTHOGRAPHIC)) && defined(_FADING_ON))
|
||||
#define fragSoftParticlesFade(i, color) \
|
||||
color *= SoftParticles(_SoftParticlesFadeDistanceNear, _SoftParticlesFadeDistanceFar, i.projPos);
|
||||
#else
|
||||
#define fragSoftParticlesFade(i, color)
|
||||
#endif
|
||||
|
||||
// Edge fade (note: particle meshes are already in world space)
|
||||
#if !defined(PASS_SHADOW_CASTER) && defined(_CFXR_EDGE_FADING)
|
||||
#define vertEdgeFade(v, color) \
|
||||
float3 viewDir = UnityWorldSpaceViewDir(v.vertex); \
|
||||
float ndv = abs(dot(normalize(viewDir), v.normal.xyz)); \
|
||||
color *= saturate(pow(ndv, _EdgeFadePow));
|
||||
#else
|
||||
#define vertEdgeFade(v, color)
|
||||
#endif
|
||||
|
||||
// Fog
|
||||
#if _ALPHABLEND_ON
|
||||
#define applyFog(i, color, alpha) UNITY_APPLY_FOG_COLOR(i.fogCoord, color, unity_FogColor);
|
||||
#elif _ALPHAPREMULTIPLY_ON
|
||||
#define applyFog(i, color, alpha) UNITY_APPLY_FOG_COLOR(i.fogCoord, color, alpha * unity_FogColor);
|
||||
#elif _CFXR_ADDITIVE
|
||||
#define applyFog(i, color, alpha) UNITY_APPLY_FOG_COLOR(i.fogCoord, color, half4(0, 0, 0, 0));
|
||||
#elif _ALPHAMODULATE_ON
|
||||
#define applyFog(i, color, alpha) UNITY_APPLY_FOG_COLOR(i.fogCoord, color, half4(1, 1, 1, 1));
|
||||
#else
|
||||
#define applyFog(i, color, alpha) UNITY_APPLY_FOG_COLOR(i.fogCoord, color, unity_FogColor);
|
||||
#endif
|
||||
|
||||
// Vertex program
|
||||
#if defined(PASS_SHADOW_CASTER)
|
||||
void vert(appdata v, v2f_shadowCaster o, out float4 opos)
|
||||
#else
|
||||
v2f vert(appdata v, v2f o)
|
||||
#endif
|
||||
{
|
||||
UNITY_TRANSFER_FOG(o, o.pos);
|
||||
vertProjPos(o, o.pos);
|
||||
vertEdgeFade(v, o.color.a);
|
||||
|
||||
#if defined(PASS_SHADOW_CASTER)
|
||||
TRANSFER_SHADOW_CASTER_NOPOS(o, opos);
|
||||
#else
|
||||
return o;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Fragment program
|
||||
#if defined(PASS_SHADOW_CASTER)
|
||||
float4 frag(v2f_shadowCaster i, UNITY_VPOS_TYPE vpos, half3 particleColor, half particleAlpha, half dissolve, half dissolveTime, half doubleDissolveWidth) : SV_Target
|
||||
#else
|
||||
half4 frag(v2f i, half3 particleColor, half particleAlpha, half dissolve, half dissolveTime, half doubleDissolveWidth) : SV_Target
|
||||
#endif
|
||||
{
|
||||
#if _CFXR_DISSOLVE
|
||||
// Dissolve
|
||||
half time = lerp(-_DissolveSmooth, 1+_DissolveSmooth, dissolveTime);
|
||||
particleAlpha *= smoothstep(dissolve - _DissolveSmooth, dissolve + _DissolveSmooth, time);
|
||||
if (doubleDissolveWidth > 0)
|
||||
{
|
||||
half dissolveSubtract = smoothstep(dissolve - _DissolveSmooth, dissolve + _DissolveSmooth, time - doubleDissolveWidth);
|
||||
particleAlpha = saturate(particleAlpha - dissolveSubtract);
|
||||
}
|
||||
#endif
|
||||
|
||||
//Blending
|
||||
#if _ALPHAPREMULTIPLY_ON
|
||||
particleColor *= particleAlpha;
|
||||
#endif
|
||||
#if _ALPHAMODULATE_ON
|
||||
particleColor.rgb = lerp(float3(1,1,1), particleColor.rgb, particleAlpha);
|
||||
#endif
|
||||
|
||||
#if _ALPHATEST_ON
|
||||
clip(particleAlpha - _Cutoff);
|
||||
#endif
|
||||
|
||||
#if !defined(PASS_SHADOW_CASTER)
|
||||
// Fog & Soft Particles
|
||||
applyFog(i, particleColor, particleAlpha);
|
||||
fragSoftParticlesFade(i, particleAlpha);
|
||||
#endif
|
||||
|
||||
// Prevent alpha from exceeding 1
|
||||
particleAlpha = min(particleAlpha, 1.0);
|
||||
|
||||
#if !defined(PASS_SHADOW_CASTER)
|
||||
return float4(particleColor, particleAlpha);
|
||||
#else
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
// Shadow Caster Pass
|
||||
|
||||
#if _CFXR_ADDITIVE
|
||||
half alpha = max(particleColor.r, max(particleColor.g, particleColor.b)) * particleAlpha;
|
||||
#else
|
||||
half alpha = particleAlpha;
|
||||
#endif
|
||||
|
||||
#if (_CFXR_DITHERED_SHADOWS_ON || _CFXR_DITHERED_SHADOWS_CUSTOMTEXTURE) && !defined(SHADER_API_GLES)
|
||||
alpha = min(alpha, _ShadowStrength);
|
||||
// Use dither mask for alpha blended shadows, based on pixel position xy
|
||||
// and alpha level. Our dither texture is 4x4x16.
|
||||
#if _CFXR_DITHERED_SHADOWS_CUSTOMTEXTURE
|
||||
half texSize = _DitherCustom_TexelSize.z;
|
||||
alpha = tex3D(_DitherCustom, float3(vpos.xy*(1 / texSize), alpha*(1 - (1 / (texSize*texSize))))).a;
|
||||
#else
|
||||
alpha = tex3D(_DitherMaskLOD, float3(vpos.xy*0.25, alpha*0.9375)).a;
|
||||
#endif
|
||||
#endif
|
||||
clip(alpha - 0.01);
|
||||
SHADOW_CASTER_FRAGMENT(i)
|
||||
#endif
|
||||
}
|
||||
|
||||
// ================================================================================================================================
|
||||
// ParticlesInstancing.hlsl
|
||||
// ================================================================================================================================
|
||||
|
||||
#if defined(CFXR_URP)
|
||||
#if defined(UNITY_PROCEDURAL_INSTANCING_ENABLED) && !defined(SHADER_TARGET_SURFACE_ANALYSIS)
|
||||
#define UNITY_PARTICLE_INSTANCING_ENABLED
|
||||
#endif
|
||||
|
||||
#if defined(UNITY_PARTICLE_INSTANCING_ENABLED)
|
||||
|
||||
#ifndef UNITY_PARTICLE_INSTANCE_DATA
|
||||
#define UNITY_PARTICLE_INSTANCE_DATA DefaultParticleInstanceData
|
||||
#endif
|
||||
|
||||
struct DefaultParticleInstanceData
|
||||
{
|
||||
float3x4 transform;
|
||||
uint color;
|
||||
float animFrame;
|
||||
};
|
||||
|
||||
StructuredBuffer<UNITY_PARTICLE_INSTANCE_DATA> unity_ParticleInstanceData;
|
||||
float4 unity_ParticleUVShiftData;
|
||||
float unity_ParticleUseMeshColors;
|
||||
|
||||
void ParticleInstancingMatrices(out float4x4 objectToWorld, out float4x4 worldToObject)
|
||||
{
|
||||
UNITY_PARTICLE_INSTANCE_DATA data = unity_ParticleInstanceData[unity_InstanceID];
|
||||
|
||||
// transform matrix
|
||||
objectToWorld._11_21_31_41 = float4(data.transform._11_21_31, 0.0f);
|
||||
objectToWorld._12_22_32_42 = float4(data.transform._12_22_32, 0.0f);
|
||||
objectToWorld._13_23_33_43 = float4(data.transform._13_23_33, 0.0f);
|
||||
objectToWorld._14_24_34_44 = float4(data.transform._14_24_34, 1.0f);
|
||||
|
||||
// inverse transform matrix (TODO: replace with a library implementation if/when available)
|
||||
float3x3 worldToObject3x3;
|
||||
worldToObject3x3[0] = objectToWorld[1].yzx * objectToWorld[2].zxy - objectToWorld[1].zxy * objectToWorld[2].yzx;
|
||||
worldToObject3x3[1] = objectToWorld[0].zxy * objectToWorld[2].yzx - objectToWorld[0].yzx * objectToWorld[2].zxy;
|
||||
worldToObject3x3[2] = objectToWorld[0].yzx * objectToWorld[1].zxy - objectToWorld[0].zxy * objectToWorld[1].yzx;
|
||||
|
||||
float det = dot(objectToWorld[0].xyz, worldToObject3x3[0]);
|
||||
|
||||
worldToObject3x3 = transpose(worldToObject3x3);
|
||||
|
||||
worldToObject3x3 *= rcp(det);
|
||||
|
||||
float3 worldToObjectPosition = mul(worldToObject3x3, -objectToWorld._14_24_34);
|
||||
|
||||
worldToObject._11_21_31_41 = float4(worldToObject3x3._11_21_31, 0.0f);
|
||||
worldToObject._12_22_32_42 = float4(worldToObject3x3._12_22_32, 0.0f);
|
||||
worldToObject._13_23_33_43 = float4(worldToObject3x3._13_23_33, 0.0f);
|
||||
worldToObject._14_24_34_44 = float4(worldToObjectPosition, 1.0f);
|
||||
}
|
||||
|
||||
void ParticleInstancingSetup()
|
||||
{
|
||||
ParticleInstancingMatrices(unity_ObjectToWorld, unity_WorldToObject);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void ParticleInstancingSetup() {}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// ================================================================================================================================
|
||||
// Instancing functions
|
||||
// ================================================================================================================================
|
||||
|
||||
float4 UnpackFromR8G8B8A8(uint rgba)
|
||||
{
|
||||
return float4(rgba & 255, (rgba >> 8) & 255, (rgba >> 16) & 255, (rgba >> 24) & 255) * (1.0 / 255);
|
||||
}
|
||||
|
||||
half4 GetParticleColor(half4 color)
|
||||
{
|
||||
#if defined(UNITY_PARTICLE_INSTANCING_ENABLED)
|
||||
#if !defined(UNITY_PARTICLE_INSTANCE_DATA_NO_COLOR)
|
||||
UNITY_PARTICLE_INSTANCE_DATA data = unity_ParticleInstanceData[unity_InstanceID];
|
||||
color = lerp(half4(1.0, 1.0, 1.0, 1.0), color, unity_ParticleUseMeshColors);
|
||||
color *= UnpackFromR8G8B8A8(data.color);
|
||||
#endif
|
||||
#endif
|
||||
return color;
|
||||
}
|
||||
|
||||
void GetParticleTexcoords(out float2 outputTexcoord, out float2 outputTexcoord2, inout float outputBlend, in float4 inputTexcoords, in float inputBlend)
|
||||
{
|
||||
#if defined(UNITY_PARTICLE_INSTANCING_ENABLED)
|
||||
if (unity_ParticleUVShiftData.x != 0.0)
|
||||
{
|
||||
UNITY_PARTICLE_INSTANCE_DATA data = unity_ParticleInstanceData[unity_InstanceID];
|
||||
|
||||
float numTilesX = unity_ParticleUVShiftData.y;
|
||||
float2 animScale = unity_ParticleUVShiftData.zw;
|
||||
#ifdef UNITY_PARTICLE_INSTANCE_DATA_NO_ANIM_FRAME
|
||||
float sheetIndex = 0.0;
|
||||
#else
|
||||
float sheetIndex = data.animFrame;
|
||||
#endif
|
||||
|
||||
float index0 = floor(sheetIndex);
|
||||
float vIdx0 = floor(index0 / numTilesX);
|
||||
float uIdx0 = floor(index0 - vIdx0 * numTilesX);
|
||||
float2 offset0 = float2(uIdx0 * animScale.x, (1.0 - animScale.y) - vIdx0 * animScale.y); // Copied from built-in as is and it looks like upside-down flip
|
||||
|
||||
outputTexcoord = inputTexcoords.xy * animScale.xy + offset0.xy;
|
||||
|
||||
#ifdef _FLIPBOOKBLENDING_ON
|
||||
float index1 = floor(sheetIndex + 1.0);
|
||||
float vIdx1 = floor(index1 / numTilesX);
|
||||
float uIdx1 = floor(index1 - vIdx1 * numTilesX);
|
||||
float2 offset1 = float2(uIdx1 * animScale.x, (1.0 - animScale.y) - vIdx1 * animScale.y);
|
||||
|
||||
outputTexcoord2.xy = inputTexcoords.xy * animScale.xy + offset1.xy;
|
||||
outputBlend = frac(sheetIndex);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
outputTexcoord = inputTexcoords.xy;
|
||||
#ifdef _FLIPBOOKBLENDING_ON
|
||||
outputTexcoord2.xy = inputTexcoords.zw;
|
||||
outputBlend = inputBlend;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _FLIPBOOKBLENDING_ON
|
||||
outputTexcoord2.xy = inputTexcoords.xy;
|
||||
//outputBlend = 0.5;
|
||||
#endif
|
||||
}
|
||||
|
||||
void GetParticleTexcoords(out float2 outputTexcoord, in float2 inputTexcoord)
|
||||
{
|
||||
float2 dummyTexcoord2 = 0.0;
|
||||
float dummyBlend = 0.0;
|
||||
GetParticleTexcoords(outputTexcoord, dummyTexcoord2, dummyBlend, inputTexcoord.xyxy, 0.0);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3dab2eb6bcf5df42a6c45d4638e0f46
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0abf89ecb90eb024cbbc2a2dee76edf1
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,22 @@
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
// Cartoon FX
|
||||
// (c) 2012-2020 Jean Moreno
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Global settings for the Cartoon FX Remaster shaders
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/* Uncomment this line if you want to globally disable soft particles */
|
||||
// #define GLOBAL_DISABLE_SOFT_PARTICLES
|
||||
|
||||
/* Change this value if you want to globally scale the HDR effects */
|
||||
/* (e.g. if your bloom effect is too strong or too weak on the effects) */
|
||||
#define GLOBAL_HDR_MULTIPLIER 1
|
||||
|
||||
/* Comment this line if you want to disable point lights for lit particles */
|
||||
#define ENABLE_POINT_LIGHTS
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 12c0fc6ff46c9b64a99fb4b921970883
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,232 @@
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
// Cartoon FX
|
||||
// (c) 2012-2020 Jean Moreno
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Copy of URP specific variables needed for lighting
|
||||
|
||||
// ================================================================================================================================
|
||||
// Input.hlsl:
|
||||
// ================================================================================================================================
|
||||
|
||||
#if defined(SHADER_API_MOBILE) || (defined(SHADER_API_GLCORE) && !defined(SHADER_API_SWITCH)) || defined(SHADER_API_GLES) || defined(SHADER_API_GLES3) // Workaround for bug on Nintendo Switch where SHADER_API_GLCORE is mistakenly defined
|
||||
#define MAX_VISIBLE_LIGHTS 32
|
||||
#else
|
||||
#define MAX_VISIBLE_LIGHTS 256
|
||||
#endif
|
||||
|
||||
// --------------------------------
|
||||
|
||||
float4 _MainLightPosition;
|
||||
half4 _MainLightColor;
|
||||
|
||||
// --------------------------------
|
||||
|
||||
half4 _AdditionalLightsCount;
|
||||
#if USE_STRUCTURED_BUFFER_FOR_LIGHT_DATA
|
||||
StructuredBuffer<LightData> _AdditionalLightsBuffer;
|
||||
StructuredBuffer<int> _AdditionalLightsIndices;
|
||||
#else
|
||||
// GLES3 causes a performance regression in some devices when using CBUFFER.
|
||||
#ifndef SHADER_API_GLES3
|
||||
CBUFFER_START(AdditionalLights)
|
||||
#endif
|
||||
float4 _AdditionalLightsPosition[MAX_VISIBLE_LIGHTS];
|
||||
half4 _AdditionalLightsColor[MAX_VISIBLE_LIGHTS];
|
||||
half4 _AdditionalLightsAttenuation[MAX_VISIBLE_LIGHTS];
|
||||
half4 _AdditionalLightsSpotDir[MAX_VISIBLE_LIGHTS];
|
||||
half4 _AdditionalLightsOcclusionProbes[MAX_VISIBLE_LIGHTS];
|
||||
#ifndef SHADER_API_GLES3
|
||||
CBUFFER_END
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// ================================================================================================================================
|
||||
// UnityInput.hlsl:
|
||||
// ================================================================================================================================
|
||||
|
||||
half4 unity_LightData;
|
||||
half4 unity_LightIndices[2];
|
||||
|
||||
// --------------------------------
|
||||
|
||||
// ================================================================================================================================
|
||||
// Macros.hlsl
|
||||
// ================================================================================================================================
|
||||
|
||||
#define HALF_MIN 6.103515625e-5 // 2^-14, the same value for 10, 11 and 16-bit: https://www.khronos.org/opengl/wiki/Small_Float_Formats
|
||||
|
||||
// ================================================================================================================================
|
||||
// Lighting.hlsl
|
||||
// ================================================================================================================================
|
||||
|
||||
// Abstraction over Light shading data.
|
||||
struct Light
|
||||
{
|
||||
half3 direction;
|
||||
half3 color;
|
||||
half distanceAttenuation;
|
||||
half shadowAttenuation;
|
||||
};
|
||||
|
||||
// Matches Unity Vanila attenuation
|
||||
// Attenuation smoothly decreases to light range.
|
||||
float DistanceAttenuation(float distanceSqr, half2 distanceAttenuation)
|
||||
{
|
||||
// We use a shared distance attenuation for additional directional and puctual lights
|
||||
// for directional lights attenuation will be 1
|
||||
float lightAtten = rcp(distanceSqr);
|
||||
|
||||
#if SHADER_HINT_NICE_QUALITY
|
||||
// Use the smoothing factor also used in the Unity lightmapper.
|
||||
half factor = distanceSqr * distanceAttenuation.x;
|
||||
half smoothFactor = saturate(1.0h - factor * factor);
|
||||
smoothFactor = smoothFactor * smoothFactor;
|
||||
#else
|
||||
// We need to smoothly fade attenuation to light range. We start fading linearly at 80% of light range
|
||||
// Therefore:
|
||||
// fadeDistance = (0.8 * 0.8 * lightRangeSq)
|
||||
// smoothFactor = (lightRangeSqr - distanceSqr) / (lightRangeSqr - fadeDistance)
|
||||
// We can rewrite that to fit a MAD by doing
|
||||
// distanceSqr * (1.0 / (fadeDistanceSqr - lightRangeSqr)) + (-lightRangeSqr / (fadeDistanceSqr - lightRangeSqr)
|
||||
// distanceSqr * distanceAttenuation.y + distanceAttenuation.z
|
||||
half smoothFactor = saturate(distanceSqr * distanceAttenuation.x + distanceAttenuation.y);
|
||||
#endif
|
||||
|
||||
return lightAtten * smoothFactor;
|
||||
}
|
||||
|
||||
half AngleAttenuation(half3 spotDirection, half3 lightDirection, half2 spotAttenuation)
|
||||
{
|
||||
// Spot Attenuation with a linear falloff can be defined as
|
||||
// (SdotL - cosOuterAngle) / (cosInnerAngle - cosOuterAngle)
|
||||
// This can be rewritten as
|
||||
// invAngleRange = 1.0 / (cosInnerAngle - cosOuterAngle)
|
||||
// SdotL * invAngleRange + (-cosOuterAngle * invAngleRange)
|
||||
// SdotL * spotAttenuation.x + spotAttenuation.y
|
||||
|
||||
// If we precompute the terms in a MAD instruction
|
||||
half SdotL = dot(spotDirection, lightDirection);
|
||||
half atten = saturate(SdotL * spotAttenuation.x + spotAttenuation.y);
|
||||
return atten * atten;
|
||||
}
|
||||
|
||||
// Fills a light struct given a perObjectLightIndex
|
||||
Light GetAdditionalPerObjectLight(int perObjectLightIndex, float3 positionWS)
|
||||
{
|
||||
// Abstraction over Light input constants
|
||||
#if USE_STRUCTURED_BUFFER_FOR_LIGHT_DATA
|
||||
float4 lightPositionWS = _AdditionalLightsBuffer[perObjectLightIndex].position;
|
||||
half3 color = _AdditionalLightsBuffer[perObjectLightIndex].color.rgb;
|
||||
half4 distanceAndSpotAttenuation = _AdditionalLightsBuffer[perObjectLightIndex].attenuation;
|
||||
half4 spotDirection = _AdditionalLightsBuffer[perObjectLightIndex].spotDirection;
|
||||
half4 lightOcclusionProbeInfo = _AdditionalLightsBuffer[perObjectLightIndex].occlusionProbeChannels;
|
||||
#else
|
||||
float4 lightPositionWS = _AdditionalLightsPosition[perObjectLightIndex];
|
||||
half3 color = _AdditionalLightsColor[perObjectLightIndex].rgb;
|
||||
half4 distanceAndSpotAttenuation = _AdditionalLightsAttenuation[perObjectLightIndex];
|
||||
half4 spotDirection = _AdditionalLightsSpotDir[perObjectLightIndex];
|
||||
half4 lightOcclusionProbeInfo = _AdditionalLightsOcclusionProbes[perObjectLightIndex];
|
||||
#endif
|
||||
|
||||
// Directional lights store direction in lightPosition.xyz and have .w set to 0.0.
|
||||
// This way the following code will work for both directional and punctual lights.
|
||||
float3 lightVector = lightPositionWS.xyz - positionWS * lightPositionWS.w;
|
||||
float distanceSqr = max(dot(lightVector, lightVector), HALF_MIN);
|
||||
|
||||
half3 lightDirection = half3(lightVector * rsqrt(distanceSqr));
|
||||
half attenuation = DistanceAttenuation(distanceSqr, distanceAndSpotAttenuation.xy) * AngleAttenuation(spotDirection.xyz, lightDirection, distanceAndSpotAttenuation.zw);
|
||||
|
||||
Light light;
|
||||
light.direction = lightDirection;
|
||||
light.distanceAttenuation = attenuation;
|
||||
/// light.shadowAttenuation = AdditionalLightRealtimeShadow(perObjectLightIndex, positionWS);
|
||||
light.shadowAttenuation = 1;
|
||||
light.color = color;
|
||||
|
||||
// In case we're using light probes, we can sample the attenuation from the `unity_ProbesOcclusion`
|
||||
#if defined(LIGHTMAP_ON) || defined(_MIXED_LIGHTING_SUBTRACTIVE)
|
||||
// First find the probe channel from the light.
|
||||
// Then sample `unity_ProbesOcclusion` for the baked occlusion.
|
||||
// If the light is not baked, the channel is -1, and we need to apply no occlusion.
|
||||
|
||||
// probeChannel is the index in 'unity_ProbesOcclusion' that holds the proper occlusion value.
|
||||
int probeChannel = lightOcclusionProbeInfo.x;
|
||||
|
||||
// lightProbeContribution is set to 0 if we are indeed using a probe, otherwise set to 1.
|
||||
half lightProbeContribution = lightOcclusionProbeInfo.y;
|
||||
|
||||
half probeOcclusionValue = unity_ProbesOcclusion[probeChannel];
|
||||
light.distanceAttenuation *= max(probeOcclusionValue, lightProbeContribution);
|
||||
#endif
|
||||
|
||||
return light;
|
||||
}
|
||||
|
||||
uint GetPerObjectLightIndexOffset()
|
||||
{
|
||||
#if USE_STRUCTURED_BUFFER_FOR_LIGHT_DATA
|
||||
return unity_LightData.x;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Returns a per-object index given a loop index.
|
||||
// This abstract the underlying data implementation for storing lights/light indices
|
||||
int GetPerObjectLightIndex(uint index)
|
||||
{
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Structured Buffer Path /
|
||||
// /
|
||||
// Lights and light indices are stored in StructuredBuffer. We can just index them. /
|
||||
// Currently all non-mobile platforms take this path :( /
|
||||
// There are limitation in mobile GPUs to use SSBO (performance / no vertex shader support) /
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if USE_STRUCTURED_BUFFER_FOR_LIGHT_DATA
|
||||
uint offset = unity_LightData.x;
|
||||
return _AdditionalLightsIndices[offset + index];
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UBO path /
|
||||
// /
|
||||
// We store 8 light indices in float4 unity_LightIndices[2]; /
|
||||
// Due to memory alignment unity doesn't support int[] or float[] /
|
||||
// Even trying to reinterpret cast the unity_LightIndices to float[] won't work /
|
||||
// it will cast to float4[] and create extra register pressure. :( /
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif !defined(SHADER_API_GLES)
|
||||
// since index is uint shader compiler will implement
|
||||
// div & mod as bitfield ops (shift and mask).
|
||||
|
||||
// TODO: Can we index a float4? Currently compiler is
|
||||
// replacing unity_LightIndicesX[i] with a dp4 with identity matrix.
|
||||
// u_xlat16_40 = dot(unity_LightIndices[int(u_xlatu13)], ImmCB_0_0_0[u_xlati1]);
|
||||
// This increases both arithmetic and register pressure.
|
||||
return unity_LightIndices[index / 4][index % 4];
|
||||
#else
|
||||
// Fallback to GLES2. No bitfield magic here :(.
|
||||
// We limit to 4 indices per object and only sample unity_4LightIndices0.
|
||||
// Conditional moves are branch free even on mali-400
|
||||
// small arithmetic cost but no extra register pressure from ImmCB_0_0_0 matrix.
|
||||
half2 lightIndex2 = (index < 2.0h) ? unity_LightIndices[0].xy : unity_LightIndices[0].zw;
|
||||
half i_rem = (index < 2.0h) ? index : index - 2.0h;
|
||||
return (i_rem < 1.0h) ? lightIndex2.x : lightIndex2.y;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Fills a light struct given a loop i index. This will convert the i
|
||||
// index to a perObjectLightIndex
|
||||
Light GetAdditionalLight(uint i, float3 positionWS)
|
||||
{
|
||||
int perObjectLightIndex = GetPerObjectLightIndex(i);
|
||||
return GetAdditionalPerObjectLight(perObjectLightIndex, positionWS);
|
||||
}
|
||||
|
||||
int GetAdditionalLightsCount()
|
||||
{
|
||||
// TODO: we need to expose in SRP api an ability for the pipeline cap the amount of lights
|
||||
// in the culling. This way we could do the loop branch with an uniform
|
||||
// This would be helpful to support baking exceeding lights in SH as well
|
||||
return min(_AdditionalLightsCount.x, unity_LightData.y);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3eab241579cd5514388d88f452714385
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f58436457f0f8304baefde53ca9c9f89
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c15cd9011f407b4697938c3cc979717
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a71be3e7990efb040a07565c43cbb198
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77c0e73f53dcc1a4bac867af138898cf
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35e9f6a6071b4f44fa2cf94b59d33251
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1529372f6ddbfb0429260b50bc9d1aa8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd81627723031224baf6eef1b52a3f50
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7f093702247b5648a3c062d5ee0c6de
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,272 @@
|
||||
//
|
||||
// Kino/Bloom v2 - Bloom filter for Unity
|
||||
//
|
||||
// Copyright (C) 2015, 2016 Keijiro Takahashi
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
// Modified by Jean Moreno for Cartoon FX Remaster Demo
|
||||
// - effect previews in SceneView
|
||||
// - disabled a code warning
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Kino
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(Camera))]
|
||||
[ImageEffectAllowedInSceneView]
|
||||
public class Bloom : MonoBehaviour
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// Prefilter threshold (gamma-encoded)
|
||||
/// Filters out pixels under this level of brightness.
|
||||
public float thresholdGamma
|
||||
{
|
||||
get { return Mathf.Max(_threshold, 0); }
|
||||
set { _threshold = value; }
|
||||
}
|
||||
|
||||
/// Prefilter threshold (linearly-encoded)
|
||||
/// Filters out pixels under this level of brightness.
|
||||
public float thresholdLinear
|
||||
{
|
||||
get { return GammaToLinear(thresholdGamma); }
|
||||
set { _threshold = LinearToGamma(value); }
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
[Tooltip("Filters out pixels under this level of brightness.")]
|
||||
float _threshold = 0.8f;
|
||||
|
||||
/// Soft-knee coefficient
|
||||
/// Makes transition between under/over-threshold gradual.
|
||||
public float softKnee
|
||||
{
|
||||
get { return _softKnee; }
|
||||
set { _softKnee = value; }
|
||||
}
|
||||
|
||||
[SerializeField, Range(0, 1)]
|
||||
[Tooltip("Makes transition between under/over-threshold gradual.")]
|
||||
float _softKnee = 0.5f;
|
||||
|
||||
/// Bloom radius
|
||||
/// Changes extent of veiling effects in a screen
|
||||
/// resolution-independent fashion.
|
||||
public float radius
|
||||
{
|
||||
get { return _radius; }
|
||||
set { _radius = value; }
|
||||
}
|
||||
|
||||
[SerializeField, Range(1, 7)]
|
||||
[Tooltip("Changes extent of veiling effects\n" +
|
||||
"in a screen resolution-independent fashion.")]
|
||||
float _radius = 2.5f;
|
||||
|
||||
/// Bloom intensity
|
||||
/// Blend factor of the result image.
|
||||
public float intensity
|
||||
{
|
||||
get { return Mathf.Max(_intensity, 0); }
|
||||
set { _intensity = value; }
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
[Tooltip("Blend factor of the result image.")]
|
||||
float _intensity = 0.8f;
|
||||
|
||||
/// High quality mode
|
||||
/// Controls filter quality and buffer resolution.
|
||||
public bool highQuality
|
||||
{
|
||||
get { return _highQuality; }
|
||||
set { _highQuality = value; }
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
[Tooltip("Controls filter quality and buffer resolution.")]
|
||||
bool _highQuality = true;
|
||||
|
||||
/// Anti-flicker filter
|
||||
/// Reduces flashing noise with an additional filter.
|
||||
[SerializeField]
|
||||
[Tooltip("Reduces flashing noise with an additional filter.")]
|
||||
bool _antiFlicker = true;
|
||||
|
||||
public bool antiFlicker
|
||||
{
|
||||
get { return _antiFlicker; }
|
||||
set { _antiFlicker = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Members
|
||||
|
||||
#pragma warning disable 0649
|
||||
[SerializeField, HideInInspector]
|
||||
Shader _shader;
|
||||
#pragma warning restore 0649
|
||||
|
||||
Material _material;
|
||||
|
||||
const int kMaxIterations = 16;
|
||||
RenderTexture[] _blurBuffer1 = new RenderTexture[kMaxIterations];
|
||||
RenderTexture[] _blurBuffer2 = new RenderTexture[kMaxIterations];
|
||||
|
||||
float LinearToGamma(float x)
|
||||
{
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
return Mathf.LinearToGammaSpace(x);
|
||||
#else
|
||||
if (x <= 0.0031308f)
|
||||
return 12.92f * x;
|
||||
else
|
||||
return 1.055f * Mathf.Pow(x, 1 / 2.4f) - 0.055f;
|
||||
#endif
|
||||
}
|
||||
|
||||
float GammaToLinear(float x)
|
||||
{
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
return Mathf.GammaToLinearSpace(x);
|
||||
#else
|
||||
if (x <= 0.04045f)
|
||||
return x / 12.92f;
|
||||
else
|
||||
return Mathf.Pow((x + 0.055f) / 1.055f, 2.4f);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MonoBehaviour Functions
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
var shader = _shader ? _shader : Shader.Find("Hidden/Kino/Bloom");
|
||||
_material = new Material(shader);
|
||||
_material.hideFlags = HideFlags.DontSave;
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
DestroyImmediate(_material);
|
||||
}
|
||||
|
||||
void OnRenderImage(RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
var useRGBM = Application.isMobilePlatform;
|
||||
|
||||
// source texture size
|
||||
var tw = source.width;
|
||||
var th = source.height;
|
||||
|
||||
// halve the texture size for the low quality mode
|
||||
if (!_highQuality)
|
||||
{
|
||||
tw /= 2;
|
||||
th /= 2;
|
||||
}
|
||||
|
||||
// blur buffer format
|
||||
var rtFormat = useRGBM ?
|
||||
RenderTextureFormat.Default : RenderTextureFormat.DefaultHDR;
|
||||
|
||||
// determine the iteration count
|
||||
var logh = Mathf.Log(th, 2) + _radius - 8;
|
||||
var logh_i = (int)logh;
|
||||
var iterations = Mathf.Clamp(logh_i, 1, kMaxIterations);
|
||||
|
||||
// update the shader properties
|
||||
var lthresh = thresholdLinear;
|
||||
_material.SetFloat("_Threshold", lthresh);
|
||||
|
||||
var knee = lthresh * _softKnee + 1e-5f;
|
||||
var curve = new Vector3(lthresh - knee, knee * 2, 0.25f / knee);
|
||||
_material.SetVector("_Curve", curve);
|
||||
|
||||
var pfo = !_highQuality && _antiFlicker;
|
||||
_material.SetFloat("_PrefilterOffs", pfo ? -0.5f : 0.0f);
|
||||
|
||||
_material.SetFloat("_SampleScale", 0.5f + logh - logh_i);
|
||||
_material.SetFloat("_Intensity", intensity);
|
||||
|
||||
// prefilter pass
|
||||
var prefiltered = RenderTexture.GetTemporary(tw, th, 0, rtFormat);
|
||||
var pass = _antiFlicker ? 1 : 0;
|
||||
Graphics.Blit(source, prefiltered, _material, pass);
|
||||
|
||||
// construct a mip pyramid
|
||||
var last = prefiltered;
|
||||
for (var level = 0; level < iterations; level++)
|
||||
{
|
||||
_blurBuffer1[level] = RenderTexture.GetTemporary(
|
||||
last.width / 2, last.height / 2, 0, rtFormat
|
||||
);
|
||||
|
||||
pass = (level == 0) ? (_antiFlicker ? 3 : 2) : 4;
|
||||
Graphics.Blit(last, _blurBuffer1[level], _material, pass);
|
||||
|
||||
last = _blurBuffer1[level];
|
||||
}
|
||||
|
||||
// upsample and combine loop
|
||||
for (var level = iterations - 2; level >= 0; level--)
|
||||
{
|
||||
var basetex = _blurBuffer1[level];
|
||||
_material.SetTexture("_BaseTex", basetex);
|
||||
|
||||
_blurBuffer2[level] = RenderTexture.GetTemporary(
|
||||
basetex.width, basetex.height, 0, rtFormat
|
||||
);
|
||||
|
||||
pass = _highQuality ? 6 : 5;
|
||||
Graphics.Blit(last, _blurBuffer2[level], _material, pass);
|
||||
last = _blurBuffer2[level];
|
||||
}
|
||||
|
||||
// finish process
|
||||
_material.SetTexture("_BaseTex", source);
|
||||
pass = _highQuality ? 8 : 7;
|
||||
Graphics.Blit(last, destination, _material, pass);
|
||||
|
||||
// release the temporary buffers
|
||||
for (var i = 0; i < kMaxIterations; i++)
|
||||
{
|
||||
if (_blurBuffer1[i] != null)
|
||||
RenderTexture.ReleaseTemporary(_blurBuffer1[i]);
|
||||
|
||||
if (_blurBuffer2[i] != null)
|
||||
RenderTexture.ReleaseTemporary(_blurBuffer2[i]);
|
||||
|
||||
_blurBuffer1[i] = null;
|
||||
_blurBuffer2[i] = null;
|
||||
}
|
||||
|
||||
RenderTexture.ReleaseTemporary(prefiltered);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6363bba448bf64e60a763433f9ddf81b
|
||||
timeCreated: 1445671165
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- _shader: {fileID: 4800000, guid: 5a711a01011934ebcb58ef5ad52159d6, type: 3}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b40be1dd63cf4e94a83d27ec56ac0644
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,76 @@
|
||||
//
|
||||
// Kino/Bloom v2 - Bloom filter for Unity
|
||||
//
|
||||
// Copyright (C) 2015, 2016 Keijiro Takahashi
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Kino
|
||||
{
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(Bloom))]
|
||||
public class BloomEditor : Editor
|
||||
{
|
||||
BloomGraphDrawer _graph;
|
||||
|
||||
SerializedProperty _threshold;
|
||||
SerializedProperty _softKnee;
|
||||
SerializedProperty _radius;
|
||||
SerializedProperty _intensity;
|
||||
SerializedProperty _highQuality;
|
||||
SerializedProperty _antiFlicker;
|
||||
|
||||
static GUIContent _textThreshold = new GUIContent("Threshold (gamma)");
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
_graph = new BloomGraphDrawer();
|
||||
_threshold = serializedObject.FindProperty("_threshold");
|
||||
_softKnee = serializedObject.FindProperty("_softKnee");
|
||||
_radius = serializedObject.FindProperty("_radius");
|
||||
_intensity = serializedObject.FindProperty("_intensity");
|
||||
_highQuality = serializedObject.FindProperty("_highQuality");
|
||||
_antiFlicker = serializedObject.FindProperty("_antiFlicker");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
if (!serializedObject.isEditingMultipleObjects) {
|
||||
EditorGUILayout.Space();
|
||||
_graph.Prepare((Bloom)target);
|
||||
_graph.DrawGraph();
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
EditorGUILayout.PropertyField(_threshold, _textThreshold);
|
||||
EditorGUILayout.PropertyField(_softKnee);
|
||||
EditorGUILayout.PropertyField(_intensity);
|
||||
EditorGUILayout.PropertyField(_radius);
|
||||
EditorGUILayout.PropertyField(_highQuality);
|
||||
EditorGUILayout.PropertyField(_antiFlicker);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 036bc30d96c3349ce86bfc8d95667da7
|
||||
timeCreated: 1435816745
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,183 @@
|
||||
//
|
||||
// Kino/Bloom v2 - Bloom filter for Unity
|
||||
//
|
||||
// Copyright (C) 2015, 2016 Keijiro Takahashi
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Kino
|
||||
{
|
||||
// Class used for drawing the brightness response curve
|
||||
public class BloomGraphDrawer
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
// Update internal state with a given bloom instance.
|
||||
public void Prepare(Bloom bloom)
|
||||
{
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
if (bloom.GetComponent<Camera>().allowHDR)
|
||||
#else
|
||||
if (bloom.GetComponent<Camera>().hdr)
|
||||
#endif
|
||||
{
|
||||
_rangeX = 6;
|
||||
_rangeY = 1.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
_rangeX = 1;
|
||||
_rangeY = 1;
|
||||
}
|
||||
|
||||
_threshold = bloom.thresholdLinear;
|
||||
_knee = bloom.softKnee * _threshold + 1e-5f;
|
||||
|
||||
// Intensity is capped to prevent sampling errors.
|
||||
_intensity = Mathf.Min(bloom.intensity, 10);
|
||||
}
|
||||
|
||||
// Draw the graph at the current position.
|
||||
public void DrawGraph()
|
||||
{
|
||||
_rectGraph = GUILayoutUtility.GetRect(128, 80);
|
||||
|
||||
// Background
|
||||
DrawRect(0, 0, _rangeX, _rangeY, 0.1f, 0.4f);
|
||||
|
||||
// Soft-knee range
|
||||
DrawRect(_threshold - _knee, 0, _threshold + _knee, _rangeY, 0.25f, -1);
|
||||
|
||||
// Horizontal lines
|
||||
for (var i = 1; i < _rangeY; i++)
|
||||
DrawLine(0, i, _rangeX, i, 0.4f);
|
||||
|
||||
// Vertical lines
|
||||
for (var i = 1; i < _rangeX; i++)
|
||||
DrawLine(i, 0, i, _rangeY, 0.4f);
|
||||
|
||||
// Label
|
||||
Handles.Label(
|
||||
PointInRect(0, _rangeY) + Vector3.right,
|
||||
"Brightness Response (linear)", EditorStyles.miniLabel
|
||||
);
|
||||
|
||||
// Threshold line
|
||||
DrawLine(_threshold, 0, _threshold, _rangeY, 0.6f);
|
||||
|
||||
// Response curve
|
||||
var vcount = 0;
|
||||
while (vcount < _curveResolution)
|
||||
{
|
||||
var x = _rangeX * vcount / (_curveResolution - 1);
|
||||
var y = ResponseFunction(x);
|
||||
if (y < _rangeY)
|
||||
{
|
||||
_curveVertices[vcount++] = PointInRect(x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (vcount > 1)
|
||||
{
|
||||
// Extend the last segment to the top edge of the rect.
|
||||
var v1 = _curveVertices[vcount - 2];
|
||||
var v2 = _curveVertices[vcount - 1];
|
||||
var clip = (_rectGraph.y - v1.y) / (v2.y - v1.y);
|
||||
_curveVertices[vcount - 1] = v1 + (v2 - v1) * clip;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (vcount > 1)
|
||||
{
|
||||
Handles.color = Color.white * 0.9f;
|
||||
Handles.DrawAAPolyLine(2.0f, vcount, _curveVertices);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Response Function
|
||||
|
||||
float _threshold;
|
||||
float _knee;
|
||||
float _intensity;
|
||||
|
||||
float ResponseFunction(float x)
|
||||
{
|
||||
var rq = Mathf.Clamp(x - _threshold + _knee, 0, _knee * 2);
|
||||
rq = rq * rq * 0.25f / _knee;
|
||||
return Mathf.Max(rq, x - _threshold) * _intensity;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Graph Functions
|
||||
|
||||
// Number of vertices in curve
|
||||
const int _curveResolution = 96;
|
||||
|
||||
// Vertex buffers
|
||||
Vector3[] _rectVertices = new Vector3[4];
|
||||
Vector3[] _lineVertices = new Vector3[2];
|
||||
Vector3[] _curveVertices = new Vector3[_curveResolution];
|
||||
|
||||
Rect _rectGraph;
|
||||
float _rangeX;
|
||||
float _rangeY;
|
||||
|
||||
// Transform a point into the graph rect.
|
||||
Vector3 PointInRect(float x, float y)
|
||||
{
|
||||
x = Mathf.Lerp(_rectGraph.x, _rectGraph.xMax, x / _rangeX);
|
||||
y = Mathf.Lerp(_rectGraph.yMax, _rectGraph.y, y / _rangeY);
|
||||
return new Vector3(x, y, 0);
|
||||
}
|
||||
|
||||
// Draw a line in the graph rect.
|
||||
void DrawLine(float x1, float y1, float x2, float y2, float grayscale)
|
||||
{
|
||||
_lineVertices[0] = PointInRect(x1, y1);
|
||||
_lineVertices[1] = PointInRect(x2, y2);
|
||||
Handles.color = Color.white * grayscale;
|
||||
Handles.DrawAAPolyLine(2.0f, _lineVertices);
|
||||
}
|
||||
|
||||
// Draw a rect in the graph rect.
|
||||
void DrawRect(float x1, float y1, float x2, float y2, float fill, float line)
|
||||
{
|
||||
_rectVertices[0] = PointInRect(x1, y1);
|
||||
_rectVertices[1] = PointInRect(x2, y1);
|
||||
_rectVertices[2] = PointInRect(x2, y2);
|
||||
_rectVertices[3] = PointInRect(x1, y2);
|
||||
|
||||
Handles.DrawSolidRectangleWithOutline(
|
||||
_rectVertices,
|
||||
fill < 0 ? Color.clear : Color.white * fill,
|
||||
line < 0 ? Color.clear : Color.white * line
|
||||
);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4afcb2949e7fb42679b587b8848b7e02
|
||||
timeCreated: 1457674915
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c04a0ddd8381aa04ab37bc4596459abb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,251 @@
|
||||
//
|
||||
// Kino/Bloom v2 - Bloom filter for Unity
|
||||
//
|
||||
// Copyright (C) 2015, 2016 Keijiro Takahashi
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
// Mobile: use RGBM instead of float/half RGB
|
||||
#define USE_RGBM defined(SHADER_API_MOBILE)
|
||||
|
||||
sampler2D _MainTex;
|
||||
sampler2D _BaseTex;
|
||||
float2 _MainTex_TexelSize;
|
||||
float2 _BaseTex_TexelSize;
|
||||
half4 _MainTex_ST;
|
||||
half4 _BaseTex_ST;
|
||||
|
||||
float _PrefilterOffs;
|
||||
half _Threshold;
|
||||
half3 _Curve;
|
||||
float _SampleScale;
|
||||
half _Intensity;
|
||||
|
||||
// Brightness function
|
||||
half Brightness(half3 c)
|
||||
{
|
||||
return max(max(c.r, c.g), c.b);
|
||||
}
|
||||
|
||||
// 3-tap median filter
|
||||
half3 Median(half3 a, half3 b, half3 c)
|
||||
{
|
||||
return a + b + c - min(min(a, b), c) - max(max(a, b), c);
|
||||
}
|
||||
|
||||
// Clamp HDR value within a safe range
|
||||
half3 SafeHDR(half3 c) { return min(c, 65000); }
|
||||
half4 SafeHDR(half4 c) { return min(c, 65000); }
|
||||
|
||||
// RGBM encoding/decoding
|
||||
half4 EncodeHDR(float3 rgb)
|
||||
{
|
||||
#if USE_RGBM
|
||||
rgb *= 1.0 / 8;
|
||||
float m = max(max(rgb.r, rgb.g), max(rgb.b, 1e-6));
|
||||
m = ceil(m * 255) / 255;
|
||||
return half4(rgb / m, m);
|
||||
#else
|
||||
return half4(rgb, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
float3 DecodeHDR(half4 rgba)
|
||||
{
|
||||
#if USE_RGBM
|
||||
return rgba.rgb * rgba.a * 8;
|
||||
#else
|
||||
return rgba.rgb;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Downsample with a 4x4 box filter
|
||||
half3 DownsampleFilter(float2 uv)
|
||||
{
|
||||
float4 d = _MainTex_TexelSize.xyxy * float4(-1, -1, +1, +1);
|
||||
|
||||
half3 s;
|
||||
s = DecodeHDR(tex2D(_MainTex, uv + d.xy));
|
||||
s += DecodeHDR(tex2D(_MainTex, uv + d.zy));
|
||||
s += DecodeHDR(tex2D(_MainTex, uv + d.xw));
|
||||
s += DecodeHDR(tex2D(_MainTex, uv + d.zw));
|
||||
|
||||
return s * (1.0 / 4);
|
||||
}
|
||||
|
||||
// Downsample with a 4x4 box filter + anti-flicker filter
|
||||
half3 DownsampleAntiFlickerFilter(float2 uv)
|
||||
{
|
||||
float4 d = _MainTex_TexelSize.xyxy * float4(-1, -1, +1, +1);
|
||||
|
||||
half3 s1 = DecodeHDR(tex2D(_MainTex, uv + d.xy));
|
||||
half3 s2 = DecodeHDR(tex2D(_MainTex, uv + d.zy));
|
||||
half3 s3 = DecodeHDR(tex2D(_MainTex, uv + d.xw));
|
||||
half3 s4 = DecodeHDR(tex2D(_MainTex, uv + d.zw));
|
||||
|
||||
// Karis's luma weighted average (using brightness instead of luma)
|
||||
half s1w = 1 / (Brightness(s1) + 1);
|
||||
half s2w = 1 / (Brightness(s2) + 1);
|
||||
half s3w = 1 / (Brightness(s3) + 1);
|
||||
half s4w = 1 / (Brightness(s4) + 1);
|
||||
half one_div_wsum = 1 / (s1w + s2w + s3w + s4w);
|
||||
|
||||
return (s1 * s1w + s2 * s2w + s3 * s3w + s4 * s4w) * one_div_wsum;
|
||||
}
|
||||
|
||||
half3 UpsampleFilter(float2 uv)
|
||||
{
|
||||
#if HIGH_QUALITY
|
||||
// 9-tap bilinear upsampler (tent filter)
|
||||
float4 d = _MainTex_TexelSize.xyxy * float4(1, 1, -1, 0) * _SampleScale;
|
||||
|
||||
half3 s;
|
||||
s = DecodeHDR(tex2D(_MainTex, uv - d.xy));
|
||||
s += DecodeHDR(tex2D(_MainTex, uv - d.wy)) * 2;
|
||||
s += DecodeHDR(tex2D(_MainTex, uv - d.zy));
|
||||
|
||||
s += DecodeHDR(tex2D(_MainTex, uv + d.zw)) * 2;
|
||||
s += DecodeHDR(tex2D(_MainTex, uv )) * 4;
|
||||
s += DecodeHDR(tex2D(_MainTex, uv + d.xw)) * 2;
|
||||
|
||||
s += DecodeHDR(tex2D(_MainTex, uv + d.zy));
|
||||
s += DecodeHDR(tex2D(_MainTex, uv + d.wy)) * 2;
|
||||
s += DecodeHDR(tex2D(_MainTex, uv + d.xy));
|
||||
|
||||
return s * (1.0 / 16);
|
||||
#else
|
||||
// 4-tap bilinear upsampler
|
||||
float4 d = _MainTex_TexelSize.xyxy * float4(-1, -1, +1, +1) * (_SampleScale * 0.5);
|
||||
|
||||
half3 s;
|
||||
s = DecodeHDR(tex2D(_MainTex, uv + d.xy));
|
||||
s += DecodeHDR(tex2D(_MainTex, uv + d.zy));
|
||||
s += DecodeHDR(tex2D(_MainTex, uv + d.xw));
|
||||
s += DecodeHDR(tex2D(_MainTex, uv + d.zw));
|
||||
|
||||
return s * (1.0 / 4);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Vertex shader
|
||||
//
|
||||
|
||||
v2f_img vert(appdata_img v)
|
||||
{
|
||||
v2f_img o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = UnityStereoScreenSpaceUVAdjust(v.texcoord, _MainTex_ST);
|
||||
return o;
|
||||
}
|
||||
|
||||
struct v2f_multitex
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uvMain : TEXCOORD0;
|
||||
float2 uvBase : TEXCOORD1;
|
||||
};
|
||||
|
||||
v2f_multitex vert_multitex(appdata_img v)
|
||||
{
|
||||
v2f_multitex o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uvMain = UnityStereoScreenSpaceUVAdjust(v.texcoord, _MainTex_ST);
|
||||
o.uvBase = UnityStereoScreenSpaceUVAdjust(v.texcoord, _BaseTex_ST);
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
if (_BaseTex_TexelSize.y < 0.0)
|
||||
o.uvBase.y = 1.0 - v.texcoord.y;
|
||||
#endif
|
||||
return o;
|
||||
}
|
||||
|
||||
//
|
||||
// fragment shader
|
||||
//
|
||||
|
||||
half4 frag_prefilter(v2f_img i) : SV_Target
|
||||
{
|
||||
float2 uv = i.uv + _MainTex_TexelSize.xy * _PrefilterOffs;
|
||||
|
||||
#if ANTI_FLICKER
|
||||
float3 d = _MainTex_TexelSize.xyx * float3(1, 1, 0);
|
||||
half4 s0 = SafeHDR(tex2D(_MainTex, uv));
|
||||
half3 s1 = SafeHDR(tex2D(_MainTex, uv - d.xz).rgb);
|
||||
half3 s2 = SafeHDR(tex2D(_MainTex, uv + d.xz).rgb);
|
||||
half3 s3 = SafeHDR(tex2D(_MainTex, uv - d.zy).rgb);
|
||||
half3 s4 = SafeHDR(tex2D(_MainTex, uv + d.zy).rgb);
|
||||
half3 m = Median(Median(s0.rgb, s1, s2), s3, s4);
|
||||
#else
|
||||
half4 s0 = SafeHDR(tex2D(_MainTex, uv));
|
||||
half3 m = s0.rgb;
|
||||
#endif
|
||||
|
||||
#if UNITY_COLORSPACE_GAMMA
|
||||
m = GammaToLinearSpace(m);
|
||||
#endif
|
||||
// Pixel brightness
|
||||
half br = Brightness(m);
|
||||
|
||||
// Under-threshold part: quadratic curve
|
||||
half rq = clamp(br - _Curve.x, 0, _Curve.y);
|
||||
rq = _Curve.z * rq * rq;
|
||||
|
||||
// Combine and apply the brightness response curve.
|
||||
m *= max(rq, br - _Threshold) / max(br, 1e-5);
|
||||
|
||||
return EncodeHDR(m);
|
||||
}
|
||||
|
||||
half4 frag_downsample1(v2f_img i) : SV_Target
|
||||
{
|
||||
#if ANTI_FLICKER
|
||||
return EncodeHDR(DownsampleAntiFlickerFilter(i.uv));
|
||||
#else
|
||||
return EncodeHDR(DownsampleFilter(i.uv));
|
||||
#endif
|
||||
}
|
||||
|
||||
half4 frag_downsample2(v2f_img i) : SV_Target
|
||||
{
|
||||
return EncodeHDR(DownsampleFilter(i.uv));
|
||||
}
|
||||
|
||||
half4 frag_upsample(v2f_multitex i) : SV_Target
|
||||
{
|
||||
half3 base = DecodeHDR(tex2D(_BaseTex, i.uvBase));
|
||||
half3 blur = UpsampleFilter(i.uvMain);
|
||||
return EncodeHDR(base + blur);
|
||||
}
|
||||
|
||||
half4 frag_upsample_final(v2f_multitex i) : SV_Target
|
||||
{
|
||||
half4 base = tex2D(_BaseTex, i.uvBase);
|
||||
half3 blur = UpsampleFilter(i.uvMain);
|
||||
#if UNITY_COLORSPACE_GAMMA
|
||||
base.rgb = GammaToLinearSpace(base.rgb);
|
||||
#endif
|
||||
half3 cout = base.rgb + blur * _Intensity;
|
||||
#if UNITY_COLORSPACE_GAMMA
|
||||
cout = LinearToGammaSpace(cout);
|
||||
#endif
|
||||
return half4(cout, base.a);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b8325918052c4c5492831d116e3ed27
|
||||
timeCreated: 1463470294
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,141 @@
|
||||
//
|
||||
// Kino/Bloom v2 - Bloom filter for Unity
|
||||
//
|
||||
// Copyright (C) 2015, 2016 Keijiro Takahashi
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
Shader "Hidden/Kino/Bloom"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex("", 2D) = "" {}
|
||||
_BaseTex("", 2D) = "" {}
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
// 0: Prefilter
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#pragma multi_compile _ UNITY_COLORSPACE_GAMMA
|
||||
#include "Bloom.cginc"
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag_prefilter
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
// 1: Prefilter with anti-flicker
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#define ANTI_FLICKER 1
|
||||
#pragma multi_compile _ UNITY_COLORSPACE_GAMMA
|
||||
#include "Bloom.cginc"
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag_prefilter
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
// 2: First level downsampler
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#include "Bloom.cginc"
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag_downsample1
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
// 3: First level downsampler with anti-flicker
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#define ANTI_FLICKER 1
|
||||
#include "Bloom.cginc"
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag_downsample1
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
// 4: Second level downsampler
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#include "Bloom.cginc"
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag_downsample2
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
// 5: Upsampler
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#include "Bloom.cginc"
|
||||
#pragma vertex vert_multitex
|
||||
#pragma fragment frag_upsample
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
// 6: High quality upsampler
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#define HIGH_QUALITY 1
|
||||
#include "Bloom.cginc"
|
||||
#pragma vertex vert_multitex
|
||||
#pragma fragment frag_upsample
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
// 7: Combiner
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#pragma multi_compile _ UNITY_COLORSPACE_GAMMA
|
||||
#include "Bloom.cginc"
|
||||
#pragma vertex vert_multitex
|
||||
#pragma fragment frag_upsample_final
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
// 8: High quality combiner
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
CGPROGRAM
|
||||
#define HIGH_QUALITY 1
|
||||
#pragma multi_compile _ UNITY_COLORSPACE_GAMMA
|
||||
#include "Bloom.cginc"
|
||||
#pragma vertex vert_multitex
|
||||
#pragma fragment frag_upsample_final
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a711a01011934ebcb58ef5ad52159d6
|
||||
timeCreated: 1435809878
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 866207198cc5f5446bdcb6bf04622938
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
@ -0,0 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cedc53e91a163eb498a6434b79d244de
|
||||
MonoAssemblyImporter:
|
||||
serializedVersion: 1
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fefa6bf75d5e8aa4f874e2d532120b42
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,75 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace CartoonFX
|
||||
{
|
||||
[InitializeOnLoad]
|
||||
public class CFXR_WelcomeScreen : EditorWindow
|
||||
{
|
||||
static CFXR_WelcomeScreen()
|
||||
{
|
||||
EditorApplication.delayCall += () =>
|
||||
{
|
||||
if (SessionState.GetBool("CFXR_WelcomeScreen_Shown", false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
SessionState.SetBool("CFXR_WelcomeScreen_Shown", true);
|
||||
|
||||
var importer = AssetImporter.GetAtPath(AssetDatabase.GUIDToAssetPath("bfd03f272fe010b4ba558a3bc456ffeb"));
|
||||
if (importer != null && importer.userData == "dontshow")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Open();
|
||||
};
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Cartoon FX Remaster FREE - Welcome Screen")]
|
||||
static void Open()
|
||||
{
|
||||
var window = GetWindow<CFXR_WelcomeScreen>(true, "Cartoon FX Remaster FREE", true);
|
||||
window.minSize = new Vector2(516, 370);
|
||||
window.maxSize = new Vector2(516, 370);
|
||||
}
|
||||
|
||||
private void CreateGUI()
|
||||
{
|
||||
VisualElement root = rootVisualElement;
|
||||
root.style.height = new StyleLength(new Length(100, LengthUnit.Percent));
|
||||
|
||||
// UXML
|
||||
var uxmlDocument = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(AssetDatabase.GUIDToAssetPath("bfd03f272fe010b4ba558a3bc456ffeb"));
|
||||
root.Add(uxmlDocument.Instantiate());
|
||||
// USS
|
||||
var styleSheet = AssetDatabase.LoadAssetAtPath<StyleSheet>(AssetDatabase.GUIDToAssetPath("f8b971f10a610844f968f582415df874"));
|
||||
root.styleSheets.Add(styleSheet);
|
||||
|
||||
// Background image
|
||||
root.style.backgroundImage = new StyleBackground(AssetDatabase.LoadAssetAtPath<Texture2D>(AssetDatabase.GUIDToAssetPath("fed1b64fd853f994c8d504720a0a6d44")));
|
||||
root.style.unityBackgroundScaleMode = ScaleMode.ScaleAndCrop;
|
||||
|
||||
// Logo image
|
||||
var titleImage = root.Q<Image>("img_title");
|
||||
titleImage.image = AssetDatabase.LoadAssetAtPath<Texture2D>(AssetDatabase.GUIDToAssetPath("a665b2e53088caa4c89dd09f9c889f62"));
|
||||
|
||||
// Buttons
|
||||
root.Q<Label>("btn_cfxr1").AddManipulator(new Clickable(evt => { Application.OpenURL("https://assetstore.unity.com/packages/slug/4010"); }));
|
||||
root.Q<Label>("btn_cfxr2").AddManipulator(new Clickable(evt => { Application.OpenURL("https://assetstore.unity.com/packages/slug/4274"); }));
|
||||
root.Q<Label>("btn_cfxr3").AddManipulator(new Clickable(evt => { Application.OpenURL("https://assetstore.unity.com/packages/slug/10172"); }));
|
||||
root.Q<Label>("btn_cfxr4").AddManipulator(new Clickable(evt => { Application.OpenURL("https://assetstore.unity.com/packages/slug/23634"); }));
|
||||
root.Q<Label>("btn_cfxrbundle").AddManipulator(new Clickable(evt => { Application.OpenURL("https://assetstore.unity.com/packages/slug/232385"); }));
|
||||
|
||||
root.Q<Button>("close_dontshow").RegisterCallback<ClickEvent>(evt =>
|
||||
{
|
||||
this.Close();
|
||||
var importer = AssetImporter.GetAtPath(AssetDatabase.GUIDToAssetPath("bfd03f272fe010b4ba558a3bc456ffeb"));
|
||||
importer.userData = "dontshow";
|
||||
importer.SaveAndReimport();
|
||||
});
|
||||
root.Q<Button>("close").RegisterCallback<ClickEvent>(evt => { this.Close(); });
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c4fcce295aee5d4fb38ac4f82c8e664
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,90 @@
|
||||
Shader "Custom/TransparentOutline"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainColor ("Main Color", Color) = (1,1,1,0.5)
|
||||
_OutlineColor ("Outline Color", Color) = (0,0,0,1)
|
||||
_OutlineWidth ("Outline Width", Range(0.001, 0.1)) = 0.02
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
|
||||
LOD 100
|
||||
|
||||
// First Pass: Render the Outline Behind the Mesh
|
||||
Pass {
|
||||
Name "Outline"
|
||||
Cull Front
|
||||
ZWrite Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
struct appdata_t {
|
||||
float4 positionOS : POSITION;
|
||||
float3 normalOS : NORMAL;
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 positionCS : SV_POSITION;
|
||||
};
|
||||
|
||||
float _OutlineWidth;
|
||||
float4 _OutlineColor;
|
||||
|
||||
v2f vert(appdata_t v) {
|
||||
v2f o;
|
||||
float3 normalWS = TransformObjectToWorldNormal(v.normalOS);
|
||||
float3 positionWS = TransformObjectToWorld(v.positionOS.xyz);
|
||||
positionWS += normalWS * _OutlineWidth;
|
||||
o.positionCS = TransformWorldToHClip(positionWS);
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag(v2f i) : SV_Target {
|
||||
return _OutlineColor;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// Second Pass: Render the Transparent Mesh on Top
|
||||
Pass {
|
||||
Name "Main"
|
||||
Cull Back
|
||||
ZWrite Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
struct appdata_t {
|
||||
float4 positionOS : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
float4 _MainColor;
|
||||
|
||||
v2f vert(appdata_t v) {
|
||||
v2f o;
|
||||
o.positionCS = TransformObjectToHClip(v.positionOS);
|
||||
o.uv = v.uv;
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag(v2f i) : SV_Target {
|
||||
return _MainColor;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b59e0f7271de96f44aeb59a7632efae2
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44e40926b9b189e4ab7438cc8356e2aa
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,37 @@
|
||||
Quick Outline
|
||||
=============
|
||||
|
||||
Developed by Chris Nolet (c) 2018
|
||||
|
||||
|
||||
Instructions
|
||||
------------
|
||||
|
||||
To add an outline to an object, drag-and-drop the Outline.cs
|
||||
script onto the object. The outline materials will be loaded
|
||||
at runtime.
|
||||
|
||||
You can also add outlines programmatically with:
|
||||
|
||||
var outline = gameObject.AddComponent<Outline>();
|
||||
|
||||
outline.OutlineMode = Outline.Mode.OutlineAll;
|
||||
outline.OutlineColor = Color.yellow;
|
||||
outline.OutlineWidth = 5f;
|
||||
|
||||
The outline script does a small amount of work in Awake().
|
||||
For best results, use outline.enabled to toggle the outline.
|
||||
Avoid removing and re-adding the component if possible.
|
||||
|
||||
For large meshes, you may also like to enable 'Precompute
|
||||
Outline' in the editor. This will reduce the amount of work
|
||||
performed in Awake().
|
||||
|
||||
|
||||
Troubleshooting
|
||||
---------------
|
||||
|
||||
If the outline appears off-center, please try the following:
|
||||
|
||||
1. Set 'Read/Write Enabled' on each model's import settings.
|
||||
2. Disable 'Optimize Mesh Data' in the player settings.
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5933bfd39d7a5b843a0ed821f85bca19
|
||||
timeCreated: 1522619008
|
||||
licenseType: Store
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70fd40674751a8042a8b9b2e8d9f915f
|
||||
folderAsset: yes
|
||||
timeCreated: 1522559128
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80ac8e52d3c31a94babd161e86bc6b97
|
||||
folderAsset: yes
|
||||
timeCreated: 1522559139
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,25 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: OutlineFill
|
||||
m_Shader: {fileID: 4800000, guid: 4e76d4023d7e0411297c670f878973e2, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs: []
|
||||
m_Floats:
|
||||
- _OutlineWidth: 2
|
||||
- _ZTest: 8
|
||||
m_Colors:
|
||||
- _OutlineColor: {r: 1, g: 1, b: 1, a: 1}
|
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 311313efa011949e98b6761d652ad13c
|
||||
timeCreated: 1520576285
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,23 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: OutlineMask
|
||||
m_Shader: {fileID: 4800000, guid: 341b058cd7dee4f5cba5cc59a513619e, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs: []
|
||||
m_Floats:
|
||||
- _ZTest: 8
|
||||
m_Colors: []
|
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 106f3ff43a17d4967a2b64c7a92e49ec
|
||||
timeCreated: 1520576276
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a63caa2b0e993043a42c11f35ff2d1a
|
||||
folderAsset: yes
|
||||
timeCreated: 1522559134
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,81 @@
|
||||
//
|
||||
// OutlineFill.shader
|
||||
// QuickOutline
|
||||
//
|
||||
// Created by Chris Nolet on 2/21/18.
|
||||
// Copyright © 2018 Chris Nolet. All rights reserved.
|
||||
//
|
||||
|
||||
Shader "Custom/Outline Fill" {
|
||||
Properties {
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTest("ZTest", Float) = 0
|
||||
|
||||
_OutlineColor("Outline Color", Color) = (1, 1, 1, 1)
|
||||
_OutlineWidth("Outline Width", Range(0, 10)) = 2
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags {
|
||||
"Queue" = "Transparent+110"
|
||||
"RenderType" = "Transparent"
|
||||
"DisableBatching" = "True"
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Fill"
|
||||
Cull Off
|
||||
ZTest [_ZTest]
|
||||
ZWrite Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ColorMask RGB
|
||||
|
||||
Stencil {
|
||||
Ref 1
|
||||
Comp NotEqual
|
||||
}
|
||||
|
||||
CGPROGRAM
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
float3 smoothNormal : TEXCOORD3;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 position : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
uniform fixed4 _OutlineColor;
|
||||
uniform float _OutlineWidth;
|
||||
|
||||
v2f vert(appdata input) {
|
||||
v2f output;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
float3 normal = any(input.smoothNormal) ? input.smoothNormal : input.normal;
|
||||
float3 viewPosition = UnityObjectToViewPos(input.vertex);
|
||||
float3 viewNormal = normalize(mul((float3x3)UNITY_MATRIX_IT_MV, normal));
|
||||
|
||||
output.position = UnityViewToClipPos(viewPosition + viewNormal * -viewPosition.z * _OutlineWidth / 1000.0);
|
||||
output.color = _OutlineColor;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f input) : SV_Target {
|
||||
return input.color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e76d4023d7e0411297c670f878973e2
|
||||
timeCreated: 1520575782
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,33 @@
|
||||
//
|
||||
// OutlineMask.shader
|
||||
// QuickOutline
|
||||
//
|
||||
// Created by Chris Nolet on 2/21/18.
|
||||
// Copyright © 2018 Chris Nolet. All rights reserved.
|
||||
//
|
||||
|
||||
Shader "Custom/Outline Mask" {
|
||||
Properties {
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTest("ZTest", Float) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags {
|
||||
"Queue" = "Transparent+100"
|
||||
"RenderType" = "Transparent"
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Mask"
|
||||
Cull Off
|
||||
ZTest [_ZTest]
|
||||
ZWrite Off
|
||||
ColorMask 0
|
||||
|
||||
Stencil {
|
||||
Ref 1
|
||||
Pass Replace
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue