合成でも塗りを元の解像度の素材の不透明度で頭打ちにする
・作業解像度より大きな素材で縁が元より濃く描かれる不具合を修正-F
このコミットが含まれているのは:
2ファイル変更
+17
-3
検索条件に一致するファイルはありません
@@ -24,6 +24,7 @@ float4 main(
|
||||
|
||||
float4 poly = PolyTexture.SampleLevel(PolySampler, uv1.xy, 0);
|
||||
poly.rgb = min(poly.rgb, poly.a.xxx);
|
||||
poly *= poly.a > source.a ? source.a / poly.a : 1.0;
|
||||
float covered = source.a > 0.0 ? saturate(poly.a / source.a) : 1.0;
|
||||
float4 blended = poly + source * (1.0 - covered);
|
||||
return lerp(source, blended, amount);
|
||||
|
||||
@@ -173,7 +173,21 @@ public sealed class LowPolyAbstractionCustomEffectTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TrianglesOutsideTheSourceAreDrawnOnTheirOwn()
|
||||
public void TrianglesMoreOpaqueThanTheSourceAreLoweredToItsOpacity()
|
||||
{
|
||||
using var devices = new GraphicsDevices();
|
||||
using var context = devices.CreateContext();
|
||||
using var source = SourceImage.Solid(context, Width, Height, new Bgra(255, 0, 0, 100));
|
||||
using var poly = SourceImage.Solid(context, Width, Height, new Bgra(0, 0, 255, 200));
|
||||
var expected = new Bgra(0, 0, 100, 100);
|
||||
|
||||
var rendering = Render(context, source.Bitmap, poly.Bitmap, 1f);
|
||||
|
||||
Assert.All(rendering.Coordinates(), point => Assert.True(WithinRounding(expected, rendering[point.X, point.Y]), $"({point.X}, {point.Y}) {rendering[point.X, point.Y]}"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TrianglesOutsideTheSourceAreNotDrawn()
|
||||
{
|
||||
using var devices = new GraphicsDevices();
|
||||
using var context = devices.CreateContext();
|
||||
@@ -181,11 +195,10 @@ public sealed class LowPolyAbstractionCustomEffectTests
|
||||
using var poly = SourceImage.Solid(context, 8, 8, HalfPoly);
|
||||
using var moved = Translate(context, poly.Bitmap, 50f, 4f);
|
||||
using var movedOutput = moved.Output;
|
||||
var expected = Over(HalfPoly.Premultiplied(), Bgra.Transparent, 1f);
|
||||
|
||||
var rendering = Render(context, source.Bitmap, movedOutput, 1f);
|
||||
|
||||
Assert.True(WithinRounding(expected, rendering[53, 7]), $"{rendering[53, 7]}");
|
||||
Assert.Equal(Bgra.Transparent, rendering[53, 7]);
|
||||
Assert.Equal(Blue.Premultiplied(), rendering[10, 10]);
|
||||
Assert.Equal(Bgra.Transparent, rendering[45, 10]);
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする