Jump to content
How to Install Plugins ×

Edge Shader


MJW

Recommended Posts

Edge Shader is an updated release version of a beta-released plugin written long ago by Red Ochre and me. It shades the edges of objects, based on the distance from the edge. It's in the Object submenu.

The DLL (Version 1.0.1; May 21, 2021): Edge Shader.zip

The Help menu description:

Quote

Edge Shader shades pixels based on their distance from the the edge of object to which they belong. The color gradient begins at the edge with the Edge Color and transitions to the Interior Color.

The controls are:

Opacity Threshold: Specifies minimum opacity for object pixels. Pixels with lower opacity are not considered part of the object, and are not shaded. This value is always 1 when Use Edge Opacity in Determining Distance is enabled.

Divide Maximum Distance and Shading Offset by Ten: Specifies that the values set in the Minimum Distance and Shading Offset From Edge should be divided by ten, increasing their precision while their maximum ranges.

Maximum Distance: Specifies the maximum distance the color gradient extends. Pixels farther from the edge will be colored the Interior Color.

Shading Offset from Edge: Specifies the distance from the edge before the gradient begins. Pixels nearer to the edge will be colored the Edge Color.

Gradient Profile: Specifies the profile of the gradient. A value of zero produces a linear gradient. Values less than zero produce gradients that change slowly near the edge, then more rapidly. Values greater than zero produce gradients that change rapidly near the edge, then more slowly.

Use Edge Opacity in Determining Distance: Specifies that the opacity of the nearest edge pixel taken into account when determining the distance.

Edge Color: Selects the color to shade pixels nearest to the edges of objects. The choices are Primary Color, Secondary Color, Black, White, Original Pixel Color, and Nearest Edge-Pixel Color.

Interior Color: Selects the color to shade pixels at the end of the gradient. The choices are the same as for the Edge Color.

Blending Mode: Selects the blending mode used to combine the edge shading with the original image.

Blending Opacity: Specifies the opacity of the edge shading.

 

The user interface:

Edge-Shader-UI.png

While this version has a number of new and, I believe, useful features, it's missing one feature I hope to eventually add, and has another feature I hope (perhaps in vain) to improve.

@lynxster4 requested the option of offsetting the shading to one side or the other. I'm not certain that's possible, though I think it likely is. In any case, even if it's possible, adding the feature is quite complex. I've decided I've already delayed far too long in releasing the plugin. I will try to include the feature in a future release.

@Red ochre requested the ability to get smoother edge shading, without the jaggedness that sometimes occurs, by using the transparency of antialiased object edge pixels to adjust the distances. A partially opaque edge pixel would be interpreted as an object edge that partially extends into the pixel. That's a very good idea, and one I've tried hard to implement. The plugin includes the feature, but I'm not sure how effective it is.

The lack of effectiveness certainly isn't for lack of trying. Other than laziness, the primary reason for the delay in the plugin's release is my many experiments to find a way to accurately adjust the distance using the edge transparency. The current method is, I think, quite clever; unfortunately, I don't think it works particularly well. I hope to someday to find a method that works better.

An option that may require some explanation is the Offset. The idea is that using that Offset along with various Blending Modes may allow complex edge profiles to be built up by applying the Edge Shader several times.

 

EDIT 1 (21 May 2021): Fix crash when all transparent canvas and edge-transparency distance adjustment enabled.


 

  • Like 2
  • Upvote 3
Link to comment
Share on other sites

This crash log is obtained when running the effect with the checked 'Use Edge Opacity in Determining Distance' on an image that does not have transparency areas. This is not a disadvantage of the effect. The crash log is provided for information.

 

Spoiler

This text file was created because paint.net crashed. Please e-mail this to crashlog4@getpaint.net so we can diagnose and fix the problem.

