Initial commit

This commit is contained in:
2026-06-15 15:38:50 +03:00
commit 4ce7a052c9
1880 changed files with 2886431 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bd9d1d014bf0b14428db03b2527d2d93
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1a426d2ed10d55c47b7aee95ace55b60
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
{
"name": "CFXREditor",
"references": [],
"optionalUnityReferences": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: eb5cb7c323a395242a81960087292f3c
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,275 @@
//--------------------------------------------------------------------------------------------------------------------------------
// Cartoon FX
// (c) 2012-2025 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;
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: ce7d96d3a4d4f3b4681ab437a9710d60
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,604 @@
//--------------------------------------------------------------------------------------------------------------------------------
// Cartoon FX
// (c) 2012-2025 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 UNITY_6000_1_OR_NEWER
if((properties[i].propertyFlags & (UnityEngine.Rendering.ShaderPropertyFlags.HideInInspector | UnityEngine.Rendering.ShaderPropertyFlags.PerRendererData)) == UnityEngine.Rendering.ShaderPropertyFlags.None)
#else
if((properties[i].flags & (MaterialProperty.PropFlags.HideInInspector | MaterialProperty.PropFlags.PerRendererData)) == MaterialProperty.PropFlags.None)
#endif
{
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)
{
#if UNITY_6000_1_OR_NEWER
return prop.propertyType == UnityEngine.Rendering.ShaderPropertyType.Float || prop.propertyType == UnityEngine.Rendering.ShaderPropertyType.Range;
#else
return prop.type == MaterialProperty.PropType.Float || prop.type == MaterialProperty.PropType.Range;
#endif
}
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)
{
#if UNITY_6000_1_OR_NEWER
return prop.propertyType == UnityEngine.Rendering.ShaderPropertyType.Float || prop.propertyType == UnityEngine.Rendering.ShaderPropertyType.Range;
#else
return prop.type == MaterialProperty.PropType.Float || prop.type == MaterialProperty.PropType.Range;
#endif
}
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;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4fb4c15e772a1cc4baecc7a958bf9cc7
timeCreated: 1486392341
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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);
}
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fe56ec25963759b49955809beeb4324b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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);
}
}
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 29d46695388f9a84d9ae71b5140727a3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,362 @@
//--------------------------------------------------------------------------------------------------------------------------------
// Cartoon FX
// (c) 2012-2025 Jean Moreno
//--------------------------------------------------------------------------------------------------------------------------------
using UnityEngine;
using UnityEditor;
// GUI Styles and UI methods
namespace CartoonFX
{
public static class Styles
{
//================================================================================================================================
// GUI Styles
//================================================================================================================================
//================================================================================================================================
// (x) close button
static GUIStyle _closeCrossButton;
public static GUIStyle CloseCrossButton
{
get
{
if(_closeCrossButton == null)
{
//Try to load GUISkin according to its GUID
//Assumes that its .meta file should always stick with it!
string guiSkinPath = AssetDatabase.GUIDToAssetPath("02d396fa782e5d7438e231ea9f8be23c");
var gs = AssetDatabase.LoadAssetAtPath<GUISkin>(guiSkinPath);
if(gs != null)
{
_closeCrossButton = System.Array.Find<GUIStyle>(gs.customStyles, x => x.name == "CloseCrossButton");
}
//Else fall back to minibutton
if(_closeCrossButton == null)
_closeCrossButton = EditorStyles.miniButton;
}
return _closeCrossButton;
}
}
//================================================================================================================================
// Shuriken Toggle with label alignment fix
static GUIStyle _shurikenToggle;
public static GUIStyle ShurikenToggle
{
get
{
if(_shurikenToggle == null)
{
_shurikenToggle = new GUIStyle("ShurikenToggle");
_shurikenToggle.fontSize = 9;
_shurikenToggle.contentOffset = new Vector2(16, -1);
if(EditorGUIUtility.isProSkin)
{
var textColor = new Color(.8f, .8f, .8f);
_shurikenToggle.normal.textColor = textColor;
_shurikenToggle.active.textColor = textColor;
_shurikenToggle.focused.textColor = textColor;
_shurikenToggle.hover.textColor = textColor;
_shurikenToggle.onNormal.textColor = textColor;
_shurikenToggle.onActive.textColor = textColor;
_shurikenToggle.onFocused.textColor = textColor;
_shurikenToggle.onHover.textColor = textColor;
}
}
return _shurikenToggle;
}
}
//================================================================================================================================
// Bold mini-label (the one from EditorStyles isn't actually "mini")
static GUIStyle _miniBoldLabel;
public static GUIStyle MiniBoldLabel
{
get
{
if(_miniBoldLabel == null)
{
_miniBoldLabel = new GUIStyle(EditorStyles.boldLabel);
_miniBoldLabel.fontSize = 10;
_miniBoldLabel.margin = new RectOffset(0, 0, 0, 0);
}
return _miniBoldLabel;
}
}
//================================================================================================================================
// Bold mini-foldout
static GUIStyle _miniBoldFoldout;
public static GUIStyle MiniBoldFoldout
{
get
{
if(_miniBoldFoldout == null)
{
_miniBoldFoldout = new GUIStyle(EditorStyles.foldout);
_miniBoldFoldout.fontSize = 10;
_miniBoldFoldout.fontStyle = FontStyle.Bold;
_miniBoldFoldout.margin = new RectOffset(0, 0, 0, 0);
}
return _miniBoldFoldout;
}
}
//================================================================================================================================
// Gray right-aligned label for Orderable List (Material Animator)
static GUIStyle _PropertyTypeLabel;
public static GUIStyle PropertyTypeLabel
{
get
{
if(_PropertyTypeLabel == null)
{
_PropertyTypeLabel = new GUIStyle(EditorStyles.label);
_PropertyTypeLabel.alignment = TextAnchor.MiddleRight;
_PropertyTypeLabel.normal.textColor = Color.gray;
_PropertyTypeLabel.fontSize = 9;
}
return _PropertyTypeLabel;
}
}
// Dark Gray right-aligned label for Orderable List (Material Animator)
static GUIStyle _PropertyTypeLabelFocused;
public static GUIStyle PropertyTypeLabelFocused
{
get
{
if(_PropertyTypeLabelFocused == null)
{
_PropertyTypeLabelFocused = new GUIStyle(EditorStyles.label);
_PropertyTypeLabelFocused.alignment = TextAnchor.MiddleRight;
_PropertyTypeLabelFocused.normal.textColor = new Color(.2f, .2f, .2f);
_PropertyTypeLabelFocused.fontSize = 9;
}
return _PropertyTypeLabelFocused;
}
}
//================================================================================================================================
// Rounded Box
static GUIStyle _roundedBox;
public static GUIStyle RoundedBox
{
get
{
if(_roundedBox == null)
{
_roundedBox = new GUIStyle(EditorStyles.helpBox);
}
return _roundedBox;
}
}
//================================================================================================================================
// Center White Label ("Editing Spline" label in Scene View)
static GUIStyle _CenteredWhiteLabel;
public static GUIStyle CenteredWhiteLabel
{
get
{
if(_CenteredWhiteLabel == null)
{
_CenteredWhiteLabel = new GUIStyle(EditorStyles.centeredGreyMiniLabel);
_CenteredWhiteLabel.fontSize = 20;
_CenteredWhiteLabel.normal.textColor = Color.white;
}
return _CenteredWhiteLabel;
}
}
//================================================================================================================================
// Used to draw lines for separators
static public GUIStyle _LineStyle;
static public GUIStyle LineStyle
{
get
{
if(_LineStyle == null)
{
_LineStyle = new GUIStyle();
_LineStyle.normal.background = EditorGUIUtility.whiteTexture;
_LineStyle.stretchWidth = true;
}
return _LineStyle;
}
}
//================================================================================================================================
// HelpBox with rich text formatting support
static GUIStyle _HelpBoxRichTextStyle;
static public GUIStyle HelpBoxRichTextStyle
{
get
{
if(_HelpBoxRichTextStyle == null)
{
_HelpBoxRichTextStyle = new GUIStyle("HelpBox");
_HelpBoxRichTextStyle.richText = true;
}
return _HelpBoxRichTextStyle;
}
}
//================================================================================================================================
// Material Blue Header
static public GUIStyle _MaterialHeaderStyle;
static public GUIStyle MaterialHeaderStyle
{
get
{
if(_MaterialHeaderStyle == null)
{
_MaterialHeaderStyle = new GUIStyle(EditorStyles.label);
_MaterialHeaderStyle.fontStyle = FontStyle.Bold;
_MaterialHeaderStyle.fontSize = 11;
_MaterialHeaderStyle.padding.top = 0;
_MaterialHeaderStyle.padding.bottom = 0;
_MaterialHeaderStyle.normal.textColor = EditorGUIUtility.isProSkin ? new Color32(75, 128, 255, 255) : new Color32(0, 50, 230, 255);
_MaterialHeaderStyle.stretchWidth = true;
}
return _MaterialHeaderStyle;
}
}
//================================================================================================================================
// Material Header emboss effect
static public GUIStyle _MaterialHeaderStyleHighlight;
static public GUIStyle MaterialHeaderStyleHighlight
{
get
{
if(_MaterialHeaderStyleHighlight == null)
{
_MaterialHeaderStyleHighlight = new GUIStyle(MaterialHeaderStyle);
_MaterialHeaderStyleHighlight.contentOffset = new Vector2(1, 1);
_MaterialHeaderStyleHighlight.normal.textColor = EditorGUIUtility.isProSkin ? new Color32(255, 255, 255, 16) : new Color32(255, 255, 255, 32);
}
return _MaterialHeaderStyleHighlight;
}
}
//================================================================================================================================
// Filled rectangle
static private GUIStyle _WhiteRectangleStyle;
static public void DrawRectangle(Rect position, Color color)
{
var col = GUI.color;
GUI.color *= color;
DrawRectangle(position);
GUI.color = col;
}
static public void DrawRectangle(Rect position)
{
if(_WhiteRectangleStyle == null)
{
_WhiteRectangleStyle = new GUIStyle();
_WhiteRectangleStyle.normal.background = EditorGUIUtility.whiteTexture;
}
if(Event.current != null && Event.current.type == EventType.Repaint)
{
_WhiteRectangleStyle.Draw(position, false, false, false, false);
}
}
//================================================================================================================================
// Methods
//================================================================================================================================
static public void DrawLine(float height = 2f)
{
DrawLine(Color.black, height);
}
static public void DrawLine(Color color, float height = 1f)
{
Rect position = GUILayoutUtility.GetRect(0f, float.MaxValue, height, height, LineStyle);
DrawLine(position, color);
}
static public void DrawLine(Rect position, Color color)
{
if(Event.current.type == EventType.Repaint)
{
Color orgColor = GUI.color;
GUI.color = orgColor * color;
LineStyle.Draw(position, false, false, false, false);
GUI.color = orgColor;
}
}
static public void MaterialDrawHeader(GUIContent guiContent)
{
var rect = GUILayoutUtility.GetRect(guiContent, MaterialHeaderStyle);
GUI.Label(rect, guiContent, MaterialHeaderStyleHighlight);
GUI.Label(rect, guiContent, MaterialHeaderStyle);
}
static public void MaterialDrawSeparator()
{
GUILayout.Space(4);
if(EditorGUIUtility.isProSkin)
DrawLine(new Color(.3f, .3f, .3f, 1f), 1);
else
DrawLine(new Color(.6f, .6f, .6f, 1f), 1);
GUILayout.Space(4);
}
static public void MaterialDrawSeparatorDouble()
{
GUILayout.Space(6);
if(EditorGUIUtility.isProSkin)
{
DrawLine(new Color(.1f, .1f, .1f, 1f), 1);
DrawLine(new Color(.4f, .4f, .4f, 1f), 1);
}
else
{
DrawLine(new Color(.3f, .3f, .3f, 1f), 1);
DrawLine(new Color(.9f, .9f, .9f, 1f), 1);
}
GUILayout.Space(6);
}
//built-in console icons, also used in help box
static Texture2D warnIcon;
static Texture2D infoIcon;
static Texture2D errorIcon;
static public void HelpBoxRichText(Rect position, string message, MessageType msgType)
{
Texture2D icon = null;
switch(msgType)
{
case MessageType.Warning: icon = warnIcon ?? (warnIcon = EditorGUIUtility.Load("console.warnicon") as Texture2D); break;
case MessageType.Info: icon = infoIcon ?? (infoIcon = EditorGUIUtility.Load("console.infoicon") as Texture2D); break;
case MessageType.Error: icon = errorIcon ?? (errorIcon = EditorGUIUtility.Load("console.erroricon") as Texture2D); break;
}
EditorGUI.LabelField(position, GUIContent.none, new GUIContent(message, icon), HelpBoxRichTextStyle);
}
static public void HelpBoxRichText(string message, MessageType msgType)
{
Texture2D icon = null;
switch(msgType)
{
case MessageType.Warning: icon = warnIcon ?? (warnIcon = EditorGUIUtility.Load("console.warnicon") as Texture2D); break;
case MessageType.Info: icon = infoIcon ?? (infoIcon = EditorGUIUtility.Load("console.infoicon") as Texture2D); break;
case MessageType.Error: icon = errorIcon ?? (errorIcon = EditorGUIUtility.Load("console.erroricon") as Texture2D); break;
}
EditorGUILayout.LabelField(GUIContent.none, new GUIContent(message, icon), HelpBoxRichTextStyle);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 26306333afc273640814fd7a7b3968e0
timeCreated: 1501149213
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ae70c5d833aa6d74e9429910c18b70c6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,163 @@
%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 ember blur 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
- _OVERLAYTEX_OFF
- _SINGLECHANNEL_ON
m_LightmapFlags: 4
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}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
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}
- _EmissionMap:
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: 209460ccb2aaaf847a61d7e73c92f193, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
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}
- _ParallaxMap:
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.5
- _DetailNormalMapScale: 1
- _DirLightScreenAtten: 1
- _DirectLightingMix: 0.5
- _DirectLightingRamp: 1
- _DissolveSmooth: 0.2
- _Distort: 0.1
- _DoubleDissolve: 0
- _DstBlend: 10
- _EdgeFadeMax: 2
- _EdgeFadeMin: 3
- _EdgeFadePow: 2
- _FadeAlongU: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _HdrBoost: 1
- _HdrMultiply: 10
- _IndirectLightingMix: 0.5
- _InvertDissolveTex: 0
- _LightingWorldPosStrength: 0.2
- _Metallic: 0
- _Mode: 0
- _OVERLAYBLEND: 0
- _OVERLAYTEX: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SecondColorSmooth: 0.2
- _ShadowStrength: 0.5
- _SingleChannel: 1
- _SmoothnessTextureChannel: 0
- _SoftParticlesFadeDistanceFar: 1
- _SoftParticlesFadeDistanceNear: 0
- _SpecularHighlights: 1
- _SrcBlend: 5
- _UVDistortionAdd: 0
- _UVSec: 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: 1, g: 1, b: 1, a: 1}
- _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: 1}
- _OverlayTex_Scroll: {r: 0.1, g: 0.1, b: 1, a: 1}
- _ShadowColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6cd2d08f4a4d93542aa0004bdac91566
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@@ -0,0 +1,121 @@
fileFormatVersion: 2
guid: 209460ccb2aaaf847a61d7e73c92f193
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:

View File

@@ -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 fire crisp fade hdr ab
m_Shader: {fileID: -6465566751694194690, guid: 1a29b4d27eb8b04479ef89c00dea533d,
type: 3}
m_ValidKeywords:
- _ALPHABLEND_ON
- _CFXR_DISSOLVE
- _CFXR_HDR_BOOST
- _CFXR_SINGLE_CHANNEL
- _CFXR_UV_DISTORTION
- _CFXR_UV_DISTORTION_ADD
- _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: 2800000, guid: bad5d0fa763e08742a9f746be9781732, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DistortTex:
m_Texture: {fileID: 2800000, guid: 74db0952acdd7ba488d3d0b114954504, type: 3}
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: 221462f4c3da8604c9dcc63641989a98, 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.05
- _Distort: 0.4
- _DoubleDissolve: 0
- _DstBlend: 10
- _EdgeFadePow: 1
- _FadeAlongU: 1
- _HdrBoost: 1
- _HdrMultiply: 8
- _IndirectLightingMix: 0.5
- _InvertDissolveTex: 0
- _LightingWorldPosStrength: 0.2
- _OVERLAYBLEND: 0
- _OVERLAYTEX: 0
- _ReceivedShadowsStrength: 0.5
- _SecondColorSmooth: 0.2
- _ShadowStrength: 1
- _SingleChannel: 1
- _SoftParticlesFadeDistanceFar: 1
- _SoftParticlesFadeDistanceNear: 0
- _SrcBlend: 5
- _UVDistortionAdd: 1
- _UseAlphaClip: 0
- _UseBackLighting: 0
- _UseDissolve: 1
- _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: 1
- _ZWrite: 0
m_Colors:
- _DissolveScroll: {r: 0, g: 0, b: 0, a: 0}
- _DistortScrolling: {r: 1, 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: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2e32f93f5ce765e47b0cabd37ce2b73d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,121 @@
fileFormatVersion: 2
guid: bad5d0fa763e08742a9f746be9781732
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: 1
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: 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:

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,121 @@
fileFormatVersion: 2
guid: 221462f4c3da8604c9dcc63641989a98
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: 1
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:

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

@@ -0,0 +1,99 @@
fileFormatVersion: 2
guid: 74db0952acdd7ba488d3d0b114954504
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
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: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 64
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 64
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 869785f887ca9d74f972d5727c91e1c8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,97 @@
fileFormatVersion: 2
guid: b10f0a773262b9c478542ff2d1a04863
ModelImporter:
serializedVersion: 23
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2100000: No Name
2300000: //RootNode
3300000: //RootNode
4300000: cfxr electric_arc_circle
externalObjects: {}
materials:
importMaterials: 0
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 0.2
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
importVisibility: 0
importBlendShapes: 0
importCameras: 0
importLights: 0
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
previousCalculatedGlobalScale: 1
hasPreviousCalculatedGlobalScale: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
importAnimation: 0
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,114 @@
fileFormatVersion: 2
guid: 1a6345b23d834ab4290d4498136e1abc
ModelImporter:
serializedVersion: 23
fileIDToRecycleName:
100000: //RootNode
100002: cfxr electric_barrier_01
100004: cfxr electric_barrier_02
100006: cfxr electric_barrier_03
100008: cfxr electric_barrier_04
400000: //RootNode
400002: cfxr electric_barrier_01
400004: cfxr electric_barrier_02
400006: cfxr electric_barrier_03
400008: cfxr electric_barrier_04
2100000: No Name
2300000: cfxr electric_barrier_01
2300002: cfxr electric_barrier_02
2300004: cfxr electric_barrier_03
2300006: cfxr electric_barrier_04
3300000: cfxr electric_barrier_01
3300002: cfxr electric_barrier_02
3300004: cfxr electric_barrier_03
3300006: cfxr electric_barrier_04
4300000: cfxr electric_barrier_01
4300002: cfxr electric_barrier_02
4300004: cfxr electric_barrier_03
4300006: cfxr electric_barrier_04
externalObjects: {}
materials:
importMaterials: 0
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
importVisibility: 0
importBlendShapes: 0
importCameras: 0
importLights: 0
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
previousCalculatedGlobalScale: 1
hasPreviousCalculatedGlobalScale: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
importAnimation: 0
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,97 @@
fileFormatVersion: 2
guid: 7874f2765cea0a547827d03a8933235d
ModelImporter:
serializedVersion: 23
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2100000: No Name
2300000: //RootNode
3300000: //RootNode
4300000: cfxr mesh disk
externalObjects: {}
materials:
importMaterials: 0
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
importVisibility: 0
importBlendShapes: 0
importCameras: 0
importLights: 0
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
previousCalculatedGlobalScale: 1
hasPreviousCalculatedGlobalScale: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
importAnimation: 0
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,97 @@
fileFormatVersion: 2
guid: 5d48695472dfda94b92ac5316397da95
ModelImporter:
serializedVersion: 19301
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 1
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,97 @@
fileFormatVersion: 2
guid: efd0ff1193063db498e9ddb30e96e4ee
ModelImporter:
serializedVersion: 23
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2100000: Material.001
2300000: //RootNode
3300000: //RootNode
4300000: cfxr mesh foam
externalObjects: {}
materials:
importMaterials: 0
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
importVisibility: 0
importBlendShapes: 0
importCameras: 0
importLights: 0
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
previousCalculatedGlobalScale: 1
hasPreviousCalculatedGlobalScale: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
importAnimation: 0
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,114 @@
fileFormatVersion: 2
guid: 192a51b0671a3e949b6876606c3205db
ModelImporter:
serializedVersion: 23
fileIDToRecycleName:
100000: cfxr particle_electric_arc_1
100002: //RootNode
100004: cfxr particle_electric_arc_2
100006: cfxr particle_electric_arc_3
100008: cfxr particle_electric_arc_4
400000: cfxr particle_electric_arc_1
400002: //RootNode
400004: cfxr particle_electric_arc_2
400006: cfxr particle_electric_arc_3
400008: cfxr particle_electric_arc_4
2100000: No Name
2300000: cfxr particle_electric_arc_1
2300002: cfxr particle_electric_arc_2
2300004: cfxr particle_electric_arc_3
2300006: cfxr particle_electric_arc_4
3300000: cfxr particle_electric_arc_1
3300002: cfxr particle_electric_arc_2
3300004: cfxr particle_electric_arc_3
3300006: cfxr particle_electric_arc_4
4300000: cfxr particle_electric_arc_1
4300002: cfxr particle_electric_arc_2
4300004: cfxr particle_electric_arc_3
4300006: cfxr particle_electric_arc_4
externalObjects: {}
materials:
importMaterials: 0
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 0.2
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
importVisibility: 0
importBlendShapes: 0
importCameras: 0
importLights: 0
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
previousCalculatedGlobalScale: 1
hasPreviousCalculatedGlobalScale: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
importAnimation: 0
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 90cebaa0afdacee48a8b5ea661f8a1a7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,3 @@
{
"name": "CFXRRuntime"
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 785156d0baf9e564e92265c9169511bb
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,287 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace CartoonFX
{
public partial class CFXR_Effect : MonoBehaviour
{
[System.Serializable]
public class CameraShake
{
public enum ShakeSpace
{
Screen,
World
}
static public bool editorPreview = true;
//--------------------------------------------------------------------------------------------------------------------------------
public bool enabled = false;
[Space]
public bool useMainCamera = true;
public List<Camera> cameras = new List<Camera>();
[Space]
public float delay = 0.0f;
public float duration = 1.0f;
public ShakeSpace shakeSpace = ShakeSpace.Screen;
public Vector3 shakeStrength = new Vector3(0.1f, 0.1f, 0.1f);
public AnimationCurve shakeCurve = AnimationCurve.Linear(0, 1, 1, 0);
[Space]
[Range(0, 0.1f)] public float shakesDelay = 0;
[System.NonSerialized] public bool isShaking;
Dictionary<Camera, Vector3> camerasPreRenderPosition = new Dictionary<Camera, Vector3>();
Vector3 shakeVector;
float delaysTimer;
//--------------------------------------------------------------------------------------------------------------------------------
// STATIC
// Use static methods to dispatch the Camera callbacks, to ensure that ScreenShake components are called in an order in PreRender,
// and in the _reverse_ order for PostRender, so that the final Camera position is the same as it is originally (allowing concurrent
// screen shake to be active)
static bool s_CallbackRegistered;
static List<CameraShake> s_CameraShakes = new List<CameraShake>();
#if UNITY_2019_1_OR_NEWER
static void OnPreRenderCamera_Static_URP(ScriptableRenderContext context, Camera cam)
{
OnPreRenderCamera_Static(cam);
}
static void OnPostRenderCamera_Static_URP(ScriptableRenderContext context, Camera cam)
{
OnPostRenderCamera_Static(cam);
}
#endif
static void OnPreRenderCamera_Static(Camera cam)
{
int count = s_CameraShakes.Count;
for (int i = 0; i < count; i++)
{
var ss = s_CameraShakes[i];
ss.onPreRenderCamera(cam);
}
}
static void OnPostRenderCamera_Static(Camera cam)
{
int count = s_CameraShakes.Count;
for (int i = count-1; i >= 0; i--)
{
var ss = s_CameraShakes[i];
ss.onPostRenderCamera(cam);
}
}
static void RegisterStaticCallback(CameraShake cameraShake)
{
s_CameraShakes.Add(cameraShake);
if (!s_CallbackRegistered)
{
#if UNITY_2019_1_OR_NEWER
#if UNITY_2019_3_OR_NEWER
if (GraphicsSettings.currentRenderPipeline == null)
#else
if (GraphicsSettings.renderPipelineAsset == null)
#endif
{
// Built-in Render Pipeline
Camera.onPreRender += OnPreRenderCamera_Static;
Camera.onPostRender += OnPostRenderCamera_Static;
}
else
{
// URP
RenderPipelineManager.beginCameraRendering += OnPreRenderCamera_Static_URP;
RenderPipelineManager.endCameraRendering += OnPostRenderCamera_Static_URP;
}
#else
Camera.onPreRender += OnPreRenderCamera_Static;
Camera.onPostRender += OnPostRenderCamera_Static;
#endif
s_CallbackRegistered = true;
}
}
static void UnregisterStaticCallback(CameraShake cameraShake)
{
s_CameraShakes.Remove(cameraShake);
if (s_CallbackRegistered && s_CameraShakes.Count == 0)
{
#if UNITY_2019_1_OR_NEWER
#if UNITY_2019_3_OR_NEWER
if (GraphicsSettings.currentRenderPipeline == null)
#else
if (GraphicsSettings.renderPipelineAsset == null)
#endif
{
// Built-in Render Pipeline
Camera.onPreRender -= OnPreRenderCamera_Static;
Camera.onPostRender -= OnPostRenderCamera_Static;
}
else
{
// URP
RenderPipelineManager.beginCameraRendering -= OnPreRenderCamera_Static_URP;
RenderPipelineManager.endCameraRendering -= OnPostRenderCamera_Static_URP;
}
#else
Camera.onPreRender -= OnPreRenderCamera_Static;
Camera.onPostRender -= OnPostRenderCamera_Static;
#endif
s_CallbackRegistered = false;
}
}
//--------------------------------------------------------------------------------------------------------------------------------
void onPreRenderCamera(Camera cam)
{
#if UNITY_EDITOR
//add scene view camera if necessary
if (SceneView.currentDrawingSceneView != null && SceneView.currentDrawingSceneView.camera == cam && !camerasPreRenderPosition.ContainsKey(cam))
{
camerasPreRenderPosition.Add(cam, cam.transform.localPosition);
}
#endif
if (isShaking && camerasPreRenderPosition.ContainsKey(cam))
{
camerasPreRenderPosition[cam] = cam.transform.localPosition;
if (Time.timeScale <= 0) return;
switch (shakeSpace)
{
case ShakeSpace.Screen: cam.transform.localPosition += cam.transform.rotation * shakeVector; break;
case ShakeSpace.World: cam.transform.localPosition += shakeVector; break;
}
}
}
void onPostRenderCamera(Camera cam)
{
if (camerasPreRenderPosition.ContainsKey(cam))
{
cam.transform.localPosition = camerasPreRenderPosition[cam];
}
}
public void fetchCameras()
{
#if UNITY_EDITOR
if (!EditorApplication.isPlayingOrWillChangePlaymode)
{
return;
}
#endif
foreach (var cam in cameras)
{
if (cam == null) continue;
camerasPreRenderPosition.Remove(cam);
}
cameras.Clear();
if (useMainCamera && Camera.main != null)
{
cameras.Add(Camera.main);
}
foreach (var cam in cameras)
{
if (cam == null) continue;
if (!camerasPreRenderPosition.ContainsKey(cam))
{
camerasPreRenderPosition.Add(cam, Vector3.zero);
}
}
}
public void StartShake()
{
if (isShaking)
{
StopShake();
}
isShaking = true;
RegisterStaticCallback(this);
}
public void StopShake()
{
isShaking = false;
shakeVector = Vector3.zero;
UnregisterStaticCallback(this);
}
public void animate(float time)
{
#if UNITY_EDITOR
if (!editorPreview && !EditorApplication.isPlaying)
{
shakeVector = Vector3.zero;
return;
}
#endif
float totalDuration = duration + delay;
if (time < totalDuration)
{
if (time < delay)
{
return;
}
if (!isShaking)
{
this.StartShake();
}
// duration of the camera shake
float delta = Mathf.Clamp01(time/totalDuration);
// delay between each camera move
if (shakesDelay > 0)
{
delaysTimer += Time.deltaTime;
if (delaysTimer < shakesDelay)
{
return;
}
else
{
while (delaysTimer >= shakesDelay)
{
delaysTimer -= shakesDelay;
}
}
}
var randomVec = new Vector3(Random.value, Random.value, Random.value);
var shakeVec = Vector3.Scale(randomVec, shakeStrength) * (Random.value > 0.5f ? -1 : 1);
shakeVector = shakeVec * shakeCurve.Evaluate(delta) * GLOBAL_CAMERA_SHAKE_MULTIPLIER;
}
else if (isShaking)
{
StopShake();
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 04efd1cc0f5c31c4da57d931c6665976
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,915 @@
//--------------------------------------------------------------------------------------------------------------------------------
// Cartoon FX
// (c) 2012-2025 Jean Moreno
//--------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------
// Use the defines below to globally disable features:
// #define DISABLE_CAMERA_SHAKE
// #define DISABLE_LIGHTS
// #define DISABLE_LIGHTS_LINEAR_REMAPPING
// #define DISABLE_CLEAR_BEHAVIOR
//--------------------------------------------------------------------------------------------------------------------------------
using UnityEngine;
using UnityEngine.Rendering;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace CartoonFX
{
[RequireComponent(typeof(ParticleSystem))]
[DisallowMultipleComponent]
public partial class CFXR_Effect : MonoBehaviour
{
// Change this value to easily tune the camera shake strength for all effects
const float GLOBAL_CAMERA_SHAKE_MULTIPLIER = 1.0f;
static readonly int _GameObjectWorldPosition = Shader.PropertyToID("_GameObjectWorldPosition");
#if UNITY_EDITOR
[InitializeOnLoadMethod]
static void InitGlobalOptions()
{
AnimatedLight.editorPreview = EditorPrefs.GetBool("CFXR Light EditorPreview", true);
#if !DISABLE_CAMERA_SHAKE
CameraShake.editorPreview = EditorPrefs.GetBool("CFXR CameraShake EditorPreview", true);
#endif
}
#endif
public enum ClearBehavior
{
None,
Disable,
Destroy
}
[System.Serializable]
public class AnimatedLight
{
static public bool editorPreview = true;
public Light light;
public bool loop;
public bool animateIntensity;
public float intensityStart = 8f;
public float intensityEnd = 0f;
public float intensityDuration = 0.5f;
public AnimationCurve intensityCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
public bool perlinIntensity;
public float perlinIntensitySpeed = 1f;
public bool fadeIn;
public float fadeInDuration = 0.5f;
public bool fadeOut;
public float fadeOutDuration = 0.5f;
public bool animateRange;
public float rangeStart = 8f;
public float rangeEnd = 0f;
public float rangeDuration = 0.5f;
public AnimationCurve rangeCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
public bool perlinRange;
public float perlinRangeSpeed = 1f;
public bool animateColor;
public Gradient colorGradient;
public float colorDuration = 0.5f;
public AnimationCurve colorCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
public bool perlinColor;
public float perlinColorSpeed = 1f;
public void animate(float time)
{
#if UNITY_EDITOR
if (!editorPreview && !EditorApplication.isPlaying)
{
return;
}
#endif
if (light != null)
{
if (animateIntensity)
{
float delta = loop ? Mathf.Clamp01((time % intensityDuration)/intensityDuration) : Mathf.Clamp01(time/intensityDuration);
delta = perlinIntensity ? Mathf.PerlinNoise(Time.time * perlinIntensitySpeed, 0f) : intensityCurve.Evaluate(delta);
light.intensity = Mathf.LerpUnclamped(intensityEnd, intensityStart, delta);
if (fadeIn && time < fadeInDuration)
{
light.intensity *= Mathf.Clamp01(time / fadeInDuration);
}
}
if (animateRange)
{
float delta = loop ? Mathf.Clamp01((time % rangeDuration)/rangeDuration) : Mathf.Clamp01(time/rangeDuration);
delta = perlinRange ? Mathf.PerlinNoise(Time.time * perlinRangeSpeed, 10f) : rangeCurve.Evaluate(delta);
light.range = Mathf.LerpUnclamped(rangeEnd, rangeStart, delta);
}
if (animateColor)
{
float delta = loop ? Mathf.Clamp01((time % colorDuration)/colorDuration) : Mathf.Clamp01(time/colorDuration);
delta = perlinColor ? Mathf.PerlinNoise(Time.time * perlinColorSpeed, 0f) : colorCurve.Evaluate(delta);
light.color = colorGradient.Evaluate(delta);
}
}
}
public void animateFadeOut(float time)
{
if (fadeOut && light != null)
{
light.intensity *= 1.0f - Mathf.Clamp01(time / fadeOutDuration);
}
}
public void reset()
{
if (light != null)
{
if (animateIntensity)
{
light.intensity = (fadeIn || fadeOut) ? 0 : intensityEnd;
}
if (animateRange)
{
light.range = rangeEnd;
}
if (animateColor)
{
light.color = colorGradient.Evaluate(1f);
}
}
}
#region Animated Light Property Drawer
#if UNITY_EDITOR
[CustomPropertyDrawer(typeof(AnimatedLight))]
public class AnimatedLightDrawer : PropertyDrawer
{
SerializedProperty light;
SerializedProperty loop;
SerializedProperty animateIntensity;
SerializedProperty intensityStart;
SerializedProperty intensityEnd;
SerializedProperty intensityDuration;
SerializedProperty intensityCurve;
SerializedProperty perlinIntensity;
SerializedProperty perlinIntensitySpeed;
SerializedProperty fadeIn;
SerializedProperty fadeInDuration;
SerializedProperty fadeOut;
SerializedProperty fadeOutDuration;
SerializedProperty animateRange;
SerializedProperty rangeStart;
SerializedProperty rangeEnd;
SerializedProperty rangeDuration;
SerializedProperty rangeCurve;
SerializedProperty perlinRange;
SerializedProperty perlinRangeSpeed;
SerializedProperty animateColor;
SerializedProperty colorGradient;
SerializedProperty colorDuration;
SerializedProperty colorCurve;
SerializedProperty perlinColor;
SerializedProperty perlinColorSpeed;
void fetchProperties(SerializedProperty property)
{
light = property.FindPropertyRelative("light");
loop = property.FindPropertyRelative("loop");
animateIntensity = property.FindPropertyRelative("animateIntensity");
intensityStart = property.FindPropertyRelative("intensityStart");
intensityEnd = property.FindPropertyRelative("intensityEnd");
intensityDuration = property.FindPropertyRelative("intensityDuration");
intensityCurve = property.FindPropertyRelative("intensityCurve");
perlinIntensity = property.FindPropertyRelative("perlinIntensity");
perlinIntensitySpeed = property.FindPropertyRelative("perlinIntensitySpeed");
fadeIn = property.FindPropertyRelative("fadeIn");
fadeInDuration = property.FindPropertyRelative("fadeInDuration");
fadeOut = property.FindPropertyRelative("fadeOut");
fadeOutDuration = property.FindPropertyRelative("fadeOutDuration");
animateRange = property.FindPropertyRelative("animateRange");
rangeStart = property.FindPropertyRelative("rangeStart");
rangeEnd = property.FindPropertyRelative("rangeEnd");
rangeDuration = property.FindPropertyRelative("rangeDuration");
rangeCurve = property.FindPropertyRelative("rangeCurve");
perlinRange = property.FindPropertyRelative("perlinRange");
perlinRangeSpeed = property.FindPropertyRelative("perlinRangeSpeed");
animateColor = property.FindPropertyRelative("animateColor");
colorGradient = property.FindPropertyRelative("colorGradient");
colorDuration = property.FindPropertyRelative("colorDuration");
colorCurve = property.FindPropertyRelative("colorCurve");
perlinColor = property.FindPropertyRelative("perlinColor");
perlinColorSpeed = property.FindPropertyRelative("perlinColorSpeed");
}
static GUIContent[] ModePopupLabels = new GUIContent[] { new GUIContent("Curve"), new GUIContent("Perlin Noise") };
static GUIContent IntensityModeLabel = new GUIContent("Intensity Mode");
static GUIContent RangeModeLabel = new GUIContent("Range Mode");
static GUIContent ColorModeLabel = new GUIContent("Color Mode");
const float INDENT_WIDTH = 15f;
const float PADDING = 4f;
void startIndent(ref Rect rect)
{
EditorGUIUtility.labelWidth -= INDENT_WIDTH;
rect.xMin += INDENT_WIDTH;
}
void endIndent(ref Rect rect)
{
EditorGUIUtility.labelWidth += INDENT_WIDTH;
rect.xMin -= INDENT_WIDTH;
}
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
fetchProperties(property);
Rect rect = EditorGUI.IndentedRect(position);
//Rect lineRect = rect;
//lineRect.height = 1;
//lineRect.y -= 2;
//EditorGUI.DrawRect(lineRect, Color.gray);
if (Event.current.type == EventType.Repaint)
{
EditorStyles.helpBox.Draw(rect, GUIContent.none, 0);
}
EditorGUIUtility.labelWidth -= INDENT_WIDTH;
rect.height = EditorGUIUtility.singleLineHeight;
rect.xMax -= PADDING;
rect.y += PADDING;
float propSpace = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(rect, light); rect.y += propSpace;
EditorGUI.PropertyField(rect, loop); rect.y += propSpace;
EditorGUI.PropertyField(rect, animateIntensity); rect.y += propSpace;
if (animateIntensity.boolValue)
{
startIndent(ref rect);
{
EditorGUI.PropertyField(rect, intensityStart); rect.y += propSpace;
EditorGUI.PropertyField(rect, intensityEnd); rect.y += propSpace;
int val = EditorGUI.Popup(rect, IntensityModeLabel, perlinIntensity.boolValue ? 1 : 0, ModePopupLabels); rect.y += propSpace;
if (val == 1 && !perlinIntensity.boolValue)
{
perlinIntensity.boolValue = true;
}
else if (val == 0 && perlinIntensity.boolValue)
{
perlinIntensity.boolValue = false;
}
startIndent(ref rect);
{
if (perlinIntensity.boolValue)
{
EditorGUI.PropertyField(rect, perlinIntensitySpeed); rect.y += propSpace;
}
else
{
EditorGUI.PropertyField(rect, intensityDuration); rect.y += propSpace;
EditorGUI.PropertyField(rect, intensityCurve); rect.y += propSpace;
}
}
endIndent(ref rect);
EditorGUI.PropertyField(rect, fadeIn); rect.y += propSpace;
if (fadeIn.boolValue)
{
startIndent(ref rect);
EditorGUI.PropertyField(rect, fadeInDuration); rect.y += propSpace;
endIndent(ref rect);
}
EditorGUI.PropertyField(rect, fadeOut); rect.y += propSpace;
if (fadeOut.boolValue)
{
startIndent(ref rect);
EditorGUI.PropertyField(rect, fadeOutDuration); rect.y += propSpace;
endIndent(ref rect);
}
}
endIndent(ref rect);
}
EditorGUI.PropertyField(rect, animateRange); rect.y += propSpace;
if (animateRange.boolValue)
{
startIndent(ref rect);
{
EditorGUI.PropertyField(rect, rangeStart); rect.y += propSpace;
EditorGUI.PropertyField(rect, rangeEnd); rect.y += propSpace;
int val = EditorGUI.Popup(rect, RangeModeLabel, perlinRange.boolValue ? 1 : 0, ModePopupLabels); rect.y += propSpace;
if (val == 1 && !perlinRange.boolValue)
{
perlinRange.boolValue = true;
}
else if (val == 0 && perlinRange.boolValue)
{
perlinRange.boolValue = false;
}
startIndent(ref rect);
{
if (perlinRange.boolValue)
{
EditorGUI.PropertyField(rect, perlinRangeSpeed); rect.y += propSpace;
}
else
{
EditorGUI.PropertyField(rect, rangeDuration); rect.y += propSpace;
EditorGUI.PropertyField(rect, rangeCurve); rect.y += propSpace;
}
}
endIndent(ref rect);
}
endIndent(ref rect);
}
EditorGUI.PropertyField(rect, animateColor); rect.y += propSpace;
if (animateColor.boolValue)
{
startIndent(ref rect);
{
EditorGUI.PropertyField(rect, colorGradient); rect.y += propSpace;
int val = EditorGUI.Popup(rect, ColorModeLabel, perlinColor.boolValue ? 1 : 0, ModePopupLabels); rect.y += propSpace;
if (val == 1 && !perlinColor.boolValue)
{
perlinColor.boolValue = true;
}
else if (val == 0 && perlinColor.boolValue)
{
perlinColor.boolValue = false;
}
startIndent(ref rect);
{
if (perlinColor.boolValue)
{
EditorGUI.PropertyField(rect, perlinColorSpeed); rect.y += propSpace;
}
else
{
EditorGUI.PropertyField(rect, colorDuration); rect.y += propSpace;
EditorGUI.PropertyField(rect, colorCurve); rect.y += propSpace;
}
}
endIndent(ref rect);
}
endIndent(ref rect);
}
EditorGUIUtility.labelWidth += INDENT_WIDTH;
if (GUI.changed)
{
property.serializedObject.ApplyModifiedProperties();
}
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
fetchProperties(property);
float propSpace = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
int count = 5;
if (animateIntensity.boolValue)
{
count += 3;
count += perlinIntensity.boolValue ? 1 : 2;
count += 1;
count += fadeIn.boolValue ? 1 : 0;
count += 1;
count += fadeOut.boolValue ? 1 : 0;
}
if (animateRange.boolValue)
{
count += 3;
count += perlinRange.boolValue ? 1 : 2;
}
if (animateColor.boolValue)
{
count += 2;
count += perlinColor.boolValue ? 1 : 2;
}
return count * propSpace + PADDING * 2;
}
}
#endif
#endregion
}
// ================================================================================================================================
// Globally disable features
public static bool GlobalDisableCameraShake;
public static bool GlobalDisableLights;
// ================================================================================================================================
[Tooltip("Defines an action to execute when the Particle System has completely finished playing and emitting particles.")]
public ClearBehavior clearBehavior = ClearBehavior.Destroy;
[Space]
public CameraShake cameraShake;
[Space]
public AnimatedLight[] animatedLights;
[Tooltip("Defines which Particle System to track to trigger light fading out.\nLeave empty if not using fading out.")]
public ParticleSystem fadeOutReference;
#if !DISABLE_LIGHTS || !DISABLE_CAMERA_SHAKE
float time;
#endif
ParticleSystem rootParticleSystem;
[System.NonSerialized] MaterialPropertyBlock materialPropertyBlock;
[System.NonSerialized] Renderer particleRenderer;
// ================================================================================================================================
public void ResetState()
{
#if !DISABLE_LIGHTS || !DISABLE_CAMERA_SHAKE
time = 0f;
#endif
#if !DISABLE_LIGHTS
fadingOutStartTime = 0f;
isFadingOut = false;
if (animatedLights != null)
{
foreach (var animLight in animatedLights)
{
animLight.reset();
}
}
#endif
#if !DISABLE_CAMERA_SHAKE
if (cameraShake != null && cameraShake.enabled)
{
cameraShake.StopShake();
}
#endif
}
#if !DISABLE_CAMERA_SHAKE || !DISABLE_CLEAR_BEHAVIOR
void Awake()
{
#if !DISABLE_CAMERA_SHAKE
if (cameraShake != null && cameraShake.enabled)
{
cameraShake.fetchCameras();
}
#endif
#if !DISABLE_CLEAR_BEHAVIOR
startFrameOffset = GlobalStartFrameOffset++;
#endif
// Detect if world position needs to be passed to the shader
particleRenderer = this.GetComponent<ParticleSystemRenderer>();
if (particleRenderer.sharedMaterial != null && particleRenderer.sharedMaterial.IsKeywordEnabled("_CFXR_LIGHTING_WPOS_OFFSET"))
{
materialPropertyBlock = new MaterialPropertyBlock();
}
#if !DISABLE_LIGHTS && !DISABLE_LIGHTS_LINEAR_REMAPPING
// Lights were calibrated using the built-in rendering pipeline, but
// when using URP their intensities are transmitted using linear values.
// This internal Unity flag defines that behavior, so we compensate here
// such that original values remain.
if (!GraphicsSettings.lightsUseLinearIntensity && animatedLights != null)
{
foreach (var animLight in animatedLights)
{
animLight.intensityStart = Mathf.LinearToGammaSpace(animLight.intensityStart);
animLight.intensityEnd = Mathf.LinearToGammaSpace(animLight.intensityEnd);
}
}
#endif
}
#endif
void OnEnable()
{
foreach (var animLight in animatedLights)
{
if (animLight.light != null)
{
#if !DISABLE_LIGHTS
animLight.light.enabled = !GlobalDisableLights;
#else
animLight.light.enabled = false;
#endif
}
}
}
void OnDisable()
{
ResetState();
}
#if !DISABLE_LIGHTS || !DISABLE_CAMERA_SHAKE || !DISABLE_CLEAR_BEHAVIOR
const int CHECK_EVERY_N_FRAME = 20;
#if !DISABLE_CLEAR_BEHAVIOR
static int GlobalStartFrameOffset;
#endif
int startFrameOffset;
void Update()
{
#if !DISABLE_LIGHTS || !DISABLE_CAMERA_SHAKE
time += Time.deltaTime;
Animate(time);
#if !DISABLE_LIGHTS
if (fadeOutReference != null && !fadeOutReference.isEmitting && (fadeOutReference.isPlaying || isFadingOut))
{
FadeOut(time);
}
#endif
#endif
#if !DISABLE_CLEAR_BEHAVIOR
if (clearBehavior != ClearBehavior.None)
{
if (rootParticleSystem == null)
{
rootParticleSystem = this.GetComponent<ParticleSystem>();
}
// Check isAlive every N frame, with an offset so that all active effects aren't checked at once
if ((Time.renderedFrameCount + startFrameOffset) % CHECK_EVERY_N_FRAME == 0)
{
if (!rootParticleSystem.IsAlive(true))
{
if (clearBehavior == ClearBehavior.Destroy)
{
GameObject.Destroy(this.gameObject);
}
else
{
this.gameObject.SetActive(false);
}
}
}
}
#endif
if (materialPropertyBlock != null)
{
particleRenderer.GetPropertyBlock(materialPropertyBlock);
materialPropertyBlock.SetVector(_GameObjectWorldPosition, this.transform.position);
particleRenderer.SetPropertyBlock(materialPropertyBlock);
}
}
#endif
#if !DISABLE_LIGHTS || !DISABLE_CAMERA_SHAKE
public void Animate(float _time)
{
#if !DISABLE_LIGHTS
if (animatedLights != null && !GlobalDisableLights)
{
foreach (var animLight in animatedLights)
{
animLight.animate(_time);
}
}
#endif
#if !DISABLE_CAMERA_SHAKE
if (cameraShake != null && cameraShake.enabled && !GlobalDisableCameraShake)
{
#if UNITY_EDITOR
if (!cameraShake.isShaking)
{
cameraShake.fetchCameras();
}
#endif
cameraShake.animate(_time);
}
#endif
}
#endif
#if !DISABLE_LIGHTS
bool isFadingOut;
float fadingOutStartTime;
public void FadeOut(float _time)
{
if (animatedLights == null)
{
return;
}
if (!isFadingOut)
{
isFadingOut = true;
fadingOutStartTime = _time;
}
foreach (var animLight in animatedLights)
{
animLight.animateFadeOut(_time - fadingOutStartTime);
}
}
#endif
#if UNITY_EDITOR
// Editor preview
// Detect when the Particle System is previewing and trigger this animation too
[System.NonSerialized] ParticleSystem _parentParticle;
ParticleSystem parentParticle
{
get
{
if (_parentParticle == null)
{
_parentParticle = this.GetComponent<ParticleSystem>();
}
return _parentParticle;
}
}
[System.NonSerialized] public bool editorUpdateRegistered;
[System.NonSerialized] bool particleWasStopped;
[System.NonSerialized] float particleTime;
#if !DISABLE_LIGHTS || !DISABLE_CAMERA_SHAKE
[System.NonSerialized] float particleTimeUnwrapped;
#endif
void OnDestroy()
{
UnregisterEditorUpdate();
}
public void RegisterEditorUpdate()
{
var type = PrefabUtility.GetPrefabAssetType(this.gameObject);
var status = PrefabUtility.GetPrefabInstanceStatus(this.gameObject);
// Prefab in Project window
if (type is PrefabAssetType.Regular or PrefabAssetType.Variant && status == PrefabInstanceStatus.NotAPrefab)
{
return;
}
if (!editorUpdateRegistered)
{
EditorApplication.update += onEditorUpdate;
editorUpdateRegistered = true;
}
}
public void UnregisterEditorUpdate()
{
if (editorUpdateRegistered)
{
editorUpdateRegistered = false;
EditorApplication.update -= onEditorUpdate;
}
ResetState();
}
void onEditorUpdate()
{
if (EditorApplication.isPlayingOrWillChangePlaymode)
{
return;
}
if (this == null)
{
return;
}
var rend = this.GetComponent<ParticleSystemRenderer>();
if (rend.sharedMaterial != null && rend.sharedMaterial.IsKeywordEnabled("_CFXR_LIGHTING_WPOS_OFFSET"))
{
if (materialPropertyBlock == null)
{
materialPropertyBlock = new MaterialPropertyBlock();
}
rend.GetPropertyBlock(materialPropertyBlock);
materialPropertyBlock.SetVector(_GameObjectWorldPosition, this.transform.position);
rend.SetPropertyBlock(materialPropertyBlock);
}
// Need to track unwrapped time when playing back from Editor
// because the parentParticle.time will be reset at each loop
float delta = parentParticle.time - particleTime;
if (delta < 0 && parentParticle.isPlaying)
{
delta = parentParticle.main.duration + delta;
if (delta > 0.1 || delta < 0)
{
// try to detect when "Restart" is pressed
ResetState();
#if !DISABLE_LIGHTS || !DISABLE_CAMERA_SHAKE
particleTimeUnwrapped = 0;
#endif
delta = 0;
}
}
#if !DISABLE_LIGHTS || !DISABLE_CAMERA_SHAKE
particleTimeUnwrapped += delta;
#endif
if (particleTime != parentParticle.time)
{
#if !DISABLE_CAMERA_SHAKE
if (cameraShake != null && cameraShake.enabled && parentParticle.time < particleTime && parentParticle.time < 0.05f)
{
cameraShake.StartShake();
}
#endif
#if !DISABLE_LIGHTS || !DISABLE_CAMERA_SHAKE
Animate(particleTimeUnwrapped);
#if !DISABLE_LIGHTS
if (!parentParticle.isEmitting)
{
FadeOut(particleTimeUnwrapped);
}
#endif
#endif
}
if (particleWasStopped != parentParticle.isStopped)
{
if (parentParticle.isStopped)
{
ResetState();
}
#if !DISABLE_LIGHTS || !DISABLE_CAMERA_SHAKE
particleTimeUnwrapped = 0;
#endif
}
particleWasStopped = parentParticle.isStopped;
particleTime = parentParticle.time;
}
#endif
}
#if UNITY_EDITOR
[CustomEditor(typeof(CFXR_Effect))]
[CanEditMultipleObjects]
public class CFXR_Effect_Editor : Editor
{
bool? lightEditorPreview;
bool? shakeEditorPreview;
GUIStyle _PaddedRoundedRect;
GUIStyle PaddedRoundedRect
{
get
{
if (_PaddedRoundedRect == null)
{
_PaddedRoundedRect = new GUIStyle(EditorStyles.helpBox);
_PaddedRoundedRect.padding = new RectOffset(4, 4, 4, 4);
}
return _PaddedRoundedRect;
}
}
public override void OnInspectorGUI()
{
GlobalOptionsGUI();
#if DISABLE_CAMERA_SHAKE
EditorGUILayout.HelpBox("Camera Shake has been globally disabled in the code.\nThe properties remain to avoid data loss but the shaking won't be applied for any effect.", MessageType.Info);
#endif
base.OnInspectorGUI();
}
void GlobalOptionsGUI()
{
EditorGUILayout.BeginVertical(PaddedRoundedRect);
{
GUILayout.Label("Editor Preview:", EditorStyles.boldLabel);
if (lightEditorPreview == null)
{
lightEditorPreview = EditorPrefs.GetBool("CFXR Light EditorPreview", true);
}
bool lightPreview = EditorGUILayout.Toggle("Light Animations", lightEditorPreview.Value);
if (lightPreview != lightEditorPreview.Value)
{
lightEditorPreview = lightPreview;
EditorPrefs.SetBool("CFXR Light EditorPreview", lightPreview);
CFXR_Effect.AnimatedLight.editorPreview = lightPreview;
}
#if !DISABLE_CAMERA_SHAKE
if (shakeEditorPreview == null)
{
shakeEditorPreview = EditorPrefs.GetBool("CFXR CameraShake EditorPreview", true);
}
bool shakePreview = EditorGUILayout.Toggle("Camera Shake", shakeEditorPreview.Value);
if (shakePreview != shakeEditorPreview.Value)
{
shakeEditorPreview = shakePreview;
EditorPrefs.SetBool("CFXR CameraShake EditorPreview", shakePreview);
CFXR_Effect.CameraShake.editorPreview = shakePreview;
}
#endif
}
EditorGUILayout.EndVertical();
}
void OnEnable()
{
if (this.targets == null)
{
return;
}
foreach (var t in this.targets)
{
var cfxr_effect = t as CFXR_Effect;
if (cfxr_effect != null)
{
if (isPrefabSource(cfxr_effect.gameObject))
{
return;
}
cfxr_effect.RegisterEditorUpdate();
}
}
}
void OnDisable()
{
if (this.targets == null)
{
return;
}
foreach (var t in this.targets)
{
// Can be null if GameObject has been destroyed
var cfxr_effect = t as CFXR_Effect;
if (cfxr_effect != null)
{
if (isPrefabSource(cfxr_effect.gameObject))
{
return;
}
cfxr_effect.UnregisterEditorUpdate();
}
}
}
static bool isPrefabSource(GameObject gameObject)
{
var assetType = PrefabUtility.GetPrefabAssetType(gameObject);
var prefabType = PrefabUtility.GetPrefabInstanceStatus(gameObject);
return ((assetType == PrefabAssetType.Regular || assetType == PrefabAssetType.Variant) && prefabType == PrefabInstanceStatus.NotAPrefab);
}
}
#endif
}
;

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9205bc1bbacc90040a998067b5643d16
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,195 @@
using System;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace CartoonFX
{
[RequireComponent(typeof(ParticleSystem))]
public class CFXR_EmissionBySurface : MonoBehaviour
{
public bool active = true;
public float particlesPerUnit = 10;
[Tooltip("This is to avoid slowdowns in the Editor if the value gets too high")] public float maxEmissionRate = 5000;
[HideInInspector] public float density = 0;
bool attachedToEditor;
ParticleSystem ps;
#if UNITY_EDITOR
void OnValidate()
{
this.hideFlags = HideFlags.DontSaveInBuild;
CalculateAndUpdateEmission();
}
internal void AttachToEditor()
{
if (attachedToEditor) return;
EditorApplication.update += OnEditorUpdate;
attachedToEditor = true;
}
internal void DetachFromEditor()
{
if (!attachedToEditor) return;
EditorApplication.update -= OnEditorUpdate;
attachedToEditor = false;
}
void OnEditorUpdate()
{
CalculateAndUpdateEmission();
if (!System.Array.Exists(Selection.gameObjects, item => item == this.gameObject))
{
DetachFromEditor();
}
}
void CalculateAndUpdateEmission()
{
if (!active) return;
if (this == null) return;
if (ps == null) ps = this.GetComponent<ParticleSystem>();
density = CalculateShapeDensity(ps.shape, ps.main.scalingMode == ParticleSystemScalingMode.Shape, this.transform);
if (density == 0) return;
float emissionOverTime = density * particlesPerUnit;
ParticleSystem.EmissionModule emission = ps.emission;
if (Math.Abs(emission.rateOverTime.constant - emissionOverTime) > 0.1f)
{
emission.rateOverTime = Mathf.Min(maxEmissionRate, emissionOverTime);
}
}
float CalculateShapeDensity(ParticleSystem.ShapeModule shapeModule, bool isShapeScaling, Transform transform)
{
float arcPercentage = Mathf.Max(0.01f, shapeModule.arc / 360f);
float thicknessPercentage = Mathf.Max(0.01f, 1.0f - shapeModule.radiusThickness);
float scaleX = shapeModule.scale.x;
float scaleY = shapeModule.scale.y;
float scaleZ = shapeModule.scale.z;
if (isShapeScaling)
{
Vector3 localScale = Quaternion.Euler(shapeModule.rotation) * transform.localScale;
scaleX = scaleX * localScale.x;
scaleY = scaleY * localScale.y;
scaleZ = scaleZ * localScale.z;
}
scaleX = Mathf.Abs(scaleX);
scaleY = Mathf.Abs(scaleY);
scaleZ = Mathf.Abs(scaleZ);
switch (shapeModule.shapeType)
{
case ParticleSystemShapeType.Hemisphere:
case ParticleSystemShapeType.Sphere:
{
float rX = shapeModule.radius * scaleX;
float rY = shapeModule.radius * scaleY;
float rZ = shapeModule.radius * scaleZ;
float rmX = rX * thicknessPercentage;
float rmY = rY * thicknessPercentage;
float rmZ = rZ * thicknessPercentage;
float volume = (rX * rY * rZ - rmX * rmY * rmZ) * Mathf.PI;
if (shapeModule.shapeType == ParticleSystemShapeType.Hemisphere)
{
volume /= 2.0f;
}
return volume * arcPercentage;
}
case ParticleSystemShapeType.Cone:
{
float innerDisk = shapeModule.radius * scaleX * thicknessPercentage * shapeModule.radius * scaleY * thicknessPercentage * Mathf.PI;
float outerDisk = shapeModule.radius *scaleX * shapeModule.radius * scaleY * Mathf.PI;
return outerDisk - innerDisk;
}
case ParticleSystemShapeType.ConeVolume:
{
// cylinder volume, changing the angle doesn't actually extend the area from where the particles are emitted
float innerCylinder = shapeModule.radius * scaleX * thicknessPercentage * shapeModule.radius * scaleY * thicknessPercentage * Mathf.PI * shapeModule.length * scaleZ;
float outerCylinder = shapeModule.radius * scaleX * shapeModule.radius * scaleY * Mathf.PI * shapeModule.length * scaleZ;
return outerCylinder - innerCylinder;
}
case ParticleSystemShapeType.BoxEdge:
case ParticleSystemShapeType.BoxShell:
case ParticleSystemShapeType.Box:
{
return scaleX * scaleY * scaleZ;
}
case ParticleSystemShapeType.Circle:
{
float radiusX = shapeModule.radius * scaleX;
float radiusY = shapeModule.radius * scaleY;
float radiusMinX = radiusX * thicknessPercentage;
float radiusMinY = radiusY * thicknessPercentage;
float area = (radiusX * radiusY - radiusMinX * radiusMinY) * Mathf.PI;
return area * arcPercentage;
}
case ParticleSystemShapeType.SingleSidedEdge:
{
return shapeModule.radius * scaleX;
}
case ParticleSystemShapeType.Donut:
{
float outerDonutVolume = 2 * Mathf.PI * Mathf.PI * shapeModule.donutRadius * shapeModule.donutRadius * shapeModule.radius * arcPercentage;
float innerDonutVolume = 2 * Mathf.PI * Mathf.PI * shapeModule.donutRadius * thicknessPercentage * thicknessPercentage * shapeModule.donutRadius * shapeModule.radius * arcPercentage;
return (outerDonutVolume - innerDonutVolume) * scaleX * scaleY * scaleZ;
}
case ParticleSystemShapeType.Rectangle:
{
return scaleX * scaleY;
}
case ParticleSystemShapeType.Mesh:
case ParticleSystemShapeType.SkinnedMeshRenderer:
case ParticleSystemShapeType.MeshRenderer:
{
Debug.LogWarning( string.Format("[{0}] Calculating volume for a mesh is unsupported.", nameof(CFXR_EmissionBySurface)));
this.active = false;
return 0;
}
case ParticleSystemShapeType.Sprite:
case ParticleSystemShapeType.SpriteRenderer:
{
Debug.LogWarning( string.Format("[{0}] Calculating volume for a sprite is unsupported.", nameof(CFXR_EmissionBySurface)));
this.active = false;
return 0;
}
}
return 0;
}
#endif
}
#if UNITY_EDITOR
[CustomEditor(typeof(CFXR_EmissionBySurface))]
class CFXR_EmissionBySurface_Editor : Editor
{
CFXR_EmissionBySurface Target { get { return target as CFXR_EmissionBySurface; } }
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
GUILayout.Space(10);
EditorGUILayout.HelpBox("This Editor script will adapt the particle emission based on its shape density, so that you can resize it to fit a specific situation and the overall number of particles won't change.\n\nYou can scale the object to change the emission area, and you can open the 'Shape' module in the Particle System to visualize the emission area.", MessageType.Info);
EditorGUILayout.HelpBox("Calculated Density: " + Target.density, MessageType.None);
}
void OnEnable()
{
Target.AttachToEditor();
}
void OnDisable()
{
Target.DetachFromEditor();
}
}
#endif
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 403cb51292a8b3c4c870cccfc0e68659
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,419 @@
//--------------------------------------------------------------------------------------------------------------------------------
// Cartoon FX
// (c) 2012-2025 Jean Moreno
//--------------------------------------------------------------------------------------------------------------------------------
using System.Collections.Generic;
using UnityEngine;
using Object = UnityEngine.Object;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace CartoonFX
{
[RequireComponent(typeof(ParticleSystem))]
public class CFXR_ParticleText : MonoBehaviour
{
[Header("Dynamic")]
[Tooltip("Allow changing the text at runtime with the 'UpdateText' method. If disabled, this script will be excluded from the build.")]
public bool isDynamic;
[Header("Text")]
[SerializeField] string text;
[SerializeField] float size = 1f;
[SerializeField] float letterSpacing = 0.44f;
[Header("Colors")]
[SerializeField] Color backgroundColor = new Color(0, 0, 0, 1);
[SerializeField] Color color1 = new Color(1, 1, 1, 1);
[SerializeField] Color color2 = new Color(0, 0, 1, 1);
[Header("Delay")]
[SerializeField] float delay = 0.05f;
[SerializeField] bool cumulativeDelay = false;
[Range(0f, 2f)] [SerializeField] float compensateLifetime = 0;
[Header("Misc")]
[SerializeField] float lifetimeMultiplier = 1f;
[Range(-90f, 90f)] [SerializeField] float rotation = -5f;
[SerializeField] float sortingFudgeOffset = 0.1f;
#pragma warning disable 0649
[SerializeField] CFXR_ParticleTextFontAsset font;
#pragma warning restore 0649
#if UNITY_EDITOR
[HideInInspector] [SerializeField] bool autoUpdateEditor = true;
void OnValidate()
{
if (text == null || font == null)
{
return;
}
// parse text to only allow valid characters
List<char> allowed = new List<char>(font.CharSequence.ToCharArray());
allowed.Add(' ');
char[] chars;
switch (font.letterCase)
{
case CFXR_ParticleTextFontAsset.LetterCase.Lower: chars = text.ToLowerInvariant().ToCharArray(); break;
case CFXR_ParticleTextFontAsset.LetterCase.Upper: chars = text.ToUpperInvariant().ToCharArray(); break;
default:
case CFXR_ParticleTextFontAsset.LetterCase.Both: chars = text.ToCharArray(); break;
}
string newText = "";
foreach (var c in chars)
{
if (allowed.Contains(c))
{
newText += c;
}
}
text = newText;
// prevent negative or 0 size
size = Mathf.Max(0.001f, size);
// delay so that we are allowed to destroy GameObjects
if (autoUpdateEditor && !EditorApplication.isPlayingOrWillChangePlaymode)
{
EditorApplication.delayCall += () => { UpdateText(null); };
}
}
#endif
void Awake()
{
if (!isDynamic)
{
Destroy(this);
return;
}
InitializeFirstParticle();
}
float baseLifetime;
float baseScaleX;
float baseScaleY;
float baseScaleZ;
Vector3 basePivot;
void InitializeFirstParticle()
{
if (isDynamic && this.transform.childCount == 0)
{
throw new System.Exception("[CFXR_ParticleText] A disabled GameObject with a ParticleSystem component is required as the first child when 'isDyanmic' is enabled, so that its settings can be used as a base for the generated characters.");
}
var ps = isDynamic ? this.transform.GetChild(0).GetComponent<ParticleSystem>() : this.GetComponent<ParticleSystem>();
var main = ps.main;
baseLifetime = main.startLifetime.constant;
baseScaleX = main.startSizeXMultiplier;
baseScaleY = main.startSizeYMultiplier;
baseScaleZ = main.startSizeZMultiplier;
basePivot = ps.GetComponent<ParticleSystemRenderer>().pivot;
if (isDynamic)
{
basePivot.x = 0; // make sure to not offset the text horizontally
ps.gameObject.SetActive(false); // ensure first child is inactive
ps.gameObject.name = "MODEL";
}
}
public void UpdateText(
string newText = null,
float? newSize = null,
Color? newColor1 = null, Color? newColor2 = null, Color? newBackgroundColor = null,
float? newLifetimeMultiplier = null
)
{
#if UNITY_EDITOR
// Only allow updating text for GameObjects that aren't prefabs, since we are possibly destroying/adding GameObjects
if (this == null)
{
return;
}
var prefabInstanceStatus = PrefabUtility.GetPrefabInstanceStatus(this);
var prefabAssetType = PrefabUtility.GetPrefabAssetType(this);
if (!(prefabInstanceStatus == PrefabInstanceStatus.NotAPrefab && prefabAssetType == PrefabAssetType.NotAPrefab))
{
return;
}
if (!Application.isPlaying)
{
InitializeFirstParticle();
}
#endif
if (Application.isPlaying && !isDynamic)
{
throw new System.Exception("[CFXR_ParticleText] You cannot update the text at runtime if it's not marked as dynamic.");
}
if (newText != null)
{
switch (font.letterCase)
{
case CFXR_ParticleTextFontAsset.LetterCase.Lower:
newText = newText.ToLowerInvariant();
break;
case CFXR_ParticleTextFontAsset.LetterCase.Upper:
newText = newText.ToUpperInvariant();
break;
}
// Verify that new text doesn't contain invalid characters
foreach (char c in newText)
{
if (char.IsWhiteSpace(c)) continue;
if (font.CharSequence.IndexOf(c) < 0)
{
throw new System.Exception("[CFXR_ParticleText] Invalid character supplied for the dynamic text: '" + c + "'\nThe allowed characters from the selected font are: " + font.CharSequence);
}
}
this.text = newText;
}
if (newSize != null) this.size = newSize.Value;
if (newColor1 != null) this.color1 = newColor1.Value;
if (newColor2 != null) this.color2 = newColor2.Value;
if (newBackgroundColor != null) this.backgroundColor = newBackgroundColor.Value;
if (newLifetimeMultiplier != null) this.lifetimeMultiplier = newLifetimeMultiplier.Value;
if (text == null || font == null || !font.IsValid())
{
return;
}
if (this.transform.childCount == 0)
{
throw new System.Exception("[CFXR_ParticleText] A disabled GameObject with a ParticleSystem component is required as the first child when 'isDyanmic' is enabled, so that its settings can be used as a base for the generated characters.");
}
// process text and calculate total width offset
float totalWidth = 0f;
int charCount = 0;
for (int i = 0; i < text.Length; i++)
{
if (char.IsWhiteSpace(text[i]))
{
if (i > 0)
{
totalWidth += letterSpacing * size;
}
}
else
{
charCount++;
if (i > 0)
{
int index = font.CharSequence.IndexOf(text[i]);
var sprite = font.CharSprites[index];
float charWidth = sprite.rect.width + font.CharKerningOffsets[index].post + font.CharKerningOffsets[index].pre;
totalWidth += (charWidth * 0.01f + letterSpacing) * size;
}
}
}
#if UNITY_EDITOR
// delete all children in editor, to make sure we refresh the particle systems based on the first one
if (!Application.isPlaying)
{
int length = this.transform.childCount;
int overflow = 0;
while (this.transform.childCount > 1)
{
Object.DestroyImmediate(this.transform.GetChild(this.transform.childCount - 1).gameObject);
overflow++;
if (overflow > 1000)
{
// just in case...
Debug.LogError("Overflow!");
break;
}
}
}
#endif
if (charCount > 0)
{
// calculate needed instances
int childCount = this.transform.childCount - (isDynamic ? 1 : 0); // first one is the particle source and always deactivated
if (childCount < charCount)
{
// instantiate new letter GameObjects if needed
GameObject model = isDynamic ? this.transform.GetChild(0).gameObject : null;
for (int i = childCount; i < charCount; i++)
{
var newLetter = isDynamic ? Instantiate(model, this.transform) : new GameObject();
if (!isDynamic)
{
newLetter.transform.SetParent(this.transform);
newLetter.AddComponent<ParticleSystem>();
}
newLetter.transform.localPosition = Vector3.zero;
newLetter.transform.localRotation = Quaternion.identity;
}
}
// update each letter
float offset = totalWidth / 2f;
totalWidth = 0f;
int currentChild = isDynamic ? 0 : -1;
// when not dynamic, we use CopySerialized to propagate the settings to the instances
var sourceParticle = isDynamic ? null : this.GetComponent<ParticleSystem>();
var sourceParticleRenderer = this.GetComponent<ParticleSystemRenderer>();
for (int i = 0; i < text.Length; i++)
{
var letter = text[i];
if (char.IsWhiteSpace(letter))
{
totalWidth += letterSpacing * size;
}
else
{
currentChild++;
int index = font.CharSequence.IndexOf(text[i]);
var sprite = font.CharSprites[index];
// calculate char particle size ratio
var ratio = size * sprite.rect.width / 50f;
// calculate char position
totalWidth += font.CharKerningOffsets[index].pre * 0.01f * size;
var position = (totalWidth - offset) / ratio;
float charWidth = sprite.rect.width + font.CharKerningOffsets[index].post;
totalWidth += (charWidth * 0.01f + letterSpacing) * size;
// update particle system for this letter
var letterObj = this.transform.GetChild(currentChild).gameObject;
letterObj.name = letter.ToString();
var ps = letterObj.GetComponent<ParticleSystem>();
#if UNITY_EDITOR
if (!isDynamic)
{
EditorUtility.CopySerialized(sourceParticle, ps);
ps.gameObject.SetActive(true);
}
#endif
var mainModule = ps.main;
mainModule.startSizeXMultiplier = baseScaleX * ratio;
mainModule.startSizeYMultiplier = baseScaleY * ratio;
mainModule.startSizeZMultiplier = baseScaleZ * ratio;
ps.textureSheetAnimation.SetSprite(0, sprite);
mainModule.startRotation = Mathf.Deg2Rad * rotation;
mainModule.startColor = backgroundColor;
var customData = ps.customData;
customData.enabled = true;
customData.SetColor(ParticleSystemCustomData.Custom1, color1);
customData.SetColor(ParticleSystemCustomData.Custom2, color2);
if (cumulativeDelay)
{
mainModule.startDelay = delay * i;
mainModule.startLifetime = Mathf.LerpUnclamped(baseLifetime, baseLifetime + (delay * (text.Length - i)), compensateLifetime / lifetimeMultiplier);
}
else
{
mainModule.startDelay = delay;
}
mainModule.startLifetime = mainModule.startLifetime.constant * lifetimeMultiplier;
// particle system renderer parameters
var particleRenderer = ps.GetComponent<ParticleSystemRenderer>();
#if UNITY_EDITOR
if (!isDynamic)
{
EditorUtility.CopySerialized(sourceParticleRenderer, particleRenderer);
}
#endif
particleRenderer.enabled = true;
particleRenderer.pivot = new Vector3(basePivot.x + position, basePivot.y, basePivot.z);
particleRenderer.sortingFudge += i * sortingFudgeOffset;
}
}
}
// set active state for needed letters only
for (int i = 1, l = this.transform.childCount; i < l; i++)
{
this.transform.GetChild(i).gameObject.SetActive(i <= charCount);
}
#if UNITY_EDITOR
// automatically play the effect in Editor
if (!Application.isPlaying)
{
this.GetComponent<ParticleSystem>().Clear(true);
this.GetComponent<ParticleSystem>().Play(true);
}
#endif
}
}
#if UNITY_EDITOR
[CustomEditor(typeof(CFXR_ParticleText))]
public class ParticleTextEditor : Editor
{
CFXR_ParticleText CastTarget
{
get { return (CFXR_ParticleText) this.target; }
}
GUIContent GUIContent_AutoUpdateToggle = new GUIContent("Auto-update", "Automatically regenerate the text when a property is changed.");
GUIContent GUIContent_UpdateTextButton = new GUIContent(" Update Text ", "Regenerate the text and create new letter GameObjects if needed.");
public override void OnInspectorGUI()
{
var prefab = PrefabUtility.GetPrefabInstanceStatus(target);
if (prefab != PrefabInstanceStatus.NotAPrefab)
{
EditorGUILayout.HelpBox("Cartoon FX Particle Text doesn't work on Prefab Instances, as it needs to destroy/create children GameObjects.\nYou can right-click on the object, and select \"Unpack Prefab\" to make it an independent Game Object.",
MessageType.Warning);
return;
}
base.OnInspectorGUI();
serializedObject.Update();
SerializedProperty autoUpdateBool = serializedObject.FindProperty("autoUpdateEditor");
GUILayout.Space(8);
GUILayout.BeginHorizontal();
{
GUILayout.FlexibleSpace();
autoUpdateBool.boolValue = GUILayout.Toggle(autoUpdateBool.boolValue, GUIContent_AutoUpdateToggle, GUILayout.Height(30));
if (GUILayout.Button(GUIContent_UpdateTextButton, GUILayout.Height(30)))
{
CastTarget.UpdateText(null);
}
}
GUILayout.EndHorizontal();
if (GUI.changed)
{
serializedObject.ApplyModifiedProperties();
}
}
}
#endif
}

View File

@@ -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:

View File

@@ -0,0 +1,128 @@
//--------------------------------------------------------------------------------------------------------------------------------
// Cartoon FX
// (c) 2012-2025 Jean Moreno
//--------------------------------------------------------------------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace CartoonFX
{
public class CFXR_ParticleTextFontAsset : ScriptableObject
{
public enum LetterCase
{
Both,
Upper,
Lower
}
public string CharSequence = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!?-.#@$ ";
public LetterCase letterCase = LetterCase.Upper;
public Sprite[] CharSprites;
public Kerning[] CharKerningOffsets;
[System.Serializable]
public class Kerning
{
public string name = "A";
public float pre = 0f;
public float post = 0f;
}
void OnValidate()
{
this.hideFlags = HideFlags.None;
if (CharKerningOffsets == null || CharKerningOffsets.Length != CharSequence.Length)
{
CharKerningOffsets = new Kerning[CharSequence.Length];
for (int i = 0; i < CharKerningOffsets.Length; i++)
{
CharKerningOffsets[i] = new Kerning() { name = CharSequence[i].ToString() };
}
}
}
public bool IsValid()
{
bool valid = !string.IsNullOrEmpty(CharSequence) && CharSprites != null && CharSprites.Length == CharSequence.Length && CharKerningOffsets != null && CharKerningOffsets.Length == CharSprites.Length;
if (!valid)
{
Debug.LogError(string.Format("Invalid ParticleTextFontAsset: '{0}'\n", this.name), this);
}
return valid;
}
#if UNITY_EDITOR
// [MenuItem("Tools/Create font asset")]
static void CreateFontAsset()
{
var instance = CreateInstance<CFXR_ParticleTextFontAsset>();
AssetDatabase.CreateAsset(instance, "Assets/Font.asset");
}
#endif
}
#if UNITY_EDITOR
[CustomEditor(typeof(CFXR_ParticleTextFontAsset))]
public class ParticleTextFontAssetEditor : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
GUILayout.BeginHorizontal();
if (GUILayout.Button("Export Kerning"))
{
var ptfa = this.target as CFXR_ParticleTextFontAsset;
var path = EditorUtility.SaveFilePanel("Export Kerning Settings", Application.dataPath, ptfa.name + " kerning", ".txt");
if (!string.IsNullOrEmpty(path))
{
string output = "";
foreach (var k in ptfa.CharKerningOffsets)
{
output += k.name + "\t" + k.pre + "\t" + k.post + "\n";
}
System.IO.File.WriteAllText(path, output);
}
}
if (GUILayout.Button("Import Kerning"))
{
var path = EditorUtility.OpenFilePanel("Import Kerning Settings", Application.dataPath, "txt");
if (!string.IsNullOrEmpty(path))
{
var text = System.IO.File.ReadAllText(path);
var split = text.Split(new string[] { "\n" }, System.StringSplitOptions.RemoveEmptyEntries);
var ptfa = this.target as CFXR_ParticleTextFontAsset;
Undo.RecordObject(ptfa, "Import Kerning Settings");
List<CFXR_ParticleTextFontAsset.Kerning> kerningList = new List<CFXR_ParticleTextFontAsset.Kerning>(ptfa.CharKerningOffsets);
for (int i = 0; i < split.Length; i++)
{
var data = split[i].Split('\t');
foreach (var cko in kerningList)
{
if (cko.name == data[0])
{
cko.pre = float.Parse(data[1]);
cko.post = float.Parse(data[2]);
break;
}
}
}
ptfa.CharKerningOffsets = kerningList.ToArray();
}
}
GUILayout.EndHorizontal();
}
}
#endif
}

View File

@@ -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:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e1c685d607534374fb2c655f005e9aef
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,181 @@
//--------------------------------------------------------------------------------------------------------------------------------
// Cartoon FX
// (c) 2012-2020 Jean Moreno
//--------------------------------------------------------------------------------------------------------------------------------
Shader "Cartoon FX/Remaster/Particle Screen Distortion"
{
Properties
{
[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
//# ========================================================
//# Texture
//#
[NoScaleOffset] _ScreenDistortionTex ("Distortion Texture", 2D) = "bump" {}
_ScreenDistortionScale ("Distortion Scale", Range(-0.5, 0.5)) = 0.1
//# ========================================================
//# Debug
//#
[Toggle(_DEBUG_VISUALIZE_DISTORTION)] _DebugVisualize ("Visualize Distortion Particles", Float) = 0
}
Category
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
}
Blend SrcAlpha OneMinusSrcAlpha, One One
ZWrite Off
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
// Using the same keywords as Unity's Standard Particle shader to minimize project-wide keyword usage
#pragma shader_feature_local _ _FADING_ON
#pragma shader_feature_local_fragment _ _ALPHATEST_ON
#pragma shader_feature_local _ _DEBUG_VISUALIZE_DISTORTION
#define CFXR_URP
#define CFXR_SCREEN_DISTORTION_SHADER
#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
// Using the same keywords as Unity's Standard Particle shader to minimize project-wide keyword usage
#pragma shader_feature_local _ _FADING_ON
#pragma shader_feature_local_fragment _ _ALPHATEST_ON
#pragma shader_feature_local _ _DEBUG_VISUALIZE_DISTORTION
#define _CameraOpaqueTexture _CameraSortingLayerTexture
#define CFXR_URP
#define DISABLE_SOFT_PARTICLES
#define CFXR_SCREEN_DISTORTION_SHADER
#include "CFXR_PASSES.cginc"
ENDCG
}
}
/*** END URP ***/
/*** BIRP ***/
//====================================================================================================================================
// Built-in Rendering Pipeline
SubShader
{
GrabPass
{
Tags { "LightMode" = "Always" }
"_GrabTexture"
}
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
// Using the same keywords as Unity's Standard Particle shader to minimize project-wide keyword usage
#pragma shader_feature_local _ _FADING_ON
#pragma shader_feature_local_fragment _ _ALPHATEST_ON
#pragma shader_feature_local _ _DEBUG_VISUALIZE_DISTORTION
#include "UnityStandardParticleInstancing.cginc"
#define CFXR_SCREEN_DISTORTION_SHADER
#include "CFXR_PASSES.cginc"
ENDCG
}
}
/*** END BIRP ***/
}
CustomEditor "CartoonFX.MaterialInspector"
}

