Jump to content

toe_head2001

Administrator
  • Posts

    5,008
  • Joined

  • Last visited

  • Days Won

    151

Everything posted by toe_head2001

  1. Version 1.1 posted. The Line Thicknesses can now go up to 100. Sorry Eli, I had this new version ready two weeks ago when you asked me about the line thickness. I simply forgot to post it.
  2. This morning I spent some more time on this. I was able to recreate some of the needed HLSL functions (frac, saturate, ect.) in C# based on info from MSDN, but there are places in the code I have no idea what the outcome of the line of code should be. I simply don't know enough about HLSL to continue. I've heard HLSL can be used directly in .Net via WPF, but I'm not too familiar with that either. Here's my work-in-progress of that file(about half). I can't be sure if my changes are correct. Hidden Content: using System; namespace MapMask { internal struct Float3 { public float R; public float G; public float B; public Float3(float first, float second, float third) { R = first; G = second; B = third; } } public class Class1 { float frac(float n) { float number = n - (float)Math.Truncate(n); return number; } float saturate(float n) { float number; if (n < 0) number = 0; else if (n > 1) number = 1; else number = n; return number; } float lerp(float x, float y, float s) { float number = x + s * (y - x); return number; } // =================================================================================== // HUEING // =================================================================================== //Utility Functions Float3 ExpandHSL(Float3 HSL) { //float3 outputVal = inVal * (maxVal - minVal) + minVal; Float3 expanded = HSL; expanded.R = (HSL.R * (.706f - .3137f)) + .3137f; //reexpand hue expanded.R -= .41176f; //offset hue expanded.G = (HSL.G * .5882f); expanded.B = (HSL.B * .70588f); return expanded; } Float3 AdjustLightness(Float3 HSL, float brightness, float contrast) //Adjust the lightness of the HSL { HSL.B = (float)(Math.Pow(HSL.B, contrast) * contrast); HSL.B = brightness + ((1 - brightness) * HSL.; return HSL; } float OffsetHue(float hue, float hueOffset) { float H = frac(hue + hueOffset); return H; } float OffsetSaturation(float saturation, float satOffset) { float S = saturation; S = (float)Math.Pow(S, satOffset); S = S * (1 - satOffset); S = saturate(S); return S; } Float3 OffsetHSL(Float3 HSL, float hueOffset, float satOffset) { float H = OffsetHue(HSL.X, hueOffset); float S = OffsetSaturation(HSL.Y, satOffset); return new Float3(H, S, HSL.Z); } Float3 ConvertHSLToRGB(Float3 HSL) { const float fOneThird = 0.333333333f; const float fTwoThirds = 0.666666666f; Float3 color; float temp1, temp2; float H = HSL.R; float S = HSL.G; float L = HSL.B; //if (S == 0) // return float3(L, L, L); float LtimesS = L * S; if (L < 0.5f) temp2 = L + LtimesS; else temp2 = L + S - LtimesS; temp1 = 2.0f * L - temp2; Float3 temp3 = frac(new Float3(H + fOneThird, H, H - fOneThird)); Float3 temp3Times6 = 6.0f * temp3; Float3 temp3Times2 = 2.0f * temp3; Float3 temp3Times1point5 = 1.5f * temp3; Float3 firstEquation = temp1 + (temp2 - temp1) * 6.0f * temp3; Float3 secondEquation = temp1 + (temp2 - temp1) * (fTwoThirds - temp3) * 6.0f; if (temp3Times6.R < 1.0f) color.R = firstEquation.R; else if (temp3Times2.R < 1.0f) color.R = temp2; else if (temp3Times1point5.R < 1.0f) color.R = secondEquation.R; else color.R = temp1; if (temp3Times6.G < 1.0f) color.G = firstEquation.G; else if (temp3Times2.G < 1.0f) color.G = temp2; else if (temp3Times1point5.G < 1.0f) color.G = secondEquation.G; else color.G = temp1; if (temp3Times6.B < 1.0f) color.B = firstEquation.B; else if (temp3Times2.B < 1.0f) color.B = temp2; else if (temp3Times1point5.B < 1.0f) color.B = secondEquation.B; else color.B = temp1; return color; } Float3 ManipulateHSL(in Float3 HSL, float4 palette) { HSL = ExpandHSL(HSL); HSL = AdjustLightness(HSL, palette.z, palette.w); HSL = OffsetHSL(HSL.rgb, palette.x, palette.y); return HSL; } float ManipulateAO(in float ao, float brightness, float contrast) { brightness += 1; //brightness + ((1 - brightness) * HSL.; float ret = ao * (brightness + (1 - brightness) * ao); return saturate(ret); } void HuePixel( in float4 diffuseMapValue, in float4 specularMapValue, float4 paletteMaskMapValue, float4 paletteMapValue, out Float3 fragmentDiffuseColor, out float4 fragmentSpecularColor ) { fragmentDiffuseColor = diffuseMapValue.rgb; fragmentSpecularColor = specularMapValue; float paletteMaskSum = paletteMaskMapValue.x + paletteMaskMapValue.y; // Only use the palette that applies float4 palette; Float3 chosenSpecColor, chosenMetallicSpecColor; if (paletteMaskMapValue.x < paletteMaskMapValue.y) { palette = palette2; chosenSpecColor = palette2Specular.rgb; chosenMetallicSpecColor = palette2MetallicSpecular.rgb; } else { palette = palette1; chosenSpecColor = palette1Specular.rgb; chosenMetallicSpecColor = palette1MetallicSpecular.rgb; } // Get the palette map, apply the deltas, and convert it to RGB Float3 HSL = ManipulateHSL(new Float3(paletteMapValue.g, paletteMapValue.b, paletteMapValue.a), palette); float ambientOcclusion = ManipulateAO(paletteMapValue.r, palette.z, palette.w); HSL.z *= ambientOcclusion; Float3 RGB = ConvertHSLToRGB(HSL); //Blend the result into the original diffuse fragmentDiffuseColor = lerp(diffuseMapValue.rgb, RGB.rgb, paletteMaskSum); // Determine the hue specular color Float3 hueSpecColor; const Float3 white = new Float3(1, 1, 1); float metallicMask = paletteMaskMapValue.b; //1.0 uses chosenMetallicSpecColor, .5 uses white, 0.0 uses chosenSpecColor if (metallicMask > .5) { hueSpecColor = lerp(white, chosenMetallicSpecColor, (metallicMask - 0.5) * 2); } else { hueSpecColor = lerp(chosenSpecColor, white, metallicMask * 2); } hueSpecColor *= specularMapValue.r; fragmentSpecularColor.rgb = lerp(fragmentSpecularColor.rgb, hueSpecColor, paletteMaskSum); } } }
  3. I got about 20 lines into converting that code snippet to C#, and then I realized it is missing some code in a few places. For example: if (paletteMaskMapValue.x < paletteMaskMapValue.y) { palette = palette2; The 'palette2' variable is not declared anywhere in the file.
  4. Since you're such a nice guy, I installed 3.5.4 on a VM and built the plugin with that. You should be able to use it now. --- Download removed. See below. --- What do you think of doing like this? Hidden Content:
  5. The Stained Glass looks super good and realistic. Gold Star for you.
  6. 1. 32nds? That's some precision. Are you measuring drill bits or something? But I don't see why not. 2. This is the one time I hate the imperial unit system. The (um/mm/cm)meter units just use base 10, end of story. I'll have to write special code for each imperial unit. I'll try it. It would look like this, no? 3. Sure, but I'm going to have a Checkbox to force black and white; checked by default. I feel that's what most people will want to use in most cases. 4. I'll use the Test submenu in the future. I'll work on this again tonight.
  7. Yes, the plugin only works with paint.net v4.0.9+ Is your upcoming upgrade to paint.net v4 a sure thing, or do you have to convince some system administrator? Like this? Just make a selection beneath the boat before running the plugin. Here's that updated build I forgot to post last night. --- Download Removed. See below ---
  8. If I understand you correctly, that shouldn't be too hard. Go ahead and post the samples, and I and/or one of the other plugin developers will look into it. That code snippet that you linked to is Java, but converting Java to C# is pretty straightforward as they are mostly the same. Edit: Read your post too fast. I see it's HLSL, not Java. Can you blame a guy, they look much alike.
  9. Added an option for adjustable sub-unit markers. As made the labels stay at the bottom of the ruler when adjusting the height. To Scale (3/4 in, or 6/8 as seen in image) Not to scale. . .
  10. Now that CodeLab is using 'PanSliderControl', how about an option to set the default values for the Pan/DoubleVector control? Seems silly to have to migrate a script into Visual Studio just to change defaults. The Min and Max could probably stay hard coded. Same goes for the default values of the 3D Roll Ball control.
  11. You mean in 'AssemblyVersion'? I do this all the time, and it works without issue: [assembly: AssemblyVersion("0.9.0.0")]This also works without issue: [assembly: AssemblyVersion("0.9.*")]
  12. Are you willing to change the range for the first Version numBox to allow '0'? Sometimes I type: " // Version: 0.9 " in the editor, and when I go to build the dll, paint.net crashes.
  13. EDIT: The finished plugin can be found here: https://forums.getpaint.net/topic/107652-ruler-v10-march-12-2016/ I'd be willing to whip up something for you. Try this out and see if it's more or less what you need. <Download removed> . It's pretty simple.
  14. A region gets clipped at the canvas edge when you deselected it. To be on the safe side, don't move things off the canvas if you want to keep them. You can't customize Tools window, but you can customize the default settings each individual tool.
  15. Could you show us an example of what you'd like to make?
  16. Have you tried installing the .Net Framework while in Windows' Safe Mode?
  17. Yes, that's normal. paint.net uses tiled rendering. You'll be able to see that sort of lag on very large images and/or on old hardware.
  18. Considering your processor (E2140) is almost 9 years old, that does not surprise me.
  19. Dang it, I meant to change those before posting. Anyway, they're drop-down lists now.
  20. In the next version, can you please add 'System.Drawing.Drawing2D' to the list of assemblies in the prepended script? I get tired having to type it out (or paste it) every time I want to use 'SmoothingMode' or 'DashStyle', ect. I've already patched my local copy, my script won't with other people's CodeLab copy.
  21. Spoked Wheel Effects -> Render -> Spoked Wheel Change Log v1.1 (March 5, 2016) Changed: The range for Line Thicknesses now maxes out at 100 v1.0 (Feb 20, 2016) Initial release Download SpokedWheel.zip
  22. GDI+ is a component that is built into Windows; it isn't something you'd install (on Windows). I'm pretty sure the Wine implementation of GDI+ is either using Cairo or simply the X server. So you can't compare apples to oranges.
  23. Version 2.0 posted. It now has gives you complete control over Colors, and also has options for Line Styles. The IntelliSense in Visual Studio sure helped a lot.
  24. I'll post the updated source of my Graph Paper later today. That will give you an example (not sure how good it really is though, enough to get it to work at least).
×
×
  • Create New...