-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ef41c29
Showing
9 changed files
with
677 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright 2023 mes51 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Unmult | ||
|
||
## is何 | ||
|
||
* Knoll UnMultと同様な動きをするエフェクト | ||
|
||
## ダウンロード | ||
|
||
* Releasesからzipファイルをダウンロードしてください | ||
|
||
## インストール・アンインストール | ||
|
||
* dllファイルをpluginディレクトリにコピー、または削除 | ||
|
||
## 使用方法 | ||
|
||
* 映像エフェクトの加工からUnmultを適用するのみ | ||
* パラメータはなし | ||
|
||
### 注意点等(使用できる素材等) | ||
|
||
* https://www.nicovideo.jp/watch/sm39935396 | ||
* AVIUtl版のものですが動作は全く一緒です | ||
|
||
## ライセンス | ||
|
||
* MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.7.34031.279 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YMM_Unmult", "YMM_Unmult\YMM_Unmult.csproj", "{6F99CB0F-8B2F-4C31-ABB4-AA16DF59A37E}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{6F99CB0F-8B2F-4C31-ABB4-AA16DF59A37E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6F99CB0F-8B2F-4C31-ABB4-AA16DF59A37E}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{6F99CB0F-8B2F-4C31-ABB4-AA16DF59A37E}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{6F99CB0F-8B2F-4C31-ABB4-AA16DF59A37E}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {1A2F8E2D-D9F8-470B-8867-3B30BF4B8702} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Texture2D InputTexture : register(t0); | ||
SamplerState InputSampler : register(s0); | ||
|
||
float4 main(float4 pos : SV_POSITION, float4 posScene : SCENE_POSITION, float4 uv0 : TEXCOORD0) : SV_Target | ||
{ | ||
float4 color = InputTexture.Sample(InputSampler, uv0.xy); | ||
float3 p = color.rgb * color.a; | ||
|
||
float irate = max(max(p.r, p.g), p.b); | ||
if (irate <= 0.0) | ||
{ | ||
return float4(0.0, 0.0, 0.0, 0.0); | ||
} | ||
|
||
float3 t = p / irate; | ||
float ta = 0.0; | ||
if (t.b > 0.0) | ||
{ | ||
ta = p.b / t.b; | ||
} | ||
else if (t.g > 0.0) | ||
{ | ||
ta = p.g / t.g; | ||
} | ||
else if (t.r > 0.0) | ||
{ | ||
ta = p.r / t.r; | ||
} | ||
|
||
if (ta > 0.0) | ||
{ | ||
return float4(t * ta, ta); | ||
} | ||
else | ||
{ | ||
return float4(0.0, 0.0, 0.0, 0.0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using YMM_Unmult; | ||
using YukkuriMovieMaker.Commons; | ||
using YukkuriMovieMaker.Exo; | ||
using YukkuriMovieMaker.Player.Video; | ||
using YukkuriMovieMaker.Plugin.Effects; | ||
|
||
namespace mes51.YMM_Unmult | ||
{ | ||
[VideoEffect("Unmult", new string[] { "‰ÁH" }, new string[] { })] | ||
public class Unmult : VideoEffectBase | ||
{ | ||
public override string Label => "Unmult"; | ||
|
||
public override IEnumerable<string> CreateExoVideoFilters(int keyFrameIndex, ExoOutputDescription exoOutputDescription) | ||
{ | ||
return Enumerable.Empty<string>(); | ||
} | ||
|
||
public override IVideoEffectProcessor CreateVideoEffect(IGraphicsDevicesAndContext devices) | ||
{ | ||
return new UnmultProcessor(devices); | ||
} | ||
|
||
protected override IEnumerable<IAnimatable> GetAnimatables() | ||
{ | ||
return Enumerable.Empty<IAnimatable>(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Vortice.Direct2D1; | ||
using YukkuriMovieMaker.Commons; | ||
using YukkuriMovieMaker.Player.Video; | ||
|
||
namespace YMM_Unmult | ||
{ | ||
class UnmultCustomEffect : D2D1CustomShaderEffectBase | ||
{ | ||
public UnmultCustomEffect(IGraphicsDevicesAndContext devices) : base(Create<EffectImpl>(devices)) { } | ||
} | ||
|
||
[CustomEffect(1)] | ||
file class EffectImpl : D2D1CustomShaderEffectImplBase<EffectImpl> | ||
{ | ||
public EffectImpl() : base(GetShader()) { } | ||
|
||
protected override void UpdateConstants() { } | ||
|
||
static byte[] GetShader() | ||
{ | ||
var assembly = typeof(EffectImpl).Assembly; | ||
using var stream = assembly.GetManifestResourceStream("Unmult_Shader.cso"); | ||
if (stream != null) | ||
{ | ||
var result = new byte[stream.Length]; | ||
stream.Read(result, 0, result.Length); | ||
return result; | ||
} | ||
else | ||
{ | ||
return Array.Empty<byte>(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Vortice.Direct2D1; | ||
using YukkuriMovieMaker.Commons; | ||
using YukkuriMovieMaker.Player.Video; | ||
using YukkuriMovieMaker.Player.Video.Effects; | ||
|
||
namespace YMM_Unmult | ||
{ | ||
class UnmultProcessor : IVideoEffectProcessor | ||
{ | ||
public ID2D1Image Output => OutputInternal ?? Input ?? throw new NullReferenceException(); | ||
|
||
ID2D1Image? Input { get; set; } | ||
|
||
ID2D1Image? OutputInternal { get; set; } | ||
|
||
UnmultCustomEffect Effect { get; } | ||
|
||
public UnmultProcessor(IGraphicsDevicesAndContext devices) | ||
{ | ||
Effect = new UnmultCustomEffect(devices); | ||
if (Effect.IsEnabled) | ||
{ | ||
OutputInternal = Effect.Output; | ||
} | ||
} | ||
|
||
public void ClearInput() | ||
{ | ||
if (Effect.IsEnabled) | ||
{ | ||
Effect.SetInput(0, null, true); | ||
} | ||
} | ||
|
||
public void SetInput(ID2D1Image input) | ||
{ | ||
Input = input; | ||
if (Effect.IsEnabled) | ||
{ | ||
Effect.SetInput(0, input, true); | ||
} | ||
} | ||
|
||
public DrawDescription Update(EffectDescription effectDescription) | ||
{ | ||
return effectDescription.DrawDescription; | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
Output?.Dispose(); | ||
if (Effect.IsEnabled) | ||
{ | ||
Effect.SetInput(0, null, true); | ||
} | ||
Effect.Dispose(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<UseWPF>true</UseWPF> | ||
<Authors>mes51</Authors> | ||
<Title>YMM_Unmult</Title> | ||
<Copyright>mes51</Copyright> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Remove="Shader\Unmult.hlsl" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PixelShader Include="Shader\Unmult.hlsl" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.HLSL.CSharpVB" Version="1.0.2" /> | ||
<PackageReference Include="Vortice.Direct2D1" Version="2.1.8-beta" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="YukkuriMovieMaker.Controls"> | ||
<HintPath>..\..\YukkuriMovieMaker_v4\YukkuriMovieMaker.Controls.dll</HintPath> | ||
</Reference> | ||
<Reference Include="YukkuriMovieMaker.Plugin"> | ||
<HintPath>..\..\YukkuriMovieMaker_v4\YukkuriMovieMaker.Plugin.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<EmbeddedResource Include="$(IntermediateOutputPath)\Shader\Unmult.cso"> | ||
<LogicalName>Unmult_Shader.cso</LogicalName> | ||
</EmbeddedResource> | ||
</ItemGroup> | ||
</Project> |