View File

@@ -0,0 +1,48 @@
fileFormatVersion: 2
guid: 304630dc6079b47419e5333f284382fd
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: fe56ec25963759b49955809beeb4324b, type: 3}
detectedRenderPipeline: Built-In Render Pipeline
strippedLinesCount: 70
shaderSourceCode: "//--------------------------------------------------------------------------------------------------------------------------------\r\n//
Cartoon FX\r\n// (c) 2012-2020 Jean Moreno\r\n//--------------------------------------------------------------------------------------------------------------------------------\r\n\r\nShader
\"Cartoon FX/Remaster/Particle Screen Distortion NEW\"\r\n{\r\n\tProperties\r\n\t{
\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\t//#
Texture\r\n\t//#\r\n\t\t[NoScaleOffset] _ScreenDistortionTex (\"Distortion Texture\",
2D) = \"bump\" {}\r\n\t\t_ScreenDistortionScale (\"Distortion Scale\", Range(-0.5,
0.5)) = 0.1\r\n\t\t\r\n\t//# ========================================================\r\n\t//#
Debug\r\n\t//# \r\n\t\t\r\n\t\t[Toggle(_DEBUG_VISUALIZE_DISTORTION)] _DebugVisualize
(\"Visualize Distortion Particles\", Float) = 0 \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
SrcAlpha OneMinusSrcAlpha, One One\r\n\t\tZWrite Off\r\n\t\tCull Off\r\n\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\tGrabPass\r\n\t\t\t{\r\n\t\t\t\tTags
{ \"LightMode\" = \"Always\" }\r\n\t\t\t\t\"_GrabTexture\"\r\n\t\t\t}\r\n\t\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\t\t\t\t\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 _ _FADING_ON\r\n\t\t\t\t#pragma
shader_feature_local _ _ALPHATEST_ON\r\n\t\t\t\t#pragma shader_feature_local
_ _DEBUG_VISUALIZE_DISTORTION\r\n\r\n\t\t\t\t#include \"UnityStandardParticleInstancing.cginc\"\r\n\r\n\t\t\t\t#define
CFXR_SCREEN_DISTORTION_SHADER\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 Screen Distortion NEW
shaderErrors: []
variantCount: 64
variantCountUsed: 2

View File

@@ -0,0 +1,275 @@
//--------------------------------------------------------------------------------------------------------------------------------
// Cartoon FX
// (c) 2012-2020 Jean Moreno
//--------------------------------------------------------------------------------------------------------------------------------
Shader "Cartoon FX/Remaster/Particle Procedural Glow"
{
Properties
{
//# Blending
//#
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Blend Source", Float) = 5
[Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Blend Destination", Float) = 10
//# --------------------------------------------------------
[Toggle(_CFXR_DISSOLVE)] _UseDissolve ("Enable Dissolve", Float) = 0
//# IF_KEYWORD _CFXR_DISSOLVE
[NoScaleOffset] _DissolveTex ("Dissolve Texture", 2D) = "gray" {}
_DissolveSmooth ("Dissolve Smoothing", Range(0.0001,0.5)) = 0.1
[ToggleNoKeyword] _InvertDissolveTex ("Invert Dissolve Texture", Float) = 0
//# END_IF
//# --------------------------------------------------------
//# Procedural Circle
//#
[KeywordEnum(P0, P2, P4, P8)] _CFXR_GLOW_POW ("Apply Power of", Float) = 0
_GlowMin ("Circle Min", Float) = 0
_GlowMax ("Circle Max", Float) = 1
//#
_MaxValue ("Max Value", Float) = 10
//# --------------------------------------------------------
_HdrMultiply ("HDR Multiplier", Float) = 2
//# --------------------------------------------------------
[Toggle(_FADING_ON)] _UseSP ("Soft Particles", Float) = 0
//# IF_KEYWORD _FADING_ON
_SoftParticlesFadeDistanceNear ("Near Fade", Float) = 0
_SoftParticlesFadeDistanceFar ("Far Fade", Float) = 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
}
Category
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
}
Blend [_SrcBlend] [_DstBlend], One One
Cull Off
ZWrite Off
/*** URP ***/
//====================================================================================================================================
// Universal Rendering Pipeline
SubShader
{
Pass
{
Name "BASE"
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 shader_feature_local _ _CFXR_GLOW_POW_P2 _CFXR_GLOW_POW_P4 _CFXR_GLOW_POW_P8
#pragma shader_feature_local _ _CFXR_DISSOLVE
#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_GLOW_SHADER
#include "CFXR_PASSES.cginc"
ENDCG
}
// Same as above with 'Universal2D' instead and DISABLE_SOFT_PARTICLES keyword
Pass
{
Name "BASE"
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 shader_feature_local _ _CFXR_GLOW_POW_P2 _CFXR_GLOW_POW_P4 _CFXR_GLOW_POW_P8
#pragma shader_feature_local _ _CFXR_DISSOLVE
#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 DISABLE_SOFT_PARTICLES
#define CFXR_GLOW_SHADER
#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_GLOW_POW_P2 _CFXR_GLOW_POW_P4 _CFXR_GLOW_POW_P8
#pragma shader_feature_local _ _CFXR_DISSOLVE
#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
#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_URP
#define PASS_SHADOW_CASTER
#define CFXR_GLOW_SHADER
#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 shader_feature_local _ _CFXR_GLOW_POW_P2 _CFXR_GLOW_POW_P4 _CFXR_GLOW_POW_P8
#pragma shader_feature_local _ _CFXR_DISSOLVE
#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_GLOW_SHADER
#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_GLOW_POW_P2 _CFXR_GLOW_POW_P4 _CFXR_GLOW_POW_P8
#pragma shader_feature_local _ _CFXR_DISSOLVE
#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
#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_GLOW_SHADER
#include "CFXR_PASSES.cginc"
ENDCG
}
}
/*** END BIRP ***/
}
CustomEditor "CartoonFX.MaterialInspector"
}

View File

@@ -0,0 +1,70 @@
fileFormatVersion: 2
guid: 67dfcda17071f4a41be79c4049965e67
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: fe56ec25963759b49955809beeb4324b, type: 3}
detectedRenderPipeline: Built-In Render Pipeline
strippedLinesCount: 108
shaderSourceCode: "//--------------------------------------------------------------------------------------------------------------------------------\r\n//
Cartoon FX\r\n// (c) 2012-2020 Jean Moreno\r\n//--------------------------------------------------------------------------------------------------------------------------------\r\n\r\nShader
\"Cartoon FX/Remaster/Particle Procedural Glow NEW\"\r\n{\r\n\tProperties\r\n\t{\r\n\t//#
Blending\r\n\t//#\r\n\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\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[NoScaleOffset]
_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//# END_IF\r\n\r\n\t//# --------------------------------------------------------\r\n\r\n\t//#
Procedural Circle\r\n\t//#\r\n\r\n\t\t[KeywordEnum(P0, P2, P4, P8)] _CFXR_GLOW_POW
(\"Apply Power of\", Float) = 0\r\n\t\t_GlowMin (\"Circle Min\", Float) = 0\r\n\t\t_GlowMax
(\"Circle Max\", Float) = 1\r\n\t//#\r\n\t\t_MaxValue (\"Max Value\", Float)
= 10\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\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\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\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\t\tBlend
[_SrcBlend] [_DstBlend], One One\r\n\t\tCull Off\r\n\t\tZWrite Off\r\n\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\t\t\t\t\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\r\n\t\t\t\t#pragma
shader_feature_local _ _CFXR_GLOW_POW_P2 _CFXR_GLOW_POW_P4 _CFXR_GLOW_POW_P8\r\n\t\t\t\t#pragma
shader_feature_local _ _CFXR_HDR_BOOST\r\n\t\t\t\t#pragma shader_feature_local
_ _CFXR_DISSOLVE\r\n\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\r\n\t\t\t\t#define CFXR_GLOW_SHADER\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\t\t\t\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_GLOW_POW_P2 _CFXR_GLOW_POW_P4 _CFXR_GLOW_POW_P8\r\n\t\t\t\t#pragma
shader_feature_local _ _CFXR_DISSOLVE\r\n\r\n\t\t\t\t#pragma shader_feature_local
_FADING_ON\r\n\t\t\t\t#pragma shader_feature_local _ _ALPHATEST_ON _ALPHABLEND_ON
_ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON\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_GLOW_SHADER\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 Procedural Glow NEW
shaderErrors: []
variantCount: 3040
variantCountUsed: 4

View File

@@ -0,0 +1,269 @@
//--------------------------------------------------------------------------------------------------------------------------------
// Cartoon FX
// (c) 2012-2020 Jean Moreno
//--------------------------------------------------------------------------------------------------------------------------------
Shader "Cartoon FX/Remaster/Particle Procedural Ring"
{
Properties
{
//# Blending
//#
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Blend Source", Float) = 5
[Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Blend Destination", Float) = 10
//# --------------------------------------------------------
[Toggle(_CFXR_DISSOLVE)] _UseDissolve ("Enable Dissolve", Float) = 0
//# IF_KEYWORD _CFXR_DISSOLVE
[NoScaleOffset] _DissolveTex ("Dissolve Texture", 2D) = "gray" {}
_DissolveSmooth ("Dissolve Smoothing", Range(0.0001,0.5)) = 0.1
[ToggleNoKeyword] _InvertDissolveTex ("Invert Dissolve Texture", Float) = 0
//# END_IF
//# --------------------------------------------------------
//# Textures
//#
_MainTex ("Texture", 2D) = "white" {}
[Toggle] _SingleChannel ("Single Channel Texture", Float) = 0
//# --------------------------------------------------------
//# Ring
//#
[Toggle(_CFXR_RADIAL_UV)] _UseRadialUV ("Enable Radial UVs", Float) = 0
_RingTopOffset ("Ring Offset", float) = 0.05
[Toggle(_CFXR_WORLD_SPACE_RING)] _WorldSpaceRing ("World Space", Float) = 0
//# --------------------------------------------------------
_HdrMultiply ("HDR Multiplier", Float) = 2
//# --------------------------------------------------------
[Toggle(_FADING_ON)] _UseSP ("Soft Particles", Float) = 0
//# IF_KEYWORD _FADING_ON
_SoftParticlesFadeDistanceNear ("Near Fade", Float) = 0
_SoftParticlesFadeDistanceFar ("Far Fade", Float) = 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
}
Category
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
}
Blend [_SrcBlend] [_DstBlend]
Cull Off
ZWrite Off
/*** URP ***/
//====================================================================================================================================
// Universal Rendering Pipeline
SubShader
{
Pass
{
Name "BASE"
Tags { "LightMode"="UniversalForward" }
CGPROGRAM
#pragma vertex vertex_program
#pragma fragment fragment_program
#pragma target 2.0
// #pragma multi_compile_instancing
#pragma multi_compile_fog
#pragma shader_feature_local _ _CFXR_RADIAL_UV
#pragma shader_feature_local _ _CFXR_WORLD_SPACE_RING
#pragma shader_feature_local _ _CFXR_DISSOLVE
// Using the same keywords as Unity's Standard Particle shader to minimize project-wide keyword usage
#pragma shader_feature_local _ _FADING_ON
#pragma shader_feature_local _ _ALPHATEST_ON
#pragma shader_feature_local_fragment _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON _CFXR_ADDITIVE
#define CFXR_URP
#define CFXR_PROCEDURAL_RING_SHADER
#include "CFXR_PASSES.cginc"
ENDCG
}
// Same as above with 'Universal2D' instead and DISABLE_SOFT_PARTICLES keyword
Pass
{
Name "BASE"
Tags { "LightMode"="Universal2D" }
CGPROGRAM
#pragma vertex vertex_program
#pragma fragment fragment_program
#pragma target 2.0
// #pragma multi_compile_instancing
#pragma multi_compile_fog
#pragma shader_feature_local _ _CFXR_RADIAL_UV
#pragma shader_feature_local _ _CFXR_WORLD_SPACE_RING
#pragma shader_feature_local _ _CFXR_DISSOLVE
// Using the same keywords as Unity's Standard Particle shader to minimize project-wide keyword usage
#pragma shader_feature_local _ _FADING_ON
#pragma shader_feature_local _ _ALPHATEST_ON
#pragma shader_feature_local_fragment _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON _CFXR_ADDITIVE
#define CFXR_URP
#define DISABLE_SOFT_PARTICLES
#define CFXR_PROCEDURAL_RING_SHADER
#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_RADIAL_UV
#pragma shader_feature_local _ _CFXR_WORLD_SPACE_RING
#pragma shader_feature_local _ _CFXR_DISSOLVE
#pragma shader_feature_local _ _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_URP
#define PASS_SHADOW_CASTER
#define CFXR_PROCEDURAL_RING_SHADER
#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
#pragma target 2.0
#pragma multi_compile_particles
// #pragma multi_compile_instancing
#pragma multi_compile_fog
#pragma shader_feature_local _ _CFXR_RADIAL_UV
#pragma shader_feature_local _ _CFXR_WORLD_SPACE_RING
#pragma shader_feature_local _ _CFXR_DISSOLVE
// Using the same keywords as Unity's Standard Particle shader to minimize project-wide keyword usage
#pragma shader_feature_local _ _FADING_ON
#pragma shader_feature_local _ _ALPHATEST_ON
#pragma shader_feature_local_fragment _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON _CFXR_ADDITIVE
#define CFXR_PROCEDURAL_RING_SHADER
#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_RADIAL_UV
#pragma shader_feature_local _ _CFXR_WORLD_SPACE_RING
#pragma shader_feature_local _ _CFXR_DISSOLVE
#pragma shader_feature_local _ _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 PASS_SHADOW_CASTER
#define CFXR_PROCEDURAL_RING_SHADER
#include "CFXR_PASSES.cginc"
ENDCG
}
}
/*** END BIRP ***/
}
CustomEditor "CartoonFX.MaterialInspector"
}

View File

@@ -0,0 +1,69 @@
fileFormatVersion: 2
guid: 1581eccce46ba384596a1dce7936ab19
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: fe56ec25963759b49955809beeb4324b, type: 3}
detectedRenderPipeline: Built-In Render Pipeline
strippedLinesCount: 113
shaderSourceCode: "//--------------------------------------------------------------------------------------------------------------------------------\r\n//
Cartoon FX\r\n// (c) 2012-2020 Jean Moreno\r\n//--------------------------------------------------------------------------------------------------------------------------------\r\n\r\nShader
\"Cartoon FX/Remaster/Particle Procedural Ring NEW\"\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\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[NoScaleOffset]
_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//# END_IF\r\n\r\n\t//# --------------------------------------------------------\r\n\r\n\t//#
Textures\r\n\t//#\r\n\r\n\t\t_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//#
Ring\r\n\t//#\r\n\r\n\t\t[Toggle(_CFXR_RADIAL_UV)] _UseRadialUV (\"Enable Radial
UVs\", Float) = 0\r\n\t\t_RingTopOffset (\"Ring Offset\", float) = 0.05\r\n\t\t[Toggle(_CFXR_WORLD_SPACE_RING)]
_WorldSpaceRing (\"World Space\", Float) = 0\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\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\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\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}\r\n\t\tBlend
[_SrcBlend] [_DstBlend]\r\n\t\tCull Off\r\n\t\tZWrite Off\r\n\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\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_particles\r\n\t\t\t\t//
#pragma multi_compile_instancing\r\n\t\t\t\t#pragma multi_compile_fog\r\n\t\t\t\t\r\n\t\t\t\t#pragma
shader_feature_local _ _CFXR_SINGLE_CHANNEL\r\n\t\t\t\t#pragma shader_feature_local
_ _CFXR_RADIAL_UV\r\n\t\t\t\t#pragma shader_feature_local _ _CFXR_WORLD_SPACE_RING\r\n\t\t\t\t#pragma
shader_feature_local _ _CFXR_DISSOLVE\r\n\t\t\t\t#pragma shader_feature_local
_ _CFXR_HDR_BOOST\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
_ _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_PROCEDURAL_RING_SHADER\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\t\t\t\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_RADIAL_UV\r\n\t\t\t\t#pragma shader_feature_local _ _CFXR_WORLD_SPACE_RING\r\n\t\t\t\t#pragma
shader_feature_local _ _CFXR_DISSOLVE\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 PASS_SHADOW_CASTER\r\n\t\t\t\t#define
CFXR_PROCEDURAL_RING_SHADER\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 Procedural Ring NEW
shaderErrors: []
variantCount: 6080
variantCountUsed: 4

View File

@@ -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"
}

View File

@@ -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

View File

@@ -0,0 +1,366 @@
//--------------------------------------------------------------------------------------------------------------------------------
// Cartoon FX
// (c) 2012-2025 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);
}

