Jump to content

_koh_

Members
  • Posts

    112
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

_koh_'s Achievements

Enthusiast

Enthusiast (6/14)

  • Conversation Starter
  • One Year In
  • Collaborator
  • One Month Later
  • First Post

Recent Badges

17

Reputation

  1. Enabled HDR mode and tested this. When I do Alt+Tab, canvas occasionally disappears like 1 frame but not that jarring. Not sure I gonna use ACM though. Sounds like a good thing for images / videos, but I'm too familiar with UI / texts having P3 color at this point.
  2. I see. Thanks. Thought maybe I could treat ExifColorSpace.AdobeRgb profile separately, but once assigned to the image, it already has different bytes so I gave up😅 edit: Ah, since I learned how to convert RGB to XYZ, I can extract RGB primaries from ColorContext. A bit hacky but can test any profile.
  3. Ah maybe. But if (ColorContext == DisplayP3) is more difficult part I guess. PDN already doing this for sRGB, right? If there is a simple way to do this, I can also treat Adobe RGB separately. As I reported, D2D CME's handling of Adobe RGB is a bit iffy.
  4. My bad. Seems like this is PDN 5.0 to 5.1 difference. When I ported my plugins to 5.1, I found sRGB <-> Linear is more accurate. I thought this has to do with DeviceColorSpace.ScRgb to LinearizedColorContext but... Yeah, this is the reason. Now it's doing actual math instead of table lookup. Same reason I was using my own shader for sRGB <-> Linear in 5.0. Can you also give DP3 a special treat? Which is using the same TRC as sRGB.
  5. Thanks. I'll look into that. One thing I know is sRGB -> DeviceColorSpace.ScRgb -> sRGB sRGB -> LinearizedColorContext -> sRGB give me slightly different results and later is more accurate than former.
  6. Oh, I didn't know that. I've been thinking when I do sRGB <-> Display P3 etc. changing rendering intent should change the outcome. But yeah, this is the first time I actually tried to tweak the intent. So I tested Display P3 -> scRGB -> luminous = dot(RGB, new(0.212639, 0.715169, 0.072192)) Display P3 -> Linear -> luminous = dot(RGB, new(0.228975, 0.691739, 0.079287)) and those two give me the same result with handful of rounding errors. Which makes color management compatible luminous effect simple as this. Thanks! edit: CME just outputs untouched non 0-1 range values when I do P3 -> scRGB, so going through scRGB is more useful than I thought. I was assuming CME only outputs 0-1 range and I need to pick a normalize method like scale (perceptual), clamp (absolute)... but this wasn't the case. protected override void OnInitializeRenderInfo(IGpuImageEffectRenderInfo renderInfo) { renderInfo.ColorContext = GpuEffectColorContext.ScRgb; base.OnInitializeRenderInfo(renderInfo); } protected override IDeviceImage OnCreateOutput(PaintDotNet.Direct2D1.IDeviceContext DC) { var gray = (float R, float G, float B) => new Matrix5x4Float(R,R,R,0, G,G,G,0, B,B,B,0, 0,0,0,1, 0,0,0,0); return new ColorMatrixEffect(DC, Environment.SourceImage, gray(0.2126f, 0.7152f, 0.0722f)); }
  7. Ah thanks for this. I just have a rough image like perceptual intent fits one cube to another. My initial thought was if I create a D65 XYZ profile and use it as the destination, ColorMatrixEffect will do RGB -> D50 XYZ -> D65 XYZ, but I need to use absolute intent to get the actual XYZ values.
  8. Now I realized I can do some RGB -> scRGB (perceptual), then scRGB -> XYZ with ColorMatrix. Not sure this is same as some RGB -> XYZ (absolute) though. I remember at least those two worked at one point.
  9. I don't understand why ColorManagementEffect takes 2 intent parameters either. It goes against my understanding. Feels like absolute intent is just clamp(invert(dstMatrix) * srcMatrix * RGB), but I might be wrong. What I'm trying to do here is create a XYZ D65 image and use its Y as the luminance. If I have RGB -> XYZ D50 matrix in the ICC profile or XYZ D50 PCS image, I only need ColorMatrixEffect to do that, but I have neither so I need to use SimpleColorProfile + ColorManagementEffect instead.
  10. My final code will be something like this and the "rotate" one being the 3rd case. And if AbsoluteColorimetric is respected throughout the process, then yeah, I think it will be fine. I'm just using ColorManagementEffect as ColorMatrixEffect without knowing the matrix in the ICC profile, so I need to bypass the rendering intent in this case. BTW while I'm not gonna use those, DxgiColorSpace having the same problem. protected override IDeviceImage OnCreateOutput(PaintDotNet.Direct2D1.IDeviceContext DC) { var abs = ColorManagementRenderingIntent.AbsoluteColorimetric; using var enc = Environment.Document.ColorContext.CreateRef(); using var dec = DC.CreateLinearizedColorContextOrScRgb(enc); using var xyz = DC.CreateColorContext(new SimpleColorProfile(new(1,0), new(0,1), new(0,0), new(0.95045f, 1.08905f), SimpleColorProfileGamma.G10)); using var source = Environment.SourceImage.CreateRef(); using var decode = new ColorManagementEffect(DC, source, enc, abs, dec, abs); using var rotate = new ColorManagementEffect(DC, decode, dec, abs, xyz, abs); using var lumino = new PixelSwizzleEffect(DC, rotate, PixelSwizzle.GGGA); using var encode = new ColorManagementEffect(DC, lumino, dec, abs, enc, abs); return encode.CreateRef(); }
  11. Looks like SimpleColorProfile having problem. This grayscale script works in 5.0 but not in 5.1. System.Runtime.InteropServices.COMException (0x800707DC): IsColorProfileValid (2012, ERROR_TAG_NOT_FOUND) edit: DC.CreateEffect(DeviceEffectIDs.ColorManagement) works so likely somewhere in the wrapper. protected override void OnInitializeRenderInfo(IGpuImageEffectRenderInfo renderInfo) { renderInfo.ColorContext = GpuEffectColorContext.WorkingSpace; base.OnInitializeRenderInfo(renderInfo); } protected override IDeviceImage OnCreateOutput(IDeviceContext DC) { var enc = DC.CreateColorContext(DeviceColorSpace.Srgb); var xyz = DC.CreateColorContext(new SimpleColorProfile(new(1,0), new(0,1), new(0,0), new(1,1), SimpleColorProfileGamma.G10)); var source = Environment.SourceImage; var xyzimg = new ColorManagementEffect(DC, source, enc, xyz); var lumimg = new ColorMatrixEffect(DC, xyzimg, new(0,0,0,0, 1,1,1,0, 0,0,0,0, 0,0,0,1, 0,0,0,0)); var rgbimg = new ColorManagementEffect(DC, lumimg, xyz, enc); return rgbimg; }
  12. Additionally, your laptop can choose AMD / NVIDIA GPU for the UI rendering, so enable hardware acceleration and switch UI rendering to NVIDIA could be a better workaround. You can change this through the Windows settings. PDN 5.1 removed open Windows settings button but I think it's better to have it.
  13. Not sure you are happy with this result, but this CodeLab script makes the pixel more transparent when pixel color is more closer to the primary color. #region UICode DoubleSliderControl threshold = 0.32; // [0,1] Threshold #endregion protected override void OnInitializeRenderInfo(IGpuImageEffectRenderInfo renderInfo) { renderInfo.ColorContext = GpuEffectColorContext.WorkingSpace; base.OnInitializeRenderInfo(renderInfo); } protected override IDeviceImage OnCreateOutput(IDeviceContext DC) { using var source = Environment.SourceImage.CreateRef(); using var color = new FloodEffect2(DC, (ColorRgba128Float)Environment.PrimaryColor); using var vector = new HlslBinaryOperatorEffect(DC, source, HlslBinaryOperator.Subtract, color); using var length = new HlslUnaryFunctionEffect(DC, HlslUnaryFunction.Length, vector); using var alpha = new HlslBinaryOperatorEffect(DC, length, HlslBinaryOperator.Multiply, new Vector4Float((float)(1 / threshold))); using var clamp = new HlslUnaryFunctionEffect(DC, HlslUnaryFunction.Saturate, alpha); using var output = new HlslBinaryOperatorEffect(DC, source, HlslBinaryOperator.Multiply, clamp); return output.CreateRef(); }
  14. Another choice is just keep <TargetFramework>net7.0-windows</TargetFramework> in your csproj, then .NET 8 SDK builds .NET 7 dll and both PDN 5.0 and 5.1 can load it. Once you bump this to net8.0-windows, only PDN 5.1 and later can load it.
  15. Oh, so there is a command to force GC. Keys.Oemtilde = keycode 192 which is "@" on my keyboard, and if I do Ctrl+Alt+Shift+@, the image flickers and I can open more than 60 images. edit: Shift+@ is backquote on my keyboard too. It's 0%.
×
×
  • Create New...