Skip to content

Hooooyu/ShaderLibrary

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

【ShaderLibrary】

[TOC]


😉约定

​ 在Unity里有Shader Forge (SF)Amplify Shader Editor (ASE)Shader Graph (SG) 三种连连看,代码虽然都是ShaderLab语法但也主要分了CGHLSL两种,故在此假定我个人的使用规范。

​ 因为CG语言NVIDIA不再更新,Unity也逐渐放弃,手机成为主流,故大多Shader使用URP管线编写,该工程以2021.3.0f1c1以上URP为基准,我更希望向上升级,尽量不向下兼容,不要再乘坐旧时代的大船了,如果说新的东西不好,那么为什么大家费时费力费钱的去更新这么些的东西。

​ 命名前缀按照制作Shader的工具类型当作前缀。如:ASE_XXX、SG_XXX...

​ Shader路径按照使用的管线分类,一级为管线类型,二级为类别。如:Default/Base/ASE_XXX、URP/Base/SG_XXX...

​ Shader采用模块化路径,每一个Shader分为一个文件夹,相关的模型材质引用都放在根目录的ShaderLib文件夹下,如:Assets/ShaderLib/Base_XXX/S_XXX.shader

命名

使用工具 前缀缩写 命名方式:前缀缩写_名称.xxx
Shader Forge SF_ SF_SimpleLit.shader
Amplify Shader Editor ASE_ ASE_SimpleLit.shader
Amplify Shader Editor 材质函数 ASEF_ ASEF_CustomLight.asset
Shader Graph SG_ SG_SimpleLit.shadergraph
Shader Graph 子图 SGS_ SGS_CustomLight.shadersubgraph
Shader Graph HLSL引用 SGH_ SGH_CustomLight.hlsl
代码 S_ S_SimpleLit.shader
CG引用 SIC_ SIC_CustomLight.cg
HLSL引用 SIH_ SIH_CustomLight.hlsl
GLSL引用(几乎不用) SIG_ SIG_CustomLight.glsl

路径

管线 命名方式:管线类型/类别/文件名
Default(默认渲染管线) Default/Base/S_SimpleLit.shader
LWRP(轻量渲染管线) LWRP/Base/S_SimpleLit.shader
URP(通用渲染管线) URP/Base/S_SimpleLit.shader
HDRP(高清渲染管线) HDRP/Base/S_SimpleLit.shader

引用材质函数/子图路径

如果不通用只用一次就放在原材质旁边,如果通用就要放在对应的Include文件夹内,如项目文件夹路径:Assets/Arts/Shaders/Include/ASE

使用工具 文件夹路径 命名方式
Shader Forge 材质函数 Assets/Arts/Shaders/Include/SF SFF_xxx
Amplify Shader Editor 材质函数 Assets/Arts/Shaders/Include/ASE ASEF_xxx
Shader Graph 子图 Assets/Arts/Shaders/Include/SG SGS_xxx
Shader Graph HLSL引用 Assets/Arts/Shaders/Include/SG SGH_xxx
CG引用 Assets/Arts/Shaders/Include/CG SIC_xxx
HLSL引用 Assets/Arts/Shaders/Include/HLSL SIH_xxx
GLSL引用 Assets/Arts/Shaders/Include/GLSL SIG_xxx

类别

​ 该工程为模块化文件夹,是为了方便导出,以及导出后的在新工程的顺利的检索和迁移,与实际项目工程文件夹会有所出入。如:

​ 模块化文件夹路径:Assets/ShaderLib/Base_SimpleLit/S_SimpleLit.shader

​ 项目文件夹路径:Assets/Arts/Shader/Base/S_SimpleLit.shader

类别 文件名 文件夹名称:类别_名称
Base(基本的) S_SimpleLit.shader Base_SimpleLit
Car(车漆相关)
Character(角色相关)
Cloud(云相关)
Effect(效果类型的)
Fog(雾效相关)
FX(给特效使用的)
Geometry(几何着色器)
Glass(玻璃相关的)
PPS(后处理相关)
Render(渲染效果)
Sky(天空盒相关)
Tool(功能性材质)
Vertex(顶点相关的)
Water(水相关的)

🤡目录

Base

Base_SimplePBR


Base_Unlit


Car

Car_CarPaint


Character

Character_Hair(Anisotropic Highlight Calculation


Character_Hair2(UVNoise)


Character_SimpleSSS


Character_Stockings


Character_StarRail


Cloud

Cloud_ParallaxCloud


Effect

Effect_BoxWire


Effect_Dissolve


Effect_Fluid


Effect_Glitch


Effect_HexagonDiffusion


Effect_Portal


Effect_RhythmLED


Effect_RhythmLEDScreen


Effect_RhythmLight


Effect_RhythmLineWave


Effect_Shield


Effect_TextureDiffusion


Effect_ThermalChange


Effect_TransitionPixel


Effect_Transitions


Effect_Transitions2


Effect_Transitions3


Effect_XRay


Fog

Fog_HeighFog


Fog_UnderWaterFog


FX

FX_UniversalParticleTransparent


Geometry

Geometry_Grass


Geometry_Wireframe


Glass

Glass_BlurGlass


Glass_Bubble


Glass_MatcapGlass


Glass_RefractGlass


PPS

PPS_Bloom


PPS_BokehBlur


PPS_DOF_BokehBlur


PPS_GaussianBlur


PPS_HueBrightnessSaturationContrast


PPS_Mosaic


PPS_VolumeLighting


Render

Render_Ink


Render_Ink2


Render_SimpleJelly


Render_SimpleToon


Render_ThreeColor


Render_Townscaper


Sky

Sky_CustomSkybox


Sky_StylizedSky


Sky_StylizedSky2


Tool

Tool_Billboard


Tool_BlendModePS(含GUI)


Tool_BlendModeUnity(含GUI)


Tool_CubeMap


Tool_Decal


Tool_Displacement


Tool_FlowMap


Tool_Fwidth


Tool_MatCap


Tool_PlanarShadow


Tool_PolarCoord


Tool_ScreenSpaceOutlines


Tool_ScreenUV


Tool_Sequence(含Billboard)


Tool_Stencil


Vertex

Vertex_VertexAnimaionTexture


Vertex_VertexAnimaionUVCut


Water

Water_LiquidWater


Water_LiquidWater2D


Water_RealWater


Water_SimpleLava


Water_ToonWater


🥰巨人的肩膀

函数相关

Cg Toolkit | NVIDIA Developer

Cg标准函数库 - 简书 (jianshu.com)

Unity Shader目录-初级篇 - 简书 (jianshu.com)

Unity Shader目录-中级篇 - 简书 (jianshu.com)

光照相关

Unity URP GI,Meta Pass,脚本切换Light Map学习 - 知乎 (zhihu.com)

About

希望开源能够帮到所有人

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 77.5%
  • ShaderLab 16.7%
  • GLSL 4.0%
  • HLSL 1.8%