Jump to content
How to Install Plugins ×

Texture Scaler


MJW

Recommended Posts

Texture Scaler is a seemingly boring but quite useful utility program which allows height maps to be rescaled. The height map is mapped to the specified range. The original range is considered to be 0 to 1 if the Pre-Scale Heights to Entire Range option is disabled, and the minimum height to the maximum height within the selected portion (actually its bounding rectangle) of the image if the option's enabled. The Feather Far Pixels option is useful for erasing the zero-height background when combing height maps using the Texture Merger with the Minimum merge method. Unchecking the Produce 24-Bit Height Map option allows it to be used to scale grayscale height maps (and other grayscale images too, I suppose).

 

Here is the plugin (version 1.2.6431.28257): TextureScaler.zip

 

From the Help Menu:

 

Texture Scaler scales a height map to a specified range.

The controls are:

Pre-Scale Heights to Entire Range: When enabled, the height range is adjusted prior to scaling so that the minimum pixel height is zero and the maximum pixel height is one. Equivalently, the minimum height will be mapped to Minimum Height and the maximum height will be mapped to Maximum Height. When there is an active selection, the pixels within the selection's bounding box will be used to determine the depth range.

Set Transparent-Pixel Heights to Zero Before Scaling: When enabled, the heights of transparent pixels will be set to zero before mapping to the final range. Equivalently, transparent pixels will be mapped to Minimum Height.

Don't Scale Transparent Pixels: When enabled, the heights of transparent pixels are not modified by pre-scaling or by the range scaling. If this option and Set Transparent-Pixel Heights to Zero Before Scaling are both enabled, the heights of transparent pixels are set to zero.

Feather Far Pixels: When enabled, the transparency of scaled pixels near the Minimum Height will be increased.

Feather Range: Specifies the proportion of the Minimum Height to Maximum Height range that will be feathered when Feather Far Pixels is enabled. When Feather Range is zero, pixels at the Minimum Height are fully transparent and all other pixels are unmodified. When Feather Range is one, the pixel transparency will decrease linearly through the full height range.

Produce 24-Bit Height Map: When enabled, the scaled height map will have 24-bits of precision. When disabled, the scaled height map will be an 8-bit grayscale image.

Minimum Height: Specifies the minimum value for the scaled height map.

Maximum Height: Specifies the maximum value for the scaled height map.

 

The user interface:

Texture_Scaler_UI.png

 

EDIT: Version 1.1. Replaced buggy version. Increased slider precision from 2 to 3 places.

EDIT 8/9/2017: Version 1.2. Fixed various bugs; added "Don't Scale Transparent Pixels" control; Modified feathering control.

EDIT 8/10/2017: Version 1.2.6431.28257. Minor change to avoid unlikely problem.

  • Upvote 6
Link to comment
Share on other sites

It's really only useful for those who use the Texture Shader and Texture Merger plugins a lot. I don't want to be criticized for using "private" plugins for comps, so I try to publish all the plugins I use, and let others decide whether they're worth downloading. For most PDN users, this one won't be.

  • Upvote 1
Link to comment
Share on other sites

Hello MJW,

Can you give example of what is standard result of using it ?

here example of using it on shape of diamond:

First TextureShader with default option with the light from up left ( -150.50.0)

 

image.png

 

 

 

And here the TextureScaler with Min 0.60 and Max 1.0:

 

image.png

 

 

 

 

 

What Now will be the best result ?

 

 

 

 

 

 

Link to comment
Share on other sites

Shochi, the plugin isn't really intended to produce specific images. It's essentially a brightness/contrast/auto-brightness control for height maps, and is mostly useful in conjunction with plugins which use 24-bit height maps, like the Texture Shader. What's best depends on what the height map will be used for. Because the normal image editing functions can't be used for high-precision height maps, I'm writing some tools to help manipulate them.

Link to comment
Share on other sites

  • 2 weeks later...

Nice work MJW!  :)

I did a little comparison experiment.  So, it alters the way Texture Shader will 'color' the sphere because you've altered the height map.

Some interesting effects can be achieved with this.

 

Here is a simple example:

 

texturescaler_01.gif

 

 

Thank you MJW!   :beer:  :pizza:

Edited by lynxster4
re-hosted image
  • Upvote 1
Link to comment
Share on other sites

New version 1.2.

 

I fixed several bugs that made the plugin less useful.

I added a "Don't Scale Transparent Pixels" option.

I modified feathering so that instead of specifying a height at which feathering ends, the user specifies the range of feathering within the Minimum to Maximum height range.

 

The Don't Scale Transparent Pixels option allows the range of a height-map object to be changed without changing the height of the transparent background (which will usually be zero). Combined with Pre-Scale Heights to Entire Range and Set Transparent-Pixel Heights to Zero Before Scaling, it forces the height of transparent pixels to zero, while moving the height-map object so that the minimum height of the object pixels is zero. This can be quite useful for producing height maps by blurring shapes.

 

The basic idea is:

Draw a white shape on a black background. For example, a filled rectangle.

Copy the image to the clipboard (after, perhaps, a one or two pixel blur to soften the edge).

Blur the image. The type and amount of burring depend on the desired result.

Use BoltBait's Paste Alpha to restore the original object shape and make the background transparent.

Run Texture Scaler with the first three options enabled. Perhaps also use a bit of feathering.

In many cases, it will be useful to use the Texture Smoother to smooth the resulting height map.

 

Another way:

Draw a white shape on a black background. For example, a filled rectangle.

Perhaps blur a pixel or two to soften the edge.

Duplicate the layer.

Set the top layer's Blend Mode to Multiply.

Blur the top layer. The type and amount of burring depend on the desired result.

Merge the layers.

Run Texture Scaler with the all options set, and a Feather Range of 0. (This erases the black areas)

Rerun Texture Scaler. (This rescales the non-transparent pixels.)

In many cases, it will be useful to use the Texture Smoother to smooth the resulting height map.

 

Another approach that seems to work well is to use the first method, but do the Texture Smoothing before doing the Paste Alpha.

 

There are plenty of possible variations, especially tricks to make the outer edge smoother.

For blurs, I usually use Gaussian Blurs or Motion Blurs, such as two Motion Blurs at right angles.

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...