Application version: paint.net 4.2.16 (Final 4.216.7781.39227)
Time of crash: 21.05.2021 14:16:52
Application uptime: 00:00:21.6719987
Application state: Running 
Working set: 152 076 KiB
Handles and threads: 848 handles, 30 threads, 240 gdi, 282 user
Install type: Classic
Application directory: C:\Program Files\paint.net
Current directory: C:\Program Files\paint.net
Install directory: C:\Program Files\paint.net
OS Version: Windows 10 Pro 10.0.18363.0 x64 (0x30)
.NET version: CLR 4.0.30319.42000 x64
Processor: "Pentium(R) Dual-Core CPU       T4400  @ 2.20GHz" @ ~2195MHz (2C/2T, SSE, SSE2, SSE3, SSSE3)
Physical memory: 3000 MB
Video card: Mobile Intel(R) 4 Series Express Chipset Family (Microsoft Corporation - WDDM 1.1) (v:8086, d:2A42, r:7), Microsoft Basic Render Driver (v:1414, d:8C, r:0)
Hardware acceleration: False (default: False)
Pointers: none
UI animations: False
UI DPI: 96 dpi (1,00x scale)
UI theme: VisualStyleClass=Aero, EffectiveTheme=Aero, DWM=yes, AeroColorScheme=Light, ThemeFileName=Aero.msstyles
Updates: False, 01.01.0001
Locale: pdnr.c: en-US, hklm: en-US, hkcu: en-US, cc: ru-RU, cuic: en-US
Flags: 

