MJW Posted October 27, 2016 Share Posted October 27, 2016 (edited) This plugin is meant to work in conjunction with my other Height-Map plugins. It's in the "Effects>Height Map" menu. Here is Version 1.1 of the plugin: TextureMerger.zip The effect works similarly to Texture Shader, except instead of an image in the clipboard, the clipboard contains another height map. The height map in the canvas is combined with the height map in the clipboard in various ways. The default method, and the one it was originally written to do, is to add them. If plugins are rated by the number of controls, this is possibly the best plugin ever. The large number is necessary because there are so many things that need to be controlled: the window height scaling and offset, the clipboard orientation, scaling and offset, and the adjustments to the merged height. There are also controls for shading. Shading does not effect the merged height map, but it's necessary to judge the results. Because there's currently no way to automatically disable the shading before exiting, it must be disabled manually. (unless the shaded image is what is wanted). Fortunately, unlike the Texture Smoother, a mistake can easily be corrected with an Undo, followed by rerunning the Texture Merger. Here is the user interface (hide the eyes of sensitive children): According to the Help Menu: ---------- Texture Merger combines two height maps, one in the canvas and the other in the clipboard. Each height map consists of an 8-bit alpha channel and a 24-bit depth, formed by combining the RGB channels into a single 24-bit unsigned integer. The controls are:Clipboard Image: Specifies how pixels outside the clipboard boundaries are treated. Pixels outside the image range of the clipboard can be transparent, Clamped, Tiled, Alternately Tiled, or Brick Tiled. When Alternately Tiled is selected, the tile orientation is reversed for every other tile, so that the tiles match at the edges. The edge pixels are not repeated. When Brick Tiled is selected, every other row is offset by half the image width. The rows do not wrap from the top to the bottom. Clipboard Image Size: Increases or decreases the size of the clipboard image. Clipboard Image XY Proportion: Changes the XY proportion of the clipboard. Moving the control right increases the X size while decreasing the Y size. Moving the control left decreases the X size while increasing the Y size.Clipboard Image Offset: Moves the clipboard image relative to the canvas image.Clipboard Image Rotation: Specifies a counterclockwise rotation angle for the clipboard image, in degrees.Clipboard Image Mapping Method: Selects the method used to displace the clipboard image based on the canvas heights. (A number of methods are allowed which have no obvious physical meaning when merging height maps.) The choices are: No Displacement: Does not displace the clipboard image. Surface Offset 1: Uses the height and gradient of the canvas height map to attempt to map the clipboard image onto the canvas height map as if it were painted onto the surface. Surface Offset 2: An alternate method of mapping the clipboard image as if painted onto the surface. Gradient: The simplest mapping method. Displaces the clipboard image in the direction of the gradient, in proportion to the gradient magnitude. Gradient-Z: Displaces the clipboard image in the direction of the gradient, in proportion to the product of the canvas height and the gradient magnitude. Refraction: Displaces the clipboard image as if it were refracted by the canvas height map, in accordance with Snell's Law. The Displacement Scale is proportional to the Index of Refraction Reflection: Displaces the clipboard image as if it were reflected by the canvas height map surface. The Displacement Scale is proportional to the distance from the canvas height map to the reflected plane. Because the angle of reflection equals the angle of incidence, points with gradients of more than 45° will not reflect the image and will be rendered as transparent. Reflection (Ignore Height): Displaces the clipboard image as if it were reflected by the canvas height map surface, but uses only the gradient, ignoring the effect caused by the canvas height. Reflection (with Re-reflection): Applies reflection, but approximates the re-reflection of downward reflection vectors. Faux Reflection: Approximates reflection for gradients of less than 45°, but produces non-transparent pixels for gradients greater that 45°. Faux Reflection (Ignore Height): Applies Faux Reflection, ignoring the effect caused by the canvas height height. Divide Mapping Displacement by Ten: Specifies that the Mapping Displacement should be divided by 10 to decrease the control's range. Mapping Displacement: Controls the amount the clipboard heights are displaced. The effect depends on the Mapping Method. For most methods, it acts as a general scaling factor, but for Refraction and Reflection it has a specific physical meaning. For some mapping methods, such as reflection, setting this value to 0 does not result in no displacement. Divide Merged Height Scale by Ten: Specifies that the Merged Height should be divided by 10 to decrease the control's range. Merged Height Scale: Increases or decreases the height of the merged height map. The scaling affects the amount of displacement and the effective height for shading. Only the change in displacement changes the values in the merged height map.Merged Height Curvature: Increases or decreases the curvature of the merged height map. Merged Height Alpha Source: Selects the source of the alpha values for the Merged height map. The choices are: All Opaque: Make all heights opaque. Canvas Alpha: Use the alphas from the canvas. Clipboard Alpha: Use the alphas from the displaced clipboard. Composite Alpha: Use the composite alpha. This is the sum of the canvas and clipboard alpha minus the product. If either height is opaque, the merged height will be opaque. Height Merge Method: Selects the method used to combine clipboard heights with the canvas heights. The choices are: Add: Add the clipboard height to the canvas height. Subtract: Subtract the clipboard height from the canvas height. Multiply: Multiply the clipboard height by the canvas height. Maximum: Use the maximum of the clipboard height and the canvas height. Minimum: Use the minimum of the clipboard height and the canvas height. Clipboard: Use the clipboard height as displaced by the Mapping Method. Canvas: Use the canvas height and alpha, as modified by the canvas controls and the merged-height controls. Clipboard (No Displacement): Use the non-displaced clipboard height and alpha, as modified by the clipboard controls and the merged-height controls. Make Unmodified Canvas Heights Transparent: Specifies that if the merged height is the same as the canvas height, the merged height should be made transparent. This allows heights modified by the clipboard to be shaded separately from unmodified heights. Canvas Height Scale: Increases or decreases the canvas heights. Canvas Height Offset: Specifies the offset added to the scaled canvas heights. Canvas Height Curvature: Specifies the non-linear adjustment to the canvas heights, which increases or decreases the mid-range values while leaving the end-range values unchanged. This adjustment is applied before the scale and offset. Weight Clipboard Heights by Opacity: Specifies that the influence of a clipboard height on the merged height is proportional to the clipboard height's opacity. In particular, transparent heights are are ignored, and the canvas heights are used as the merged heights. This control is especially useful when offsetting the clipboard height in when the Height Merge Method is Maximum or Minimum. Invert Clipboard Height Range: Specifies that white clipboard pixels are 0 height and black clipboard pixels are maximum height. Scale Clipboard Heights by Clipboard Image Size: Specifies that the clipboard heights should be scaled to be proportional to the clipboard image size. Divide Clipboard Height Scale by Ten: Specifies that the Clipboard Height Scale should be divided by 10 to decrease the control's range. Clipboard Height Scale: Increases or decreases the clipboard heights. Clipboard Height Offset: Specifies the offset added to the scaled clipboard heights. Clipboard Height Curvature: Specifies the non-linear adjustment to the clipboard heights. Antialias: Specifies that antialiasing should be used. Antialiasing will slow the effect, because many more points need to be processed. but will often significantly improve the results..Antialias Quality: Specifies the number of samples in each direction per pixel. The total number of samples per pixel is this value squared. ----------The following controls effect only the shaded image.---------- Show Shading (Disable Before Exiting): Specifies that the shaded height map should be shown instead of the actual merged height map. This must be disabled before exiting the effect in order to save the merged height map. Ambient Light Color: Sets the color of the ambient light source. Ambient Light affects all pixels equally, no matter their orientation. The default color is black (no ambient lighting).Directional Light Color: Sets the color of the Directional Light. The default color is white.Directional Light Direction (Use Outer Ring to Reverse): Sets the direction of the Directional Light. The Directional Light's effect on a pixel is determined by light's direction and the texture's gradient at the pixel. Moving the outer ring to the left side of the control reverses the light direction.Directional Light Intensity: Increases or decreases the intensity of the Directional Light. The directional light contributes both diffuse and specular (reflected) light.Specularity: Determines the shininess of the surface. Increasing this value decreases the diffuse lighting and increases the specular lighting.Specular Concentration (Exponent): Determines the sharpness of the specular highlights. Higher values produce sharper highlights. ---------- There are several changes from the Texture Shader, most of which I intend to add to the Texture Shader. Inspired by Red ochre, I added a Brick Tiled Clipboard Image option. I didn't include a Reflected Brick Tiled option, because I wasn't sure how useful it would be. Maybe I'll eventually add it. On several slider controls, such as the Texture Height, I added a divide-by-ten option. These are kind of awkward, but almost necessary to support the wide range of height-map heights made possible, especially using the Texture Smoother. Before the Texture Smoother, large height maps were difficult to produce without very noticeable waterlines, making them mostly useless. Some of the slider controls also use a non-linear range. Moving the slider at the low end of the range produces less change than the same movement at the high end. This allows fiver control at the low values. The Clipboard (No Displacement) Merge Method is useful for modifying a height map in the clipboard with no effect from whatever is in the window. I rather expect there will be a few bugs, since there are so many controls, and the interaction between them is quite complex. I'll follow this comment with a few examples of merged height-map images. EDIT: Version 1.1. I explain the changes in another comment. Edited October 15, 2019 by Pixey fixed UI image 7 Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.