Red ochre Posted September 30, 2014 Share Posted September 30, 2014 I have written a plugin to be called 'Facet'. I have run into 3 problems - one of which I have solved! I do not think the first two are solvable, but would like to be proved wrong. Feel free to criticize the coding too - (not too harsh!) Here is a link to the VS2010 project file and a .dll (fully stable - just not perfect - try it on an object - works well on faces!) http://i.imgur.com/hVuGZ7P.png VS2010 project file = https://www.dropbox.com/s/z9fcnmpvnicsfwh/FacetVSproject.zip?dl=0 .dll = https://www.dropbox.com/s/kvqk3mqp1sgi8t7/Facet.zip?dl=0 Problems: --------------------------------------------------------- 1. Gaps between antialiased filled paths. http://i.imgur.com/qnlRfko.png I have tried filling the whole figure first with minimal success but this also ruins the antialiasing on the edges of the figure. (try last checkbox). I can't cover the join with a line (as I did on Dryad) since I am using linear gradient brushes. Increasing the size of the path either results in skewing the figure or means huge amounts trigonometry. The problem is most easily seen with a small number of cells with a contrasting layer below. Any ideas? (I think the antialiasing is applied to wrong side of the bounding line - it should be adding AA'd pixels to the outside of the path in my opinion.) --------------------------------------------------------- 2. Randoms not changing quickly enough resulting in patterns around the 'Nadir'. http://i.imgur.com/L7xM6Mn.png I have tried delay loops between calling the randoms, 'Thread.Sleep', even storing the randoms in an array in a different order from which I am using them. Nothing works. It is most obvious with the controls on default settings except for size randomness, which produces concentric 'waves' around the nadir. See pic. Since it is less obvious when position randomness is increased, I am less worried about this. --------------------------------------------------------- 3. Solved - but thought it may help others. I was getting an 'out of memory error' and thought it was a problem with my disposing of graphics objects - it wasn't! The PointFs for a linear gradient brush must be atleast 1 pixel apart. Not being equal is not enough. psuedo: if(here == there){don't use a LGBrush;}//doesn't work if((Math.Abs(here.X - there.X) > 1||(Math.Abs(here.Y - there.Y) > 1)){you can use LGBrush;}//does work -------------------------------------------------------- I will probably publish this soon (with the faults), unless anyone can see a soloution, particularly for problem 1. Also please report any crashes (now problem 3 is solved it has been very stable for me). Many thanks 2 Quote Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings Link to comment Share on other sites More sharing options...
TechnoRobbo Posted October 1, 2014 Share Posted October 1, 2014 Red, I'd like to say, brilliant!!!! I'll have to dissect the code a bit and get back to you, but first I wanted to tell you how awesome this looks. 1 Quote Go out there and be amazing. Have Fun, TRSome Pretty Pictures Some Cool Plugins Link to comment Share on other sites More sharing options...
TechnoRobbo Posted October 1, 2014 Share Posted October 1, 2014 Red Try following every graf.FillPath(YourGradientBrush, YourPath); with a graf.DrawPath(new Pen(YourGradientBrush), YourPath); you may not need to backfill anymore 1 Quote Go out there and be amazing. Have Fun, TRSome Pretty Pictures Some Cool Plugins Link to comment Share on other sites More sharing options...
Red ochre Posted October 1, 2014 Author Share Posted October 1, 2014 Perfect! - problem 1 solved. Thank you so much - this really improves the effect and will be a useful technique for other plugins too.You are a genius and a gentleman! - I was tying myself in knots trying to solve that one. I will tidy up the code a bit and publish very soon. Quote Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings Link to comment Share on other sites More sharing options...
TechnoRobbo Posted October 1, 2014 Share Posted October 1, 2014 Glad I could help, That concentric pattern sure doesn't appear to be the result of the random object, looks like the seed keeps getting injected into the loop. I'll look at that random thing when I get home. Quote Go out there and be amazing. Have Fun, TRSome Pretty Pictures Some Cool Plugins Link to comment Share on other sites More sharing options...
TechnoRobbo Posted October 1, 2014 Share Posted October 1, 2014 I haven't tested this yet 'cause I'm not home but what if you changed float Randsize = (float)(myrandoms[c, 2]) / 500;//between 0 and 2 roughly float Randapexh = (float)(myrandoms[c, 3]) / 500; to float Randsize = (float)(myrandoms[c, 2]) / 500f; float Randapexh = (float)(myrandoms[c, 3]) / 500f; read below Quote Go out there and be amazing. Have Fun, TRSome Pretty Pictures Some Cool Plugins Link to comment Share on other sites More sharing options...
TechnoRobbo Posted October 1, 2014 Share Posted October 1, 2014 I think I found it I believe since this variable is not a local variable it's not initialized null but as a default private static Random RandomNumber; so this never executes if (RandomNumber == null) { RandomNumber = new Random((instanceSeed) ^ (randomSeed << 16) ^ (rect.X << 8) ^ rect.Y); } Post Edit http://msdn.microsoft.com/en-us/library/aa691171(v=vs.71).aspx Quote Go out there and be amazing. Have Fun, TRSome Pretty Pictures Some Cool Plugins Link to comment Share on other sites More sharing options...
Red ochre Posted October 1, 2014 Author Share Posted October 1, 2014 I tried simply removing the "if(RandomNumber == null)" condition - just leaving"RandomNumber = new Random((instanceSeed) ^ (randomSeed << 16) ^ (rect.X << 8) ^ rect.Y);"Unfortunately this still shows the patterns around the nadir. The RandomNumber seems to be same for all 'cells' with the same distance value?I also tried moving "RandomNumber = new Random((etc" to inside the loop that loads the array. The circular pattern is still there? Even tried altering the algorithm to include the loop counter,'r', so different for each loop. Still no joy.I can only think that the C# I write and the JIT code that gets compiled, execute in a different order perhaps?Way out of my depth again!Don't worry about this TR - I will publish with the non-random randoms. They're good for making circular mountain scapes! And many thanks again for solving problem 1 - that makes a huge difference. Quote Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings Link to comment Share on other sites More sharing options...
TechnoRobbo Posted October 1, 2014 Share Posted October 1, 2014 Ignore this post Quote Go out there and be amazing. Have Fun, TRSome Pretty Pictures Some Cool Plugins Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted October 2, 2014 Share Posted October 2, 2014 What post? Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
TechnoRobbo Posted October 2, 2014 Share Posted October 2, 2014 The one I erased. We took it offline and figured it out. Quote Go out there and be amazing. Have Fun, TRSome Pretty Pictures Some Cool Plugins Link to comment Share on other sites More sharing options...
Red ochre Posted October 2, 2014 Author Share Posted October 2, 2014 What post? Reminds me of the sign "This is not here" at the beginning of the Imagine video. Yes - TR was very helpful and together we spotted the flaw in my code. I was mixing a random number with a calculated one and instead of creating a new variable for the result it was feeding the altered calculated value back into the algorithm in the next loop. Resulting in radial patterns around the Nadir. So Problem 2 now also solved! I've got to tidy up the code and hopefully publish soon (real life rather busy at the moment). Thanks again TR - really useful having someone experienced to bounce ideas off. Quote Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings Link to comment Share on other sites More sharing options...
TechnoRobbo Posted October 2, 2014 Share Posted October 2, 2014 Thanks again TR - really useful having someone experienced to bounce ideas off. After all the great suggestions you've made for my plugins, I owed you. Quote Go out there and be amazing. Have Fun, TRSome Pretty Pictures Some Cool Plugins Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.