Exception details:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at Edge_Shader.EffectPlugin.Render(Surface dst, Surface src, Rectangle rect)
   at UtensilsPDN.PropertyBasedEffectEZ.OnRender(Rectangle[] rois, Int32 startIndex, Int32 length)
   at PaintDotNet.Effects.Effect`1.Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, Int32 startIndex, Int32 length) in D:\src\pdn\src\Effects\Effect`1.cs:line 98
   at PaintDotNet.Effects.BackgroundEffectRenderer.RenderWithClipMask(Effect effect, EffectConfigToken token, RenderArgs dstArgs, RenderArgs srcArgs, RectInt32[] rois, Result`1 lazyClipMaskRenderer) in D:\src\pdn\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 192
   at PaintDotNet.Effects.BackgroundEffectRenderer.RendererContext.RenderTile(EffectConfigToken token, Int32 tileIndex) in D:\src\pdn\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 170
   at PaintDotNet.Effects.BackgroundEffectRenderer.RendererContext.RenderNextTile(EffectConfigToken token) in D:\src\pdn\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 163
   at PaintDotNet.Effects.EffectRendererWorkItemQueue.OnExecuteNextWorkItem() in D:\src\pdn\src\PaintDotNet\Effects\EffectRendererWorkItemQueue.cs:line 130
   at PaintDotNet.Threading.MultithreadedWorkItemDispatcher.WorkThreadProc(Object context) in D:\src\pdn\src\Core\Threading\MultithreadedWorkItemDispatcher.cs:line 486
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart(Object obj)

Managed assemblies: 
    mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @ C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll
    PaintDotNet, Version=4.216.7781.39227, Culture=neutral, PublicKeyToken=null @ C:\Program Files\paint.net\PaintDotNet.exe
    PaintDotNet.Core, Version=4.216.7781.39227, Culture=neutral, PublicKeyToken=null @ C:\Program Files\paint.net\PaintDotNet.Core.dll
    PaintDotNet.Base, Version=4.216.7781.39227, Culture=neutral, PublicKeyToken=null @ C:\Program Files\paint.net\PaintDotNet.Base.dll
    WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 @ C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\WindowsBase\v4.0_4.0.0.0__31bf3856ad364e35\WindowsBase.dll
    System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @ C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll
    System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @ C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll
    System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @ C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll
    PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 @ C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.dll
    PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 @ C:\WINDOWS\Microsoft.Net\assembly\GAC_64\PresentationCore\v4.0_4.0.0.0__31bf3856ad364e35\PresentationCore.dll
    System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @ C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll
    PaintDotNet.SystemLayer, Version=4.216.7781.39227, Culture=neutral, PublicKeyToken=null @ C:\Program Files\paint.net\PaintDotNet.SystemLayer.dll
    PaintDotNet.Framework, Version=4.216.7781.39227, Culture=neutral, PublicKeyToken=null @ C:\Program Files\paint.net\PaintDotNet.Framework.dll
    PaintDotNet.Resources, Version=4.216.7781.39227, Culture=neutral, PublicKeyToken=null @ C:\Program Files\paint.net\PaintDotNet.Resources.dll
    PaintDotNet.Effects, Version=4.216.7781.39227, Culture=neutral, PublicKeyToken=null @ C:\Program Files\paint.net\PaintDotNet.Effects.dll
    PaintDotNet.Data, Version=4.216.7781.39227, Culture=neutral, PublicKeyToken=null @ C:\Program Files\paint.net\PaintDotNet.Data.dll
    PaintDotNet.SystemLayer.Native.x64, Version=4.216.7781.39227, Culture=neutral, PublicKeyToken=null @ C:\Program Files\paint.net\PaintDotNet.SystemLayer.Native.x64.dll
    System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @ C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll
    System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @ C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll
    System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @ C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xaml\v4.0_4.0.0.0__b77a5c561934e089\System.Xaml.dll
    System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @ C:\Program Files\paint.net\System.Runtime.CompilerServices.Unsafe.dll
    DdsFileTypePlus, Version=1.10.9.0, Culture=neutral, PublicKeyToken=null @ C:\Program Files\paint.net\Bundled\DDSFileTypePlus\DdsFileTypePlus.dll
    AvifFileType, Version=1.1.11.0, Culture=neutral, PublicKeyToken=null @ C:\Program Files\paint.net\Bundled\AvifFileType\AvifFileType.dll
    WebPFileType, Version=1.3.4.0, Culture=neutral, PublicKeyToken=null @ C:\Program Files\paint.net\Bundled\WebPFileType\WebPFileType.dll
    System.Collections.Immutable, Version=1.2.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @ C:\Program Files\paint.net\System.Collections.Immutable.dll
    System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 @ C:\Program Files\paint.net\System.Buffers.dll
    System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 @ C:\Program Files\paint.net\System.Memory.dll
    Edge Shader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null @ D:\Пользователи\Документы\paint.net App Files\Effects\Edge Shader.dll
    K4os.Compression.LZ4, Version=1.1.11.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d @ C:\Program Files\paint.net\K4os.Compression.LZ4.dll

Native modules: 
    C:\Program Files\paint.net\PaintDotNet.exe, version=4.216.7781.39227
    C:\WINDOWS\SYSTEM32\ntdll.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\MSCOREE.DLL, version=10.0.18362.1 (WinBuild.160101.0800)
    C:\WINDOWS\System32\KERNEL32.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\System32\KERNELBASE.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\System32\ADVAPI32.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\System32\msvcrt.dll, version=7.0.18362.1 (WinBuild.160101.0800)
    C:\WINDOWS\System32\sechost.dll, version=10.0.18362.650 (WinBuild.160101.0800)
    C:\WINDOWS\System32\RPCRT4.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscoreei.dll, version=4.8.4180.0 built by: NET48REL1LAST_B
    C:\WINDOWS\System32\SHLWAPI.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\System32\combase.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\System32\ucrtbase.dll, version=10.0.18362.1110 (WinBuild.160101.0800)
    C:\WINDOWS\System32\bcryptPrimitives.dll, version=10.0.18362.1237 (WinBuild.160101.0800)
    C:\WINDOWS\System32\GDI32.dll, version=10.0.18362.1316 (WinBuild.160101.0800)
    C:\WINDOWS\System32\win32u.dll, version=10.0.18362.1474 (WinBuild.160101.0800)
    C:\WINDOWS\System32\gdi32full.dll, version=10.0.18362.1500 (WinBuild.160101.0800)
    C:\WINDOWS\System32\msvcp_win.dll, version=10.0.18362.1110 (WinBuild.160101.0800)
    C:\WINDOWS\System32\USER32.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\System32\IMM32.DLL, version=10.0.18362.387 (WinBuild.160101.0800)
    C:\WINDOWS\System32\kernel.appcore.dll, version=10.0.18362.1171 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\VERSION.dll, version=10.0.18362.1 (WinBuild.160101.0800)
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll, version=4.8.4300.0 built by: NET48REL1LAST_C
    C:\WINDOWS\SYSTEM32\VCRUNTIME140_CLR0400.dll, version=14.10.25028.0 built by: VCTOOLSD15RTM
    C:\WINDOWS\SYSTEM32\ucrtbase_clr0400.dll, version=14.10.25028.0 built by: VCTOOLSD15RTM
    C:\WINDOWS\System32\psapi.dll, version=10.0.18362.1 (WinBuild.160101.0800)
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\mscorlib\ed4777cae83e1fc9087ac3dc82cf23ab\mscorlib.ni.dll, version=4.8.4300.0 built by: NET48REL1LAST_C
    C:\WINDOWS\System32\ole32.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\system32\uxtheme.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\Program Files (x86)\Yandex\Punto Switcher\PSHook64.dll, version=4, 4, 4, 489
    C:\WINDOWS\System32\CRYPTSP.dll, version=10.0.18362.1 (WinBuild.160101.0800)
    C:\WINDOWS\system32\rsaenh.dll, version=10.0.18362.650 (WinBuild.160101.0800)
    C:\WINDOWS\System32\bcrypt.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\CRYPTBASE.dll, version=10.0.18362.1 (WinBuild.160101.0800)
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System\76c2318d9c3680627b8a4a680bb84f48\System.ni.dll, version=4.8.4300.0 built by: NET48REL1LAST_C
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Core\8e03f9afd831af61f8413ed5a6b394cd\System.Core.ni.dll, version=4.8.4320.0 built by: NET48REL1LAST_C
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\WindowsBase\7d71cc384cc5d5c38b57e6118937b4b1\WindowsBase.ni.dll, version=4.8.4320.0 built by: NET48REL1LAST_C
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Drawing\ae4ddca078478b32a190cdf2c48e80f9\System.Drawing.ni.dll, version=4.8.3752.0 built by: NET48REL1
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\PresentationCore\1696a67907e15cf05e5c627014d48d2f\PresentationCore.ni.dll, version=4.8.4320.0 built by: NET48REL1LAST_C
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\Presentatio5ae0f00f#\8b222f01bcfb013b8772a3029f974ff1\PresentationFramework.ni.dll, version=4.8.4320.0
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\PaintDotNet.Base\cb08cf68e96905b8ecf2ca3d2c1ce92f\PaintDotNet.Base.ni.dll, version=4.216.7781.39227
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Windows.Forms\81767a18ed963e3a442c2c73684b4b28\System.Windows.Forms.ni.dll, version=4.8.4270.0 built by: NET48REL1LAST_C
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\PaintDotNet500b2e4f#\6db5e1926ebfbe50ee30d81a582f33f6\PaintDotNet.SystemLayer.ni.dll, version=4.216.7781.39227
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\PaintDotNet.Core\261b9f1a90eded3f1699bf09d95df014\PaintDotNet.Core.ni.dll, version=4.216.7781.39227
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\PaintDotNet26779e70#\28e90ec6b10abc70ba29aefa9eb8cc2d\PaintDotNet.Resources.ni.dll, version=4.216.7781.39227
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\PaintDotNet7afaaa15#\fef8f90a4a38e052c4c87a9b9b5a3914\PaintDotNet.Framework.ni.dll, version=4.216.7781.39227
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\PaintDotNet.Data\c5425fe09e678cbee45cf838c345bb7e\PaintDotNet.Data.ni.dll, version=4.216.7781.39227
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\PaintDotNet.Effects\8473ea4eafd04a0cdaae666bf0cb5511\PaintDotNet.Effects.ni.dll, version=4.216.7781.39227
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\PaintDotNet\93e461fe1820db7d40ee1289f334fe69\PaintDotNet.ni.exe, version=4.216.7781.39227
    C:\WINDOWS\SYSTEM32\dwrite.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\WPF\wpfgfx_v0400.dll, version=4.8.4320.0 built by: NET48REL1LAST_C
    C:\WINDOWS\System32\OLEAUT32.dll, version=10.0.18362.1377 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\MSVCP140_CLR0400.dll, version=14.10.25028.0 built by: VCTOOLSD15RTM
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\WPF\PresentationNative_v0400.dll, version=4.8.4320.0 built by: NET48REL1LAST_C
    C:\WINDOWS\System32\shell32.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\System32\cfgmgr32.dll, version=10.0.18362.387 (WinBuild.160101.0800)
    C:\WINDOWS\System32\shcore.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\System32\windows.storage.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\System32\profapi.dll, version=10.0.18362.1411 (WinBuild.160101.0800)
    C:\WINDOWS\System32\powrprof.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\System32\UMPDC.dll, version=
    C:\Program Files\paint.net\Native\X64\vcruntime140.dll, version=14.28.29913.0 built by: vcwrkspc
    C:\Program Files\paint.net\Native\X64\vcruntime140_1.dll, version=14.28.29913.0 built by: vcwrkspc
    C:\Program Files\paint.net\Native\X64\msvcp140.dll, version=14.28.29913.0 built by: vcwrkspc
    C:\Program Files\paint.net\Native\X64\msvcp140_1.dll, version=14.28.29913.0 built by: vcwrkspc
    C:\Program Files\paint.net\Native\X64\msvcp140_2.dll, version=14.28.29913.0 built by: vcwrkspc
    C:\Program Files\paint.net\Native\X64\msvcp140_codecvt_ids.dll, version=14.28.29913.0 built by: vcwrkspc
    C:\Program Files\paint.net\Native\X64\vcomp140.dll, version=14.28.29913.0 built by: vcwrkspc
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\PaintDotNetc8826574#\fee667e82693247c731aab8933faba35\PaintDotNet.SystemLayer.Native.x64.ni.dll, version=4.216.7781.39227
    C:\Program Files\paint.net\PaintDotNet.SystemLayer.Native.x64.dll, version=4.216.7781.39227
    C:\WINDOWS\SYSTEM32\PROPSYS.dll, version=7.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.18362.1500_none_cf64b1533ef4a32a\gdiplus.dll, version=10.0.18362.1500 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\WindowsCodecs.dll, version=10.0.18362.1500 (WinBuild.160101.0800)
    C:\WINDOWS\System32\clbcatq.dll, version=2001.12.10941.16384 (WinBuild.160101.0800)
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Configuration\0230074871fa66a53c18cf61aa79cb38\System.Configuration.ni.dll, version=4.8.4190.0 built by: NET48REL1LAST_B
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Xml\dc6e982e28f321870f322f1b3af2d83e\System.Xml.ni.dll, version=4.8.3752.0 built by: NET48REL1
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Xaml\9cc89c6247c50d6cb0b808f64715e3fa\System.Xaml.ni.dll, version=4.8.4320.0 built by: NET48REL1LAST_C
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clrjit.dll, version=4.8.4300.0 built by: NET48REL1LAST_C
    C:\WINDOWS\System32\MSCTF.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Runtea61dfd5#\be3e121258d7e87a2074ef5bdac61ac8\System.Runtime.CompilerServices.Unsafe.ni.dll, version=4.700.20.12001
    C:\WINDOWS\SYSTEM32\dxgi.dll, version=10.0.18362.1500 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\dxcore.dll, version=10.0.18362.1316 (WinBuild.160101.0800)
    C:\WINDOWS\System32\UIAnimation.dll, version=10.0.18362.1316 (WinBuild.160101.0800)
    C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.18362.1500_none_9e79be6de462295c\comctl32.dll, version=6.10 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\d2d1.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\d3d11.dll, version=10.0.18362.1411 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\D3D10Warp.dll, version=10.0.18362.1049 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\wtsapi32.dll, version=10.0.18362.1 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\WINSTA.dll, version=10.0.18362.836 (WinBuild.160101.0800)
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Coll4a4f96a7#\d64bb1122df50bbf0f9a2077e599450f\System.Collections.Immutable.ni.dll, version=4.700.20.21406
    C:\WINDOWS\SYSTEM32\dwmapi.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\system32\dataexchange.dll, version=10.0.18362.1316 (WinBuild.160101.0800)
    C:\WINDOWS\system32\dcomp.dll, version=10.0.18362.1474 (WinBuild.160101.0800)
    C:\WINDOWS\system32\twinapi.appcore.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\system32\RMCLIENT.dll, version=10.0.18362.1316 (WinBuild.160101.0800)
    C:\WINDOWS\System32\TextInputFramework.dll, version=10.0.18362.1474 (WinBuild.160101.0800)
    C:\WINDOWS\System32\CoreUIComponents.dll, version=10.0.18362.1110
    C:\WINDOWS\System32\CoreMessaging.dll, version=10.0.18362.1316
    C:\WINDOWS\SYSTEM32\ntmarta.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\wintypes.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\System32\iertutil.dll, version=11.00.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Buffers\d861d77f413fed84924c0db1977ced0f\System.Buffers.ni.dll, version=4.6.28619.01
    C:\WINDOWS\SYSTEM32\winmm.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\winmmbase.dll, version=10.0.18362.1 (WinBuild.160101.0800)
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Memory\670dfa35da8a8b525ddbcd3cedebf88f\System.Memory.ni.dll, version=4.6.28619.01
    C:\WINDOWS\system32\explorerframe.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\K4os.Compression.LZ4\cabce0df47b736a12c5b18f43e9209cb\K4os.Compression.LZ4.ni.dll, version=1.1.11
    C:\WINDOWS\SYSTEM32\XmlLite.dll, version=10.0.18362.295 (WinBuild.160101.0800)
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\diasymreader.dll, version=14.8.3752.0 built by: NET48REL1
    C:\WINDOWS\System32\SetupApi.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\DEVOBJ.dll, version=10.0.18362.387 (WinBuild.160101.0800)
    C:\WINDOWS\System32\WINTRUST.dll, version=10.0.18362.1377 (WinBuild.160101.0800)
    C:\WINDOWS\System32\MSASN1.dll, version=10.0.18362.1 (WinBuild.160101.0800)
    C:\WINDOWS\System32\CRYPT32.dll, version=10.0.18362.1550 (WinBuild.160101.0800)
------------------------------------------------------------------------------

 

Thanks @MJW and @Red ochre for this useful effect. It will also be useful for those who adapt Photoshop tutorials to paint.net.

Link to comment
Share on other sites

Running it on a layer without transparency crashes Pdn. My crash log shows the same error as @Remake reported.

 

I was also hoping you would include the other edge detection methods as in my slow EdgeShader5 prototype. This would make the effect very useful for textures too.
(The tone-gradient magnitude detection method is quick and doesn't require calling G'blur). The opacity threshold could simply be an edge threshold in that mode.
Object edges/alpha should remain the default though.

 

Don't worry too much about using the anti-aliasing to alter the shading, some ideas are more trouble than they are worth!
... your Height map smoothing plugin is great for correcting that already.

 

A few more colour choices in the drop-down could be useful for users too. Basic primary colours perhaps or I'd be happy to share the faux metallic option methods I used in my Tone Gradient Angle effect - I think they could be adapted.

 

P.M. me if you want the source for those methods... if I can find them!

Thanks for all the work you've put into this one.

 

Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings

 

PdnForumSig2.jpg

Link to comment
Share on other sites

10 hours ago, ReMake said:

This crash log is obtained when running the effect with the checked 'Use Edge Opacity in Determining Distance' on an image that does not have transparency areas. 

 

I'll try to get that fixed soon.

 

EDIT:  I found and fixed that particular problem, but also discovered a similar problem that occurs with single-pixel objects and similar. I'll need to figure out what's going on there and fix it.

  • Upvote 1
Link to comment
Share on other sites

1 hour ago, Red ochre said:

I was also hoping you would include the other edge detection methods as in my slow EdgeShader5 prototype. This would make the effect very useful for textures too.

 

You'll need to refresh my memory on that.

 

1 hour ago, Red ochre said:

Don't worry too much about using the anti-aliasing to alter the shading, some ideas are more trouble than they are worth!

 

It's something I really wanted to add in an effective way. I haven't given up, though I'm beginning to wonder if it's possible.

 

1 hour ago, Red ochre said:

A few more colour choices in the drop-down could be useful for users too. Basic primary colours perhaps or I'd be happy to share the faux metallic option methods I used in my Tone Gradient Angle effect - I think they could be adapted.

 

Adding other fixed colors would be easy. I'm not sure about the faux-metallic options.

Link to comment
Share on other sites

13 hours ago, MJW said:

@Red ochre requested the ability to get smoother edge shading, without the jaggedness that sometimes occurs, by using the transparency of antialiased object edge pixels to adjust the distances.

 

There is another way to do this, but it's pretty slow. You would have to loop using threshold value, then normalize. However, I found that it leads to dark image if using a image with large number of transparent pixels rather than just the edge.

 

EDIT: You can index colors to specified numbers of colors and then loop per threshold images with distance finder, and then you'll get what you want. I did posted a picture in my profile to demonstrate proof of concept. It is quite ok in performance.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

Loving the new EdgeShader @MJW  🥰  The additional options really up the value of this plugin.

Off-setting would still be nice, but I'm a happy camper for now.  😁  Nice job on the update!

 

edgeshader_new_01.png

 

Link to comment
Share on other sites

1. ColourEdges:
Here's the code for EdgeShader5. It uses my old slow method for the distance but the method for finding colour edges could be adapted.

 

First apply the AlphaEdges method then the ColourEdges method to the src surface and store whether a pixel is an edge or not in a bool array [w,h], then apply the fast distance algorithm to the array. Note: I don't think the 'dest' surface is required for these methods. Probably best to add a seperate colour threshold slider too.

 

Alternatively, if you are directly using the alpha values of the src surface. The tone gradient Magnitude Method could be used to find edges if restricted to a 0 to 255 range.
That method is very much like that for TG Angle and is also in the zipped folder.


2. Metallic colours:
Also the code for ToneGradientAngle.
The faux metallic options are combination of preset colours and blend modes in the GetShading Method. They seemed popular. I used a 'TwoPixels' struct for these but easy enough to change that. I don't foresee any problems adding them - but you never know!

 

I've attached the zipped.cs code for these three. Forgive my eccentric coding style, Good luck!

 

 

Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings

 

PdnForumSig2.jpg

Link to comment
Share on other sites

I'm releasing version 1.0.1, which fixes the bug discovered by @ReMake.

 

It was a pretty simple bug that required a surprising number of code changes to fix.  Because it required a fair amount of modification, I'm a bit nervous. However I'm reasonably confident the bug was fixed without introducing any new ones.

  • Like 1
  • Upvote 2
Link to comment
Share on other sites

8 hours ago, Red ochre said:

Here's the code for EdgeShader5. It uses my old slow method for the distance but the method for finding colour edges could be adapted.

 

If I did something along the lines of using the color edges, I think I'd want it to be a separate plugin that only used color info.  I prefer something that's in the Object submenu, and called Edge Shader, to only deal with the edges of objects.

Link to comment
Share on other sites

9 hours ago, lynxster4 said:

Off-setting would still be nice, but I'm a happy camper for now. 

 

I still hope to try implementing that soon. (Though my "soon" sometimes isn't so soon, I'm afraid to say.)

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...