Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
timchen1002
CustomSRP_08_ComplexMaps
提交
dc6403ea
C
CustomSRP_08_ComplexMaps
项目概览
timchen1002
/
CustomSRP_08_ComplexMaps
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
CustomSRP_08_ComplexMaps
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
dc6403ea
编写于
9月 16, 2021
作者:
timchen1002
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
udpate
上级
85339df0
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
187 addition
and
75 deletion
+187
-75
Assets/Custom RP/Shaders/Lit.shader
Assets/Custom RP/Shaders/Lit.shader
+9
-0
Assets/Custom RP/Shaders/LitInput.hlsl
Assets/Custom RP/Shaders/LitInput.hlsl
+74
-37
Assets/Custom RP/Shaders/LitPass.hlsl
Assets/Custom RP/Shaders/LitPass.hlsl
+37
-15
Assets/Custom RP/Shaders/MetaPass.hlsl
Assets/Custom RP/Shaders/MetaPass.hlsl
+5
-4
Assets/Custom RP/Shaders/ShadowCasterPass.hlsl
Assets/Custom RP/Shaders/ShadowCasterPass.hlsl
+5
-2
Assets/Custom RP/Shaders/UnlitInput.hlsl
Assets/Custom RP/Shaders/UnlitInput.hlsl
+50
-11
Assets/Custom RP/Shaders/UnlitPass.hlsl
Assets/Custom RP/Shaders/UnlitPass.hlsl
+4
-3
Assets/Test Materials/Circuitry/Circuitry.mat
Assets/Test Materials/Circuitry/Circuitry.mat
+3
-3
未找到文件。
Assets/Custom RP/Shaders/Lit.shader
浏览文件 @
dc6403ea
...
...
@@ -12,6 +12,8 @@ Shader "Custom RP/Lit"
// 阴影模式
[
KeywordEnum
(
On
,
Clip
,
Dither
,
Off
)]
_Shadows
(
"Shadows"
,
Float
)
=
0
// 是否使用遮罩纹理
[
Toggle
(
_MASK_MAP
)]
_MaskMapToggle
(
"Mask Map"
,
Float
)
=
0
// 遮罩纹理
[
NoScaleOffset
]
_MaskMap
(
"Mask (MODS)"
,
2
D
)
=
"white"
{}
// 金属度
...
...
@@ -23,6 +25,8 @@ Shader "Custom RP/Lit"
// 菲涅尔反射强度
_Fresnel
(
"Fresnel"
,
Range
(
0
,
1
))
=
1
// 是否使用法线纹理
[
Toggle
(
_NORMAL_MAP
)]
_NormalMapToggle
(
"Normal Map"
,
Float
)
=
0
// 法线贴图
[
NoScaleOffset
]
_NormalMap
(
"Normals"
,
2
D
)
=
"bump"
{}
_NormalScale
(
"Normal Scale"
,
Range
(
0
,
1
))
=
1
...
...
@@ -31,6 +35,8 @@ Shader "Custom RP/Lit"
[
NoScaleOffset
]
_EmissionMap
(
"Emission"
,
2
D
)
=
"white"
{}
[
HDR
]
_EmissionColor
(
"Emission"
,
Color
)
=
(
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
)
// 是否使用细节纹理
[
Toggle
(
_DETAIL_MAP
)]
_DetailMapToggle
(
"Detail Maps"
,
Float
)
=
0
// 细节纹理
_DetailMap
(
"Details"
,
2
D
)
=
"linearGrey"
{}
// 细节法线纹理
...
...
@@ -79,6 +85,9 @@ Shader "Custom RP/Lit"
#pragma shader_feature _RECEIVE_SHADOWS
// 是否透明通道预乘
#pragma shader_feature _PREMULTIPLY_ALPHA
#pragma shader_feature _MASK_MAP
#pragma shader_feature _NORMAL_MAP
#pragma shader_feature _DETAIL_MAP
#pragma multi_compile _ _DIRECTIONAL_PCF3 _DIRECTIONAL_PCF5 _DIRECTIONAL_PCF7
#pragma multi_compile _ _CASCADE_BLEND_SOFT _CASCADE_BLEND_DITHER
#pragma multi_compile _ _SHADOW_MASK_ALWAYS _SHADOW_MASK_DISTANCE
...
...
Assets/Custom RP/Shaders/LitInput.hlsl
浏览文件 @
dc6403ea
...
...
@@ -24,15 +24,29 @@ UNITY_INSTANCING_BUFFER_START(UnityPerMaterial)
UNITY_DEFINE_INSTANCED_PROP
(
float
,
_Fresnel
)
UNITY_DEFINE_INSTANCED_PROP
(
float
,
_DetailAlbedo
)
UNITY_DEFINE_INSTANCED_PROP
(
float
,
_DetailSmoothness
)
UNITY_DEFINE_INSTANCED_PROP
(
float
,
_DetailNormalScale
)
UNITY_DEFINE_INSTANCED_PROP
(
float
,
_DetailNormalScale
)
UNITY_DEFINE_INSTANCED_PROP
(
float
,
_NormalScale
)
UNITY_INSTANCING_BUFFER_END
(
UnityPerMaterial
)
// 通过UNITY_ACCESS_INSTANCED_PROP访问material属性
#define INPUT_PROP(name) UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, name)
float4
GetMask
(
float2
baseUV
)
struct
InputConfig
{
return
SAMPLE_TEXTURE2D
(
_MaskMap
,
sampler_BaseMap
,
baseUV
);
float2
baseUV
;
float2
detailUV
;
bool
useMask
;
bool
useDetail
;
};
InputConfig
GetInputConfig
(
float2
baseUV
,
float2
detailUV
=
0
.
0
)
{
InputConfig
c
;
c
.
baseUV
=
baseUV
;
c
.
detailUV
=
detailUV
;
c
.
useMask
=
false
;
c
.
useDetail
=
false
;
return
c
;
}
// 基本纹理UV变换
...
...
@@ -50,79 +64,102 @@ float2 TransformDetailUV(float2 detailUV)
return
detailUV
*
detailST
.
xy
+
detailST
.
zw
;
}
float4
Get
Detail
(
float2
detailUV
)
float4
Get
Mask
(
InputConfig
c
)
{
float
map
=
SAMPLE_TEXTURE2D
(
_DetailMap
,
sampler_DetailMap
,
detailUV
);
return
map
*
2
.
0
-
1
.
0
;
if
(
c
.
useMask
)
{
return
SAMPLE_TEXTURE2D
(
_MaskMap
,
sampler_BaseMap
,
c
.
baseUV
);
}
return
1
.
0
;
}
float4
Get
Base
(
float2
baseUV
,
float2
detailUV
=
0
.
0
)
float4
Get
Detail
(
InputConfig
c
)
{
float4
map
=
SAMPLE_TEXTURE2D
(
_BaseMap
,
sampler_BaseMap
,
baseUV
);
// 通过UNITY_ACCESS_INSTANCED_PROP访问material属性
float4
color
=
UNITY_ACCESS_INSTANCED_PROP
(
UnityPerMaterial
,
_BaseColor
);
float4
detail
=
GetDetail
(
detailUV
).
r
*
INPUT_PROP
(
_DetailAlbedo
);
float
mask
=
GetMask
(
baseUV
).
b
;
map
.
rgb
=
lerp
(
sqrt
(
map
.
rgb
),
detail
<
0
.
0
?
0
.
0
:
1
.
0
,
abs
(
detail
)
*
mask
);
map
.
rgb
*=
map
.
rgb
;
if
(
c
.
useDetail
)
{
float
map
=
SAMPLE_TEXTURE2D
(
_DetailMap
,
sampler_DetailMap
,
c
.
detailUV
);
return
map
*
2
.
0
-
1
.
0
;
}
return
0
.
0
;
}
float4
GetBase
(
InputConfig
c
)
{
float4
map
=
SAMPLE_TEXTURE2D
(
_BaseMap
,
sampler_BaseMap
,
c
.
baseUV
);
float4
color
=
INPUT_PROP
(
_BaseColor
);
if
(
c
.
useDetail
)
{
float4
detail
=
GetDetail
(
c
).
r
*
INPUT_PROP
(
_DetailAlbedo
);
float
mask
=
GetMask
(
c
).
b
;
map
.
rgb
=
lerp
(
sqrt
(
map
.
rgb
),
detail
<
0
.
0
?
0
.
0
:
1
.
0
,
abs
(
detail
)
*
mask
);
map
.
rgb
*=
map
.
rgb
;
}
return
map
*
color
;
}
float3
GetEmission
(
float2
baseUV
)
float3
GetEmission
(
InputConfig
c
)
{
float4
map
=
SAMPLE_TEXTURE2D
(
_EmissionMap
,
sampler_BaseMap
,
baseUV
);
// 通过UNITY_ACCESS_INSTANCED_PROP访问material属性
float4
color
=
UNITY_ACCESS_INSTANCED_PROP
(
UnityPerMaterial
,
_EmissionColor
);
float4
map
=
SAMPLE_TEXTURE2D
(
_EmissionMap
,
sampler_BaseMap
,
c
.
baseUV
);
float4
color
=
INPUT_PROP
(
_EmissionColor
);
return
map
.
rgb
*
color
.
rgb
;
}
float
GetCutoff
(
float2
baseUV
)
float
GetCutoff
(
InputConfig
c
)
{
// 透明度低于阈值的片元进行舍弃
return
UNITY_ACCESS_INSTANCED_PROP
(
UnityPerMaterial
,
_Cutoff
);
return
INPUT_PROP
(
_Cutoff
);
}
float
GetMetallic
(
float2
baseUV
)
float
GetMetallic
(
InputConfig
c
)
{
float
metallic
=
INPUT_PROP
(
_Metallic
);
metallic
*=
GetMask
(
baseUV
).
r
;
metallic
*=
GetMask
(
c
).
r
;
return
metallic
;
}
float
GetSmoothness
(
float2
baseUV
,
float2
detailUV
=
0
.
0
)
float
GetSmoothness
(
InputConfig
c
)
{
float
smoothness
=
INPUT_PROP
(
_Smoothness
);
smoothness
*=
GetMask
(
baseUV
).
a
;
float
detail
=
GetDetail
(
detailUV
).
b
*
INPUT_PROP
(
_DetailSmoothness
);
float
mask
=
GetMask
(
baseUV
).
b
;
smoothness
=
lerp
(
smoothness
,
detail
<
0
.
0
?
0
.
0
:
1
.
0
,
abs
(
detail
)
*
mask
);
smoothness
*=
GetMask
(
c
).
a
;
if
(
c
.
useDetail
)
{
float
detail
=
GetDetail
(
c
).
b
*
INPUT_PROP
(
_DetailSmoothness
);
float
mask
=
GetMask
(
c
).
b
;
smoothness
=
lerp
(
smoothness
,
detail
<
0
.
0
?
0
.
0
:
1
.
0
,
abs
(
detail
)
*
mask
);
}
return
smoothness
;
}
float
GetFresnel
(
float2
baseUV
)
float
GetFresnel
(
InputConfig
c
)
{
return
UNITY_ACCESS_INSTANCED_PROP
(
UnityPerMaterial
,
_Fresnel
);
return
INPUT_PROP
(
_Fresnel
);
}
float
GetOcclusion
(
float2
baseUV
)
float
GetOcclusion
(
InputConfig
c
)
{
float
strength
=
INPUT_PROP
(
_Occlusion
);
float
occlusion
=
GetMask
(
baseUV
).
g
;
float
occlusion
=
GetMask
(
c
).
g
;
occlusion
=
lerp
(
occlusion
,
1
.
0
,
strength
);
return
occlusion
;
}
// 采样法线并解码法线向量a
float3
GetNormalTS
(
float2
baseUV
,
float2
detailUV
=
0
.
0
)
float3
GetNormalTS
(
InputConfig
c
)
{
float4
map
=
SAMPLE_TEXTURE2D
(
_NormalMap
,
sampler_BaseMap
,
baseUV
);
float4
map
=
SAMPLE_TEXTURE2D
(
_NormalMap
,
sampler_BaseMap
,
c
.
baseUV
);
float
scale
=
INPUT_PROP
(
_NormalScale
);
float3
normal
=
DecodeNormal
(
map
,
scale
);
map
=
SAMPLE_TEXTURE2D
(
_DetailNormalMap
,
sampler_DetailMap
,
detailUV
);
scale
=
INPUT_PROP
(
_DetailNormalScale
)
*
GetMask
(
baseUV
).
b
;
float3
detail
=
DecodeNormal
(
map
,
scale
);
normal
=
BlendNormalRNM
(
normal
,
detail
);
if
(
c
.
useDetail
)
{
map
=
SAMPLE_TEXTURE2D
(
_DetailNormalMap
,
sampler_DetailMap
,
c
.
detailUV
);
scale
=
INPUT_PROP
(
_DetailNormalScale
)
*
GetMask
(
c
).
b
;
float3
detail
=
DecodeNormal
(
map
,
scale
);
normal
=
BlendNormalRNM
(
normal
,
detail
);
}
return
normal
;
}
...
...
Assets/Custom RP/Shaders/LitPass.hlsl
浏览文件 @
dc6403ea
...
...
@@ -27,11 +27,15 @@ struct Varyings
float4
positionCS
:
SV_POSITION
;
float3
positionWS
:
VAR_POSITION
;
float2
baseUV
:
VAR_BASE_UV
;
float2
detailUV
:
VAR_DETAIL_UV
;
#if defined(_DETAIL_MAP)
float2
detailUV
:
VAR_DETAIL_UV
;
#endif
// 世界法线
float3
normalWS
:
VAR_NORMAL
;
// 世界空间的切线
float4
tangentWS
:
VAR_TANGENT
;
#if defined(_NORMAL_MAP)
// 世界空间的切线
float4
tangentWS
:
VAR_TANGENT
;
#endif
GI_ATTRIBUTE_DATA
UNITY_VERTEX_INPUT_INSTANCE_ID
};
...
...
@@ -48,11 +52,15 @@ Varyings LitPassVertex(Attributes input)
output
.
positionCS
=
TransformWorldToHClip
(
output
.
positionWS
);
// 计算世界空间的法线
output
.
normalWS
=
TransformObjectToWorldNormal
(
input
.
normalOS
);
// 计算世界空间的切线
output
.
tangentWS
=
float4
(
TransformObjectToWorldDir
(
input
.
tangentOS
.
xyz
),
input
.
tangentOS
.
w
);
#if defined(_NORMAL_MAP)
// 计算世界空间的切线
output
.
tangentWS
=
float4
(
TransformObjectToWorldDir
(
input
.
tangentOS
.
xyz
),
input
.
tangentOS
.
w
);
#endif
// 计算缩放和偏移后的UV坐标
output
.
baseUV
=
TransformBaseUV
(
input
.
baseUV
);
output
.
detailUV
=
TransformDetailUV
(
input
.
baseUV
);
#if defined(_DETAIL_MAP)
output
.
detailUV
=
TransformDetailUV
(
input
.
baseUV
);
#endif
return
output
;
}
...
...
@@ -62,25 +70,39 @@ float4 LitPassFragment(Varyings input) : SV_TARGET
UNITY_SETUP_INSTANCE_ID
(
input
);
ClipLOD
(
input
.
positionCS
.
xy
,
unity_LODFade
.
x
);
float4
base
=
GetBase
(
input
.
baseUV
,
input
.
detailUV
);
InputConfig
config
=
GetInputConfig
(
input
.
baseUV
);
#if defined(_MASK_MAP)
config
.
useMask
=
true
;
#endif
#if defined(_DETAIL_MAP)
config
.
detailUV
=
input
.
detailUV
;
config
.
useDetail
=
true
;
#endif
float4
base
=
GetBase
(
config
);
#if defined(_CLIPPING)
// 透明度低于阈值的片元进行舍弃
clip
(
base
.
a
-
GetCutoff
(
input
.
baseUV
));
clip
(
base
.
a
-
GetCutoff
(
config
));
#endif
// 定义一个surface并填充属性
Surface
surface
;
surface
.
position
=
input
.
positionWS
;
surface
.
normal
=
NormalTangentToWorld
(
GetNormalTS
(
input
.
baseUV
,
input
.
detailUV
),
input
.
normalWS
,
input
.
tangentWS
);
surface
.
interpolatedNormal
=
input
.
normalWS
;
#if defined(_NORMAL_MAP)
surface
.
normal
=
NormalTangentToWorld
(
GetNormalTS
(
config
),
input
.
normalWS
,
input
.
tangentWS
);
surface
.
interpolatedNormal
=
input
.
normalWS
;
#else
surface
.
normal
=
normalize
(
input
.
normalWS
);
surface
.
interpolatedNormal
=
surface
.
normal
;
#endif
// 得到视角方向
surface
.
viewDirection
=
normalize
(
_WorldSpaceCameraPos
-
input
.
positionWS
);
surface
.
depth
=
-
TransformWorldToView
(
input
.
positionWS
).
z
;
surface
.
color
=
base
.
rgb
;
surface
.
alpha
=
base
.
a
;
surface
.
metallic
=
GetMetallic
(
input
.
baseUV
);
surface
.
smoothness
=
GetSmoothness
(
input
.
baseUV
,
input
.
detailUV
);
surface
.
fresnelStrength
=
GetFresnel
(
input
.
baseUV
);
surface
.
occlusion
=
GetOcclusion
(
input
.
baseUV
);
surface
.
metallic
=
GetMetallic
(
config
);
surface
.
smoothness
=
GetSmoothness
(
config
);
surface
.
fresnelStrength
=
GetFresnel
(
config
);
surface
.
occlusion
=
GetOcclusion
(
config
);
// 计算抖动值
surface
.
dither
=
InterleavedGradientNoise
(
input
.
positionCS
.
xy
,
0
);
// 通过表面属性和BRDF计算最终光照结果
...
...
@@ -92,7 +114,7 @@ float4 LitPassFragment(Varyings input) : SV_TARGET
// 获取全局照明数据
GI
gi
=
GetGI
(
GI_FRAGMENT_DATA
(
input
),
surface
,
brdf
);
float3
color
=
GetLighting
(
surface
,
brdf
,
gi
);
color
+=
GetEmission
(
input
.
baseUV
);
color
+=
GetEmission
(
config
);
return
float4
(
color
,
surface
.
alpha
);
}
...
...
Assets/Custom RP/Shaders/MetaPass.hlsl
浏览文件 @
dc6403ea
...
...
@@ -33,12 +33,13 @@ Varyings MetaPassVertex(Attributes input)
float4
MetaPassFragment
(
Varyings
input
)
:
SV_TARGET
{
float4
base
=
GetBase
(
input
.
baseUV
);
InputConfig
config
=
GetInputConfig
(
input
.
baseUV
);
float4
base
=
GetBase
(
config
);
Surface
surface
;
ZERO_INITIALIZE
(
Surface
,
surface
);
surface
.
color
=
base
.
rgb
;
surface
.
metallic
=
GetMetallic
(
input
.
baseUV
);
surface
.
smoothness
=
GetSmoothness
(
input
.
baseUV
);
surface
.
metallic
=
GetMetallic
(
config
);
surface
.
smoothness
=
GetSmoothness
(
config
);
BRDF
brdf
=
GetBRDF
(
surface
);
float4
meta
=
0
.
0
;
if
(
unity_MetaFragmentControl
.
x
)
...
...
@@ -51,7 +52,7 @@ float4 MetaPassFragment(Varyings input) : SV_TARGET
}
else
if
(
unity_MetaFragmentControl
.
y
)
{
meta
=
float4
(
GetEmission
(
input
.
baseUV
),
1
.
0
);
meta
=
float4
(
GetEmission
(
config
),
1
.
0
);
}
return
meta
;
}
...
...
Assets/Custom RP/Shaders/ShadowCasterPass.hlsl
浏览文件 @
dc6403ea
...
...
@@ -42,10 +42,13 @@ Varyings ShadowCasterPassVertex(Attributes input)
void
ShadowCasterPassFragment
(
Varyings
input
)
{
UNITY_SETUP_INSTANCE_ID
(
input
);
float4
base
=
GetBase
(
input
.
baseUV
);
ClipLOD
(
input
.
positionCS
.
xy
,
unity_LODFade
.
x
);
InputConfig
config
=
GetInputConfig
(
input
.
baseUV
);
float4
base
=
GetBase
(
config
);
#if defined(_SHADOWS_CLIP)
// 透明度低于阈值的片元进行舍弃
clip
(
base
.
a
-
GetCutoff
(
input
.
baseUV
));
clip
(
base
.
a
-
GetCutoff
(
config
));
#elif defined(_SHADOWS_DITHER)
// 计算抖动值
float
dither
=
InterleavedGradientNoise
(
input
.
positionCS
.
xy
,
0
);
...
...
Assets/Custom RP/Shaders/UnlitInput.hlsl
浏览文件 @
dc6403ea
...
...
@@ -10,39 +10,78 @@ UNITY_INSTANCING_BUFFER_START(UnityPerMaterial)
UNITY_DEFINE_INSTANCED_PROP
(
float
,
_Cutoff
)
UNITY_INSTANCING_BUFFER_END
(
UnityPerMaterial
)
// 通过UNITY_ACCESS_INSTANCED_PROP访问material属性
#define INPUT_PROP(name) UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, name)
struct
InputConfig
{
float2
baseUV
;
};
InputConfig
GetInputConfig
(
float2
baseUV
)
{
InputConfig
c
;
c
.
baseUV
=
baseUV
;
return
c
;
}
float2
TransformBaseUV
(
float2
baseUV
)
{
// 计算缩放和偏移后的UV坐标
float4
baseST
=
UNITY_ACCESS_INSTANCED_PROP
(
UnityPerMaterial
,
_BaseMap_ST
);
float4
baseST
=
INPUT_PROP
(
_BaseMap_ST
);
return
baseUV
*
baseST
.
xy
+
baseST
.
zw
;
}
float4
GetBase
(
float2
baseUV
)
float2
TransformDetailUV
(
float2
baseUV
)
{
return
0
.
0
;
}
float4
GetMask
(
InputConfig
c
)
{
return
1
.
0
;
}
float4
GetDetail
(
InputConfig
c
)
{
return
0
.
0
;
}
float4
GetBase
(
InputConfig
c
)
{
float4
baseMap
=
SAMPLE_TEXTURE2D
(
_BaseMap
,
sampler_BaseMap
,
baseUV
);
// 通过UNITY_ACCESS_INSTANCED_PROP访问material属性
float4
baseColor
=
UNITY_ACCESS_INSTANCED_PROP
(
UnityPerMaterial
,
_BaseColor
);
float4
baseMap
=
SAMPLE_TEXTURE2D
(
_BaseMap
,
sampler_BaseMap
,
c
.
baseUV
);
float4
baseColor
=
INPUT_PROP
(
_BaseColor
);
return
baseMap
*
baseColor
;
}
float3
GetEmission
(
float2
baseUV
)
float3
GetEmission
(
InputConfig
c
)
{
return
GetBase
(
c
).
rgb
;
}
float
GetCutoff
(
InputConfig
c
)
{
return
GetBase
(
baseUV
).
rgb
;
return
INPUT_PROP
(
_Cutoff
)
;
}
float
Get
Cutoff
(
float2
baseUV
)
float
Get
Metallic
(
InputConfig
c
)
{
return
UNITY_ACCESS_INSTANCED_PROP
(
UnityPerMaterial
,
_Cutoff
)
;
return
0
.
0
;
}
float
Get
Metallic
(
float2
baseUV
)
float
Get
Smoothness
(
InputConfig
c
)
{
return
0
.
0
;
}
float
Get
Smoothness
(
float2
baseUV
)
float
Get
Fresnel
(
InputConfig
c
)
{
return
0
.
0
;
}
float3
GetNormalTS
(
InputConfig
c
)
{
return
float3
(
0
.
0
,
0
.
0
,
1
.
0
);
}
#endif
\ No newline at end of file
Assets/Custom RP/Shaders/UnlitPass.hlsl
浏览文件 @
dc6403ea
...
...
@@ -34,11 +34,12 @@ Varyings UnlitPassVertex(Attributes input)
float4
UnlitPassFragment
(
Varyings
input
)
:
SV_TARGET
{
UNITY_SETUP_INSTANCE_ID
(
input
);
float4
baseMap
=
SAMPLE_TEXTURE2D
(
_BaseMap
,
sampler_BaseMap
,
input
.
baseUV
);
float4
base
=
GetBase
(
input
.
baseUV
);
InputConfig
config
=
GetInputConfig
(
input
.
baseUV
);
float4
base
=
GetBase
(
config
);
#if defined(_CLIPPING)
// 透明度低于阈值的片元进行舍弃
clip
(
base
.
a
-
GetCutoff
(
input
.
baseUV
));
clip
(
base
.
a
-
GetCutoff
(
config
));
#endif
return
base
;
}
...
...
Assets/Test Materials/Circuitry/Circuitry.mat
浏览文件 @
dc6403ea
...
...
@@ -9,7 +9,7 @@ Material:
m_PrefabAsset
:
{
fileID
:
0
}
m_Name
:
Circuitry
m_Shader
:
{
fileID
:
4800000
,
guid
:
6848ac66b88696c4ea2f1389e0877b8e
,
type
:
3
}
m_ShaderKeywords
:
_
DETAIL_MAP _MASK_MAP _NORMAL
_MAP _RECEIVE_SHADOWS _SHADOWS_ON
m_ShaderKeywords
:
_
MASK
_MAP _RECEIVE_SHADOWS _SHADOWS_ON
m_LightmapFlags
:
4
m_EnableInstancingVariants
:
1
m_DoubleSidedGI
:
0
...
...
@@ -78,7 +78,7 @@ Material:
-
_Cutoff
:
0.5
-
_DetailAlbedo
:
0.2
-
_DetailAlbedoStrength
:
1
-
_DetailMapToggle
:
1
-
_DetailMapToggle
:
0
-
_DetailNormalMapScale
:
1
-
_DetailNormalScale
:
0.5
-
_DetailSmoothness
:
0.2
...
...
@@ -90,7 +90,7 @@ Material:
-
_MaskMapToggle
:
1
-
_Metallic
:
1
-
_Mode
:
0
-
_NormalMapToggle
:
1
-
_NormalMapToggle
:
0
-
_NormalScale
:
1
-
_Occlusion
:
0.5
-
_OcclusionStrength
:
1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录