Jump to content

Robot Graffiti

Members
  • Posts

    17
  • Joined

  • Last visited

  • Days Won

    6

Robot Graffiti last won the day on March 12 2023

Robot Graffiti had the most liked content!

Recent Profile Visitors

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

Robot Graffiti's Achievements

Apprentice

Apprentice (3/14)

  • Collaborator
  • One Month Later
  • Addicted Rare
  • Week One Done
  • Reacting Well Rare

Recent Badges

42

Reputation

  1. I made a new version. Updates: Version 2.0 will not work with Paint.NET 4. You need Paint.NET 5.0 or later. GPU rendering is enabled now thanks to all the new stuff in Paint.NET 5. Brushstroke shapes are more varied now (they're rough little SVGs I drew; the previous version just used lines with novelty endcaps). I totally re-arranged the menu. Slightly better handling of transparency (but still not perfect). It now does some of the calculations with premultiplied alpha and linear colour space, for better colour accuracy (though to be honest it doesn't make a big difference in this case since the whole point of the plugin is to make photos look less realistic). There are various other minor tweaks and optimisations.
  2. Thanks, I think I got it. sRGB to linear conversion isn't automatic, I have to do that myself. Straight alpha is automatically converted to premultiplied by default for both SourceImage and solid colour brush (but the alpha mode is configurable for SourceImage). SrgbToLinearEffect can be used on an input that is already premultiplied (its alpha mode is configurable). I have to be careful to give shaders inputs in the colour space they're written and/or configured to expect (some of them are configurable). I had a shader which I had written on the assumption that shaders were using straight alpha - but I now know they aren't (and in some cases, shouldn't) - so I have to either change the shader or use UnPremultiplyEffect and PremultiplyEffect around it.
  3. // Summary: // Gets the source image to use with Direct2D. // // Remarks: // You should only retrieve this image if it will actually be used for rendering, // as it will consume GPU memory once initialized. // This is equivalent to: // this.Environment.Document.Layers[this.Environment.SourceLayerIndex].Image Should I be concerned about this? If I want to pass the current layer into a shader, is this the right way to get it, or is there some other, better way? SrgbToLinearEffect background = new(dc); background.Properties.Input.Set(Environment.SourceImage);
  4. Paint.NET layers use sRGB colour with straight alpha. Because sRGB colour looks good to human eyes and is normal for saving images. Colour calculations (like lerping, blending, compositing, measuring colour space distance) are often more accurate in linear colour with premultiplied alpha. So we want to take the image, convert it to linear colour, then convert it to premultiplied alpha, then do our calculations, effects, blending, etc. And then convert it back in the reverse order to get the final image. I have some questions though: When we pass Environment.SourceImage into a shader or make a CommandList, do they get converted automatically? Or do we have to do that ourselves? Should I convert colours to linear colour or premultiplied alpha before I assign them to the brush that I use to paint in the CommandList?
  5. I'm working through your notes. Use ColorBgra32 instead of ColorBgra: easy, done. Updating the shader graph instead of rebuilding it when possible: done. The performance gain is tiny on my machine (I have an OK CPU and a very very old GPU so for me 95% of the time is spend rendering 15000 little brushstrokes) but it should help for people with weak CPUs and current GPUs.
  6. Thanks Rick. Good notes. I didn't know about the IntermediateTooLargeException - I haven't tested it on any images larger than about 4000x4000 pixels. The results of DrawBlurredBackground are 99% covered up by the brushstrokes on the default settings. The background doesn't have to look good at all, it just has to be less detailed than the brushstrokes and each part has to be a colour that doesn't look very out of place in that vague area. So, I was trying to go for speed over quality there.
  7. BoldBrush.zip I'm porting my Bold Brushstrokes plugin to be a PropertyBasedGpuImageEffect. The new version draws the brushstrokes into a Direct2D CommandList and then uses a graph of IDeviceEffect shaders to copy the alpha channel from the original image and do the impasto effect. In this version the strokes are SVGs of various crappy blob shapes I drew in Inkscape; in the previous version they were just straight lines with different endcaps. This is all basically working but I'm not finished. The new impasto effect I added to it isn't quite right, and I'm thinking of maybe splitting that off into a separate effect. The hardest part so far was trying to trim ComputeSharp to make my plugin file smaller. In the end I ended up trimming ComputeSharp.Core and leaving ComputeSharp.D2D1 untrimmed. Trimming ComputeSharp.D2D1 with ILlink.dll kept stripping off the IDisposable interface from a type and then the plugin would crash when ComputeSharp used that type in a using block. Eh, not important, the plugin is small enough now I guess. Do let me know if you have suggestions.
  8. I'm porting my Bold Brushstrokes plugin to be a PropertyBasedGpuImageEffect. The new version draws the brushstrokes into a Direct2D CommandList and then uses a graph of IDeviceEffect shaders to copy the alpha channel from the original image and do some other effects.
  9. I'm using ILRepack to merge some ComputeSharp dlls into my plugin DLL and that's working for me (thanks @BoltBait I saw how to use ILRepack in the CodeLab source on GitHub). But I'm stuck on trimming. The trim option in VS only wants to work for a native exe, not for a portable DLL. Do you guys have a suggestion for a tool or method to trim my plugin DLL's dependencies?
  10. I made a new version. I added a middle antialiasing option, that antialiases slopes and curves only, as a compromise between having blurry but accurate letter shapes or crisp but jagged lines. It works by snapping the vertices of the letter geometry to the nearest pixel before rendering the text. I fixed some problems with rendering outlined text, by completely changing how the outlines are rendered. It's slower but it looks way better in some funny edge cases, like when the selected colour is partly transparent or when a hole in a letter is smaller than the thickness of the outline. I also added an option to choose the thickness of the text outline. I also updated the little effect icon. It's supposed to say "wall of text" now in tiny tiny letters...
  11. This plugin fits text into a rectangle to make a solid block of words. The effect can vary from a bold modernist manifesto to a dense wall of crazy scribble. It automatically adjusts the size of each line to fit into the selection bounds or the page. You can choose where the line breaks are, or you can let the plugin decide with Word Wrap (its choice is psuedorandom, deterministic, and uses a heuristic that tries to not distort the text's aspect ratio too much). Word Wrap mode still respects your line breaks, and also converts _ characters to non-breaking spaces, in case you want some phrases laid out in a particular way but don't care about the rest. Menu: Effects-> Text Formations Plugin file: WallOfText.zip Versions: -1.1 Improved antialiasing. Fixed rendering of partly transparent text with outlines. Outline width is now controllable. -1.0 Initial Release
  12. I have uploaded version 1.1. Made extra sure to dispose of GDI+ objects as suggested by Red ochre, and compiled with the single threading option in CodeLab as suggested by null54. I hope this will make this version less crashy. I guess the intermittent error was probably GDI+ complaining about multiple threads accessing the same image. Replaced "effect strength" option, which tended to produce ugly results, with "preserve fine details" option that selectively makes the effect more transparent in high contrast areas only. Replaced radio buttons with dropdowns to make the control panel a slightly less intimidating size, per ReMake's suggestion.
  13. You're right Red, it does seem to get an out of memory exception sometimes that can crash Paint.NET. Not all the time but occasionally. I'll fix it if I can find the cause.
  14. Thanks mate. I'll keep that in mind if I make another version later.
×
×
  • Create New...