shader-graph-create-custom-node
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGenerating a custom Shader Graph node
生成自定义Shader Graph节点
Step 1: Generate an HLSL function definition
步骤1:生成HLSL函数定义
- The function must be preceded by the preprocessor define
UNITY_EXPORT_REFLECTION
- 函数前必须添加预处理器定义
UNITY_EXPORT_REFLECTION
Step 2: Decorate with Shader Graph hint tags
步骤2:添加Shader Graph提示标签
- See for all valid hint tags and usage patterns
resources/all_hints.hlsl - C#-style documentation tags are supported outside of or
funchintsblocksparamhints - Required function hints:
sg:ProviderKeysg:SearchCategorysg:SearchTermssg:DisplayName
- 查看获取所有有效提示标签及使用模式
resources/all_hints.hlsl - 在或
funchints块外支持C#风格的文档标签paramhints - 必填函数提示:
sg:ProviderKeysg:SearchCategorysg:SearchTermssg:DisplayName
Step 3: Write the code to an asset
步骤3:将代码写入资源文件
- Search the project for a asset (
ShaderInclude) that already contains custom Shader Graph nodes.hlsl - If a matching asset exists, show the user its current contents and ask for confirmation before appending the new code
- If no matching asset exists, create a new asset
.hlsl - Ensure the file begins with
#include "ShaderApiReflectionSupport.hlsl"
- 在项目中搜索已包含自定义Shader Graph节点的资源(
ShaderInclude格式).hlsl - 如果存在匹配的资源,先向用户展示其当前内容,在追加新代码前请求确认
- 如果没有匹配的资源,创建新的资源
.hlsl - 确保文件开头包含
#include "ShaderApiReflectionSupport.hlsl"