frio Posted November 17 Posted November 17 (edited) Effects->Stylize->Height to Normal Map Download: F_HeightToNormal.zip Description: An effect to generate tangent space normal maps from grayscale height/bump maps. Normal maps are a common technique in 3D rendering to represent the surfaces' angles for adding detail without spending actual polygons, and they can be approximated from and represent surface heights. At its heart, the effect is just edge detection in horizontal and vertical directions, but they are combined in a specific manner in the color channels - red is horizontal, green is vertical, blue just points up towards the viewer. If the image you start with has color, it will be converted to grayscale by averaging. I've been using the non-native NVIDIA and xNormal Photoshop plugins for years, thanks to the Photoshop plugin shim, but they're rather old and not being native to Paint.NET makes them a little janky and more complicated to use so I decided to try to make my own version, and for the first time as a GPU effect plugin. Thanks to running on the GPU, at least on my computer changes happen basically in real time which is definitely more comfortable to experiment with than the old non-native ones. The results for the smaller kernel sizes are almost exactly the same as the non-natives, and the larger filter sizes are still artistically reasonable even if they may not match other software exactly. These are still just approximations, after all. For non-3D texturing purposes, the effect produces somewhat similar results to the basic Emboss effect; try turning the normal map black & white after generating it. If you wish to blend together multiple normal maps, you can use layers in overlay blend mode since it gets good enough results and then run my Normalize Normal Map plugin on the flattened combination to touch it up, though it may not be entirely necessary. This plugin itself produces normalized maps and doesn't need the other one. Demo images: (open in new tab for full resolution) Settings: Contrast: contrast adjustment for the heightmap. Gamma: gamma adjustment for the heightmap. Invert color: inverts the intensity of the heightmap. This is not the same thing as the Invert direction setting. Using Contrast or Gamma other than 0s causes different results, and both inversions can be combined. Kernel size: 5 options: 4 samples: the pixels on the left, right, top and bottom are sampled for height differences. Very crisp but no larger scale detail. 3x3, 5x5, 7x7, 9x9: larger sampling areas for more smoothness but less sensitivity to small detail. Kernel type: available when using a kernel size of 3x3 or larger, 3 options: Round: my attempt at making a smooth Gaussian-style kernel based on instructions on how to build your own. Produces fairly round, smooth sampling results. Sobel: maybe the most standard. Identical to Round at 3x3 size, somewhat more angular at higher sizes. Prewitt: very angular and sensitive to diagonals, can produce crisp results. Strength: overall scale of the effect. Invert direction: reverse the direction of the normal map, so bumps become dips and vice versa. This is not the same as the Invert color setting, see above. Border mode: 3 options: Wrap: sample pixels from the other side of the image at the border. Most useful for making seamless textures. Clamp: pixels at the border repeat. Mirror: pixels reflect back at the borders. Y-axis style: different 3D engines have different interpretations of the Y axis on the green channel, choose the one you need. Retain alpha channel: the alpha channel is ignored by the computations and usually removed, but can be preserved if you like. Notes: The actual gamma used is 10^Gamma, for a range from 0.01 to 100. The actual normal map scale is 2^Strength, for a range from 1/16th to 256. Strength 0 more or less matches the NVIDIA plugin at scale 1, and Strength 1 produces results more like the xNormal plugin at smooth 1. The Positive Y-axis style looks more natural for artistic purposes, since it looks like it's lit from above, but that's just my opinion. Future ideas, no guarantees: even larger kernels, more heightmap adjustments like blur, more kernel types (need ones that work in horizontal and vertical directions separately and can be scaled as large as desired). Change log: Version 1.0, 2024-11-17: Initial release. Edited November 17 by frio 1 3 Quote
lynxster4 Posted November 17 Posted November 17 Wow @frio I just learned a lot of stuff. The brick wall info in your link is fascinating. I'm trying to think how I can use this in my art... Anyway...Great job!! 😊 1 Quote My Art Gallery | My Shape Packs | ShapeMaker Mini Tut | Air Bubble Stained Glass Chrome Text with Reflections | Porcelain Text w/ Variegated Coloring | Realistic Knit PatternOpalescent Stained Glass | Frosted Snowman Cookie | Leather Texture | Plastic Text | Silk Embroidery Visit my Personal Website "Never, ever lose your sense of humor - you'll live longer"
frio Posted November 17 Author Posted November 17 (edited) 1 hour ago, lynxster4 said: Wow @frio I just learned a lot of stuff. The brick wall info in your link is fascinating. I'm trying to think how I can use this in my art... With modern 3D texturing I find normal maps to be like the most important of all the textures that combine to make a material - the amount a material gets it real-world feel from surface details is massive, the colors and such are actually pretty arbitrary and not as important, a realistic banana skin would still look "realistic" if it was blue. The roughness map is in a way just a microscopic-detail normal map too, which is it the other half of the power duo, but those are just plain ol' grayscale textures like the heightmap and don't require extra tools to work with. As for using the normal map effect for artistic purposes, it can stand in for an emboss effect! You can't freely choose the "light direction", it'll always be from a diagonal, but the other features like the kernel size can be useful. Grayscale it and use it in overlay blend mode on top of other detail to take it as a light/shadow mask or something, since flat areas become fairly midpoint gray they won't affect the image below too much. Edited November 17 by frio 1 Quote
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.