# 入口函数
Custom Surface Shader 的入口函数使用固定签名。入口函数名称由 Declaration 块中的 EntryPoint 指定。
# 签名
void EntryPoint(vec2 uv, vec3 worldPosition, inout StandardSurfaceOutput surfaceOutput)
# 参数
| 参数 | 数据类型 | 访问方式 | 说明 | 生效环境 |
|---|---|---|---|---|
| uv | vec2 | 只读 | 当前片元的插值纹理坐标 | 全部 |
| worldPosition | vec3 | 只读 | 当前片元的世界空间位置 | 全部 |
| surfaceOutput | StandardSurfaceOutput | 读写(inout) | 表面输出结构;入口函数读取或修改其中的字段 | 全部 |
# 声明入口
EntryPoint 的值必须与 Code 块中对应入口函数的名称一致:
Declaration
{
[Option] EntryPoint: "MySurface"
}
Code
{
void MySurface(vec2 uv, vec3 worldPosition, inout StandardSurfaceOutput surfaceOutput) {
// 修改 surfaceOutput
}
}
# 限制
← API 参考索引 StandardSurfaceOutput →
网易大神
扫码下载网易大神