eekysam Posted April 11, 2012 Posted April 11, 2012 Current Version: 7.3 I have officially cut development of this plugin to pursue a more advanced and useful project that will work with actual 3D models. Description: This plugin renders normal maps to shaded images. It has a cinematic light that can be orbited around the virtual 3D surface. It is very fast and renders almost live. It also has exponential drop-off/spread settings which can be used to modify sharpness, contrast, brightness, and angle effect. It does not support the normal map's blue channel (z offset). To add the diff, make the diff a new layer below the rendered normal map. Then set the blend mode to multiply. The plugin can be found under the textures tab in effects. Known Bugs: Fixed: Light Orbit Angles do not yield correct vector rotation (Algorithm Incorrect) Larger angles shade improperly (Algorithm Incorrect) Features: Cinematic Light Light Angle Spead/Drop-off Settings Fast Preview Speed Max Spread Setting I have officially cut development of this plugin to pursue a more advanced and useful project that will work with actual 3D models. A work in progress image can be seen below: Screenshots: (Version 7) (Version 7) Downloads: Plugin Permissions: Please don't hesitate make variations of this plugin using the source code, just post them in THIS topic not a new one and post the modified code as well. 90% of the work was debugging the vector algorithms and writing new ones to use different coordinate formats (spherical vs vector, etc). I would like to save others the time it took me, so feel free to use those in your own, original plugins. CodeLab source code provided by @ReMake CodeLab source provided by ReMake // Title: Normal Map Render // Author: Sam Sartor // Submenu: Texture // Name: Norm Render // URL: http://forums.getpaint.net/index.php?/topic/24587-normal-map-renderer/ #region UICode double Amount1 = 45; // [-180,180] Light Direction double Amount2 = 45; // [-180,180] Light Height int Amount3 = 2; // [0,5] 1,5] Increase (Exponent) int Amount4 = 1; // [0,5] 1,5] Decrease (Exponent) double Amount5 = 90; // [-180,180] Light Spread #endregion void Render(Surface dst, Surface src, Rectangle rect) { Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); ColorBgra CurrentPixel; double Spr, Onx, Ony, nA, nB, nC, aB, aC, bA, bC, Shade, Col, Top, Edg, ltA, ltB, ltC; //Light Angle Conversion (Deg to Rad) Edg = 1.5707 + ((Amount1 / 180) * 3.1415); Top = 3.1415 - ((Amount2 / 180) * 3.1415); Spr = 3.1415 - ((Amount5 / 180) * 3.1415); //Per Pixel Functions for (int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { CurrentPixel = src[x,y]; //Pixel Prossesing Ony = (((double)CurrentPixel.R -128) / 128) * 1.5707; Onx = (((double)CurrentPixel.G - 128) / 128) * 1.5707; //Vector Conversion aB = System.Math.Cos(Onx); aC = System.Math.Sin(Onx); bA = System.Math.Cos(Ony); bC = System.Math.Sin(Ony); //Normal Calculations nA = (aB * bC); nB = (aC * bA); nC = 0 - (aB * bA); //Light Vector Conversion ltA = System.Math.Cos(Edg) * System.Math.Sin(Top); ltB = System.Math.Sin(Edg) * System.Math.Sin(Top); ltC = System.Math.Cos(Top); //Shader Shade = System.Math.Acos((nA * ltA) + (nB * ltB) + (nC * ltC)); if (Shade > Spr) { Shade = Spr; } //RGB Shader Col = System.Math.Pow((1 - System.Math.Pow((Shade / Spr), Amount3)), Amount4)*255; //Write to Display CurrentPixel.R = (byte)Col; CurrentPixel.G = (byte)Col; CurrentPixel.B = (byte)Col; dst[x,y] = CurrentPixel; } } } Quote Eekysam
Goonfella Posted April 11, 2012 Posted April 11, 2012 Well it`s certainly fast as you say! Seems very useful. I would just say though that it might be an idea to tell everyone where it can be found in the PDN effects list ( Effects>Texture) as I had a bit of trouble finding it once installed. Quote Please feel free to visit my Gallery on PDNFans And my Alternatives to PDN
Reptillian Posted May 9, 2021 Posted May 9, 2021 @Ego Eram Reputo Source code gone. Plugin gone. Quote G'MIC Filter Developer I am away from this forum for undetermined amount of time: If you really need anything related to my PDN plugin or my G'MIC filter within G'MIC plugin, then you can contact me via Paint.NET discord, and mention me.
Ego Eram Reputo Posted May 9, 2021 Posted May 9, 2021 4 hours ago, Reptillian said: @Ego Eram Reputo Source code gone. Plugin gone. I've rehosted the plugin DLL. I don't appear to have the source code archived. 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
ReMake Posted May 9, 2021 Posted May 9, 2021 This is the original source code for CodeLab by @eekysam <deleted, see the first post> and icon 1 Quote
Ego Eram Reputo Posted May 9, 2021 Posted May 9, 2021 Thank you @ReMake. I've added the source to the first post. 1 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
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.