View File

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

View File

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

View File

@@ -0,0 +1,22 @@
//--------------------------------------------------------------------------------------------------------------------------------
// Cartoon FX
// (c) 2012-2025 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
//--------------------------------------------------------------------------------------------------------------------------------

View File

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

View File

@@ -0,0 +1,232 @@
//--------------------------------------------------------------------------------------------------------------------------------
// Cartoon FX
// (c) 2012-2025 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);
}

View File

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

View File

@@ -0,0 +1,287 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Cartoon FX Remaster FREE</title>
<style>
/* reset CSS */
a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}table{border-collapse:collapse;border-spacing:0}
body
{
font-family: sans-serif;
font-size: 14px;
background-color: #eee;
line-height: 1.2em;
}
h1,h2,h3,h4 { font-weight: bold; margin: 0 0 0.5em 0; color: #444; }
h1 { font-size: 26px; }
h2 { font-size: 22px; scroll-margin-top: 8px; }
h3 { font-size: 18px; margin: 0.2em 0 0.2em 0; color: #666; }
a
{
text-decoration: none;
border-bottom: solid 1px #ddd;
color: #777;
}
a:hover
{
background-color: #777;
color: #fff;
}
hr
{
border: none;
border-bottom: double 3px #AAA;
margin-bottom: 1em;
}
em { color: #10a771; }
b { font-weight: bold; color: #444; font-size: 15px; }
ul { margin: 0.2em 0; }
p { margin: 0.3em; }
p.info
{
font-size: 12px;
padding: 8px;
background-color: #E8E8E8;
border: solid 1px #C0C0C0;
border-radius: 6px;
color: #333;
}
p.info b { font-size: 14px; color: #333; }
p.info em { font-weight: bold; color: #333; }
/* -------------------------------- */
span.code
{
font-family: monospace;
font-size: 12px;
padding: 2px;
border-radius: 4px;
background-color: rgba(0,0,0,0.1);
}
/* -------------------------------- */
div#email span b,span#email_link2 b { display: none; }
div#main
{
max-width: 1200px;
margin-left: auto;
margin-right: auto;
padding: 2em;
}
div#header
{
color: #777;
padding-bottom: 8px;
line-height: 1.3em;
}
div#header div#title
{
font-size: 26px;
margin-bottom: 10px;
color: #10a771;
}
div#header div#version { font-weight: bold; }
div#header div, div#header a { padding: 1px 4px; border-radius: 3px; }
div#header div#email { padding: 0; }
div.section
{
padding: 12px;
border: solid 1px #ddd;
border-radius: 4px;
background-color: #fafafa;
margin-bottom: 1em;
}
div.troubleshooting { line-height: 1.2em; }
div.troubleshooting li { margin-bottom: 0.5em; }
div.troubleshooting li li { margin-bottom: 0; }
div#changelog_content { white-space: pre-wrap; line-height: 1.2em; }
</style>
</head>
<body>
<div id="main">
<div id="header">
<div id="title">Cartoon FX Remaster FREE</div>
<div id="version">R 1.5.1, December 2025 (<a href="#changelog">changelog</a>)</div>
<div id="copyright">© 2012-2025 - Jean Moreno</div>
<div id="email"><span id="email_link">jean&#46;&#109;oreno&#46;<b>nonsense</b>pu&#98;lic+&#117;&#110;i&#116;&#121;&#64;gmai&#108;&#46;com</span></div>
</div>
<hr>
<div class="section">
<h3>Table of Content</h2>
<ul>
<li><a href='#about'>About</a></li>
<li><a href='#usage'>Usage</a></li>
<li><a href='#troubleshooting'>Troubleshooting</a></li>
<li><a href='#changelog'>Changelog</a></li>
</ul>
</div>
<h2 id="about">About</h2>
<div class="section">
<p><em>"Cartoon FX Remaster FREE"</em> is a collection of <em>stylized visual effects</em> mainly made with Particle Systems (using Unity's CPU-based particle system 'Shuriken').</p>
<p>Featuring:
<ul>
<li>Custom shaders with special effects such as dissolve animation, UV distortion, lit particles, edge fading, HDR colors, single channel textures for reduced memory usage, shadow casting and dithering</li>
<li>Specialized shader to draw pixel-perfect circles and rings while reducing overdraw (using a low-poly ring mesh instead of a quad)</li>
<li>Optimized meshes where relevant to reduce overdraw/fill-rate issues</li>
<li>Custom script that can animate attached lights and perform screen-shake for relevant effects</li>
<li>High-resolution hand-drawn textures</li>
<li>Custom shader format that will only compile the code for the currently active render pipeline (Built-In Render Pipeline or Universal Render Pipeline (URP))</li>
</ul>
</p>
<p>This is the <em>free version</em> containing a sample of effects taken from the four commercial packs.<br>
The license is the same as the commercial packs, including commercial use of the effects in games and apps, according to the license terms.<br>
The full license can be found here: <a href="https://unity.com/legal/as-terms" target="_blank">https://unity.com/legal/as-terms</a> (Appendix 1, End User License Agreement)</p>
<br>
<h3>Render Pipelines</h3>
<p>"Cartoon FX Remaster FREE" supports the <em>Built-In</em> and <em>Universal Render Pipelines</em>.</p>
<p>It uses a special custom shader format that will only compile the relevant shader code for the currently active render pipeline in the project.</p>
<p>If you <em>change the render pipeline</em> after having imported the assets, then you will have to <em>reimport the shaders</em> so that they compile for the newly selected render pipeline (right-click on the <span class='code'>Shaders</span> folder, and hit <span class='code'>Reimport</span>).</p>
<br>
<h3>Legacy Effects</h3>
<p>"Cartoon FX Remaster FREE" is called so because it is a made from scratch remake of the old "Cartoon FX Pack FREE" set of effects, released circa 2012.<br>
Those old effects are still included if you are curious or want to use them: they are in the <span class='code'>Cartoon FX FREE (old legacy effects)</span> package and need to be extracted through Unity.
</p>
</div>
<h2 id="usage">Usage</h2>
<div class="section">
<h3>Spawn Effects</h3>
<p>"Cartoon FX Remaster FREE" effects are provided as individual prefabs. Simply spawn the prefabs (e.g. using <span class='code'><a href='https://docs.unity3d.com/ScriptReference/Object.Instantiate.html' target='_blank'>Instantiate</a></span>) and activate the instantiated GameObject to play the effect.</p>
<p>GameObjects will auto-destroy themselves when the effect has finished playing. You can change that behavior in the <span class='code'>CFXR_Effect</span> script attached (to either Destroy, Disable or do nothing after the effect has finished playing).</p>
<br>
<h3>CFXR Script file</h3>
<p>You can change some <em>global script settings</em> in the <span class='code'>CFXR_Effect.cs</span> file, by uncommenting the global defines at the top:
<ul>
<li><b>Disable Camera Shake</b>: will disable all of the Camera shake code, if you don't need it or have your own solution</li>
<li><b>Disable Lights</b>: will keep the Lights attached to the effect deactivated</li>
<li><b>Disable Clear Behavior</b>: will disable the code handing the clear behavior after an effect has fully finished playing</li>
</ul>
</p>
<br>
<h3>CFXR Settings file</h3>
<p>You can change some <em>global shader settings</em> in the <span class='code'>CFXR_Settings.cginc</span> file:
<ul>
<li><b>Disable Soft Particles</b>: in case you don't need that feature, you can globally disable it for all CFXR effects (Soft Particles in Unity's built-in shaders will still work)</li>
<li><b>Orthographic Soft Particles</b>: if you are using an <em>Orthographic</em> camera, then enable this to make soft particles work properly</li>
<li><b>Global HDR Multiplier</b>: some effects use HDR colors (colors that go above the [0-1] range), so that they work nicely with post effects like bloom and simulate illuminated particles.
<br>Depending on your bloom settings, you may want to adjust that multiplier value to tune up or down the final colors.</li>
<li><b>Enable Point Lights</b>: enables additional lights affecting lit particles (else they will only be affected by the main directional light). This is enabled by default.
</ul>
</p>
</div>
<h2 id="troubleshooting">Troubleshooting</h2>
<div class="section troubleshooting">
<ul>
<li><b>Invisible effects with URP:</b><br>If almost all effects don't show when using URP, it likely is because the <em>'Depth Texture'</em> is disabled, and it is needed for soft particles to work.<br>You can either:
<ul>
<li>Enable the 'Depth Texture' option in the URP asset</li>
<li>Disable soft particles entirely by editing the <span class='code'>CFXR Settings.cginc</span> file and uncommenting the relevant line</li>
</ul>
Unfortunately, Unity doesn't provide any way to know if the depth texture is enabled to the shaders, and thus this process cannot be automatic.
</li>
<li><b>Invisible effects on Android/iOS/other platform:</b><br>Most likely this is due to the depth texture not being enabled by default on those platforms and thus soft particles breaks. See the above point for a solution.</li>
<li><b>Magenta/Pink Effects:</b><br> If the shaders don't work and effects are <span style='color: #ff00ff;'>magenta</span>, then you may need to recompile the shaders for the currently active render pipeline: right-click on the <span class='code'>Shaders</span> folder, and hit <span class='code'>Reimport</span></li>
<li><b>Addressables/Asset Bundles:</b><br>If the effect don't work when using addressables, you can try to force the selected render pipeline for the shaders (select the shader files, and change the relevant option in their inspector).<br>
Some users also reported that using the <span class='code'>'Build&nbsp;>&nbsp;Clean&nbsp;Build&nbsp;>&nbsp;Build&nbsp;Pipeline&nbsp;Cache'</span> option in the Addressables window did solve the issue afterwards.</li>
<li><b>CFXR_Effect script:</b><br>Almost all prefabs have the CFXR_Effect script attached: it handles auto-destruction or deactivation of the GameObject once an effect has finished playing, as well as camera shake and light animation where relevant</li>
<li><b>Sorting:</b><br>If you have problems with z-sorting (transparent objects appearing in front of other when their position is actually behind), try changing the values in the <span class='code'>Particle&nbsp;System&nbsp;>&nbsp;Renderer&nbsp;>&nbsp;Sorting&nbsp;Fudge</span>; as long as the relative order is respected between the different particle systems of a same prefab, it should work ok.</li>
<li><b>Color Space:</b><br>Effects were authored using <em>Linear Color Space</em>; use that for the best results (in the <span class='code'>Player</span> project settings)</li>
<li><b>Light Intensities:</b><br>Effects were authored with the Built-in Render Pipeline, which by default converts light intensity values to gamma space before sending them to the GPU.<br>When installing the URP pipeline, Unity silently changes the setting <span class='code'>GraphicsSettings.lightsUseLinearIntensity</span> to <span class='code'>true</span>, so that linear intensity values are sent instead. This setting remains enabled even if URP is uninstalled or unused.<br>As of <em>v1.5.0</em>, effects light intensities were updated to their corresponding gamma values, and the CFXR_Effect script will revert those values back to linear at runtime if the <span class='code'>GraphicsSettings.lightsUseLinearIntensity</span> flag is set to <span class='code'>false</span>. You can disable that behavior by uncommenting the <span class='code'>DISABLE_LIGHTS_LINEAR_REMAPPING</span> define in the <em>CFXR_Effect.cs</em> file.</li>
<li><b>HDR:</b><br>If some effects show washed out colors, it likely is because HDR isn't enabled for the camera (or in the URP asset), and thus colors will be clamped.</li>
<li><b>License:</b><br>The full legal license can be found here: <a href="https://unity.com/legal/as-terms" target="_blank">https://unity.com/legal/as-terms</a> (see <em>Appendix 1: Asset Store End User License Agreement</em>)<br>
You can only use the effects in a commercial game or application when used as described in the above license.</li>
</ul>
<p>Please send me an email if you are having other issues or have any question: <span id="email_link2">jean&#46;&#109;oreno&#46;<b>nonsense</b>pu&#98;lic+&#117;&#110;i&#116;&#121;&#64;gmai&#108;&#46;com</span></p>
</div>
<h2 id="changelog">Changelog</h2>
<div class="section">
<div id="changelog_content"> R 1.5.1
- Fixed obsolete API warnings in Unity 6.2
- Fixed compilation errors when globally disabling certain features through defines in CFXR_Effects.cs
R 1.5.0
- Fixed demo scene so that bloom also works with URP
- Fixed demo scene so that it uses new input system for Unity 6+
- Fixed inconsistent lighting values between BIRP and URP: see "Light Intensities" troubleshooting above for more details
R 1.4.2
- Updated readme with a specific troubleshooting section for effects not showing on Android/other platforms
R 1.4.1
- Shaders: automatic detection of orthographic cameras (URP only)
- Demo scene: automatic ground shader selected based on the active render pipeline (fixed pink ground in URP)
R 1.4.0
- Shaders: Greatly reduced the number of possible shader variants (e.g. for Ubershader from roughly 130M to 12k possible variants)
- Shaders: Added option to force compilation for a specific render pipeline (select the shader file and look in its Inspector window)
- Shaders: fixed incorrect color for text effecs (green channel was always forced to 0.5)
- Moved the legacy effects into a Unitypackage file so that they are not imported by default anymore
- Updated and changed the readme format from txt to html for better readability and navigation
R 1.3.1
- Removed 'NEW' suffix in shader names, as it was meant for internal testing
R 1.3.0
- Replaced the old .shader files with a new .cfxrshader file format, that will only compile them for the currently active render pipeline (this should fix all issues related to the effects not working in builds using Addressables or Asset Bundles)
- Harmonized version numbering across all Cartoon FX packs
R 1.0.7
- Distortion effects now work with URP 2D Renderer
R 1.0.6
- Fixed possible shader compilation error when Single-pass instanced rendering is enabled
R 1.0.5
- Removed mentions of the "Cartoon FX Easy Editor" in the readme files as it is not included with the free version of Cartoon FX Remaster
R 1.0.4
- Reorganized the shader code in a separate file to avoid a 'multi_compile' hack, which will hopefully fix issues with Asset Bundles/Addressables
R 1.0.3
- Improved CFXR_ParticleText usability when toggling the "is Dynamic" flag on an existing text effect
- Disabled mesh GPU instancing in the shaders because it was causing too many issues (even when using Unity's default particle shader)
R 1.0.2
- Removed GPU instancing support on the "CFXR Procedural Ring" shader, because it visually breaks it
- Fixed compilation error related to 'projPos' in the "CFXR Particle Glow" shader
R 1.0.1
- Added support for GPU instancing in the shaders
- Fixed possible build error when adding a text effect in a prefab due to HideFlags
R 1.0.0
- First release of "Cartoon FX Remaster FREE" with new free effects taken from all four Remaster packs</div>
</div>
</div>
</body>
<script>
// email link
let span = document.getElementById("email_link");
let email = span.innerText;
span.innerHTML = "<a href='mailto:" + email + "'>" + email + "</a>";
span = document.getElementById("email_link2");
email = span.innerText;
span.innerHTML = "<a href='mailto:" + email + "'>" + email + "</a>";
// changelog formatting
let changelog_div = document.getElementById("changelog_content");
changelog_div.innerText = changelog_div.innerText.trim();
</script>
</html>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d583bfe3b4c961241ad4cf33559a195f
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: