縁取りの範囲を決めるピクセルシェーダーを追加する
このコミットが含まれているのは:
4ファイル変更
+45
検索条件に一致するファイルはありません
@@ -0,0 +1,31 @@
|
||||
Texture2D SourceTexture : register(t0);
|
||||
SamplerState SourceSampler : register(s0);
|
||||
|
||||
cbuffer Constants : register(b0)
|
||||
{
|
||||
float featherLow : packoffset(c0.x);
|
||||
float featherInverseWidth : packoffset(c0.y);
|
||||
float opacity : packoffset(c0.z);
|
||||
float bandOffset : packoffset(c0.w);
|
||||
float2 bandDirection : packoffset(c1.x);
|
||||
float bandEdgeNear : packoffset(c1.z);
|
||||
float bandEdgeFar : packoffset(c1.w);
|
||||
float4 sourceBounds : packoffset(c2);
|
||||
};
|
||||
|
||||
float4 main(
|
||||
float4 pos : SV_POSITION,
|
||||
float4 posScene : SCENE_POSITION,
|
||||
float4 uv0 : TEXCOORD0) : SV_TARGET
|
||||
{
|
||||
bool isInside = posScene.x >= sourceBounds.x && posScene.y >= sourceBounds.y && posScene.x < sourceBounds.z && posScene.y < sourceBounds.w;
|
||||
float coverage = isInside ? SourceTexture.SampleLevel(SourceSampler, uv0.xy, 0).a : 1.0f;
|
||||
float ramp = saturate((coverage - featherLow) * featherInverseWidth);
|
||||
float feather = featherInverseWidth > 0.0f ? ramp * ramp * (3.0f - 2.0f * ramp) : step(featherLow, coverage);
|
||||
|
||||
float bandDistance = abs(dot(posScene.xy, bandDirection) + bandOffset);
|
||||
float band = bandEdgeFar > bandEdgeNear ? 1.0f - smoothstep(bandEdgeNear, bandEdgeFar, bandDistance) : step(bandDistance, bandEdgeNear);
|
||||
|
||||
float mask = feather * band * opacity;
|
||||
return float4(mask, mask, mask, mask);
|
||||
}
|
||||
@@ -151,6 +151,14 @@
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
|
||||
</FxCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="OutlineMask.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
|
||||
</FxCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -19,4 +19,9 @@
|
||||
<Filter>ソース ファイル</Filter>
|
||||
</FxCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="OutlineMask.hlsl">
|
||||
<Filter>ソース ファイル</Filter>
|
||||
</FxCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -62,6 +62,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="$(ShaderDirPath)OutlineDilation.cso" Link="Resources\Shader\OutlineDilation.cso" />
|
||||
<Resource Include="$(ShaderDirPath)OutlineMask.cso" Link="Resources\Shader\OutlineMask.cso" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする