Jump to content

Adjusting Normal maps


You are about to reply to a thread that has been inactive for 3236 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I have been trying to improve the textures of my inworld builds; specifically making use of Materials/Advanced Lighting.

( I think I get the gist of how Specularity maps work, but I have not yet acheived good results - there are so many factors determining the particular effect they might have.)

Anyway, I have made more progress with understanding Normal maps.

Almost certainly, most of you will already know all this, but maybe some people might find the following interesting.

Say you have a Normal map image. If you want to test it in Blender you add it as a texture to a Material.

Normal value (positive).png

The range of values offered by Blender is from -5.0 to +5.0

Going from positive to negative on this slider inverts the effect; like so:-

Normal value (negative).png

Moreover, the lower the value, the less apparent "depth" is exhibited - a value of 0 in this Blender slider causes no effect to be displayed.

This got me wondering how one might reproduce these variations inworld.

Well, as for the equivalent to changing from positive to negative, that turned out to be straightforward - just rotate the texture 180deg.

The only way I could "dial" the values up or down  was by uploading fresh versions of the original image, having changed them in a 2-D graphics editor using Levels.

Here is inworld Midday (with a "Dull Day" windlight) :-

Normal value (reproduced).jpg

1. original texture

2. original texture rotated 180 deg. using inworld Editor

3. original texture with "Levels" increased

4. ditto decreased

Link to comment
Share on other sites

There is no way to change the intensity of normal maps inworld.
Also keep in mind, SL uses OpenGL style normal maps which are +X (Red = right), +Y (Green = Up) . Your image looks pretty much inverted. Which isn't a problem with this simple map, but if you start baking normal maps on more complex geometry, you want to keep the orientation in mind.

In general I wouldn't play with levels on normal maps, I'd rather create them with the intensity I want right from the start.

Link to comment
Share on other sites


arton Rotaru wrote:

In general I wouldn't play with levels on normal maps, I'd rather create them with the intensity I want right from the start.

Yes, fair enough. But I am not sure how one would do that.

In my post above, the normal map was produced by baking from a simple 3D mesh to a plane in Blender; then I saved the image.

A different scenario is where one has derived a normal map from a diffuse texture (via the Gimp plug-in or some other tool). This seems to produce a clever "guesstimate" of what the surface might be.

For example, here is a blurred stone texture :-

chalk diffuse1.jpg

And here are 3 Normal maps generated from it :-

chalk normals V.2.jpg      chalk normals V.3.jpg     chalk normals V.4.jpg

First one is what is outputted by the tool; next ones are tweaked by using Levels.

This is how they work inworld (Midday again) :-

generated normals.jpg

1.is the unaltered texture; 3. and 4. are the Levels adjusted ones (increased and decreased respectively).

Granted the screenshot is less than clear; however, it's possible that not everyone would think that the middle cube looked the best.

I have to say that I really do not understand any of this - just doing my own tests.

Like, there are NO specularity maps on any of those cubes; so why is there such variation in the brightness of certain faces depending on the Normal map they have been assigned?

Link to comment
Share on other sites

Well, I don't use Gimp, and I don't know the Plug-in, but none of the maps do look like tagent space normal maps to me.

The neutral color of a TS normal map is RGB 128,128,255. This is pointing perpendicular to the polygon. Any color variation will bend the normals so you get these different brightness effects.

I took your diffuse image, desaturated it, and these are the results I got from xNormals Height2Normals tool.

The 25% version is the normal map on top of a neutral normal color layer, with opacity set to 25 %.

The strongest version is a duplicated layer of the original normal set to Linear Light blending mode. Which gives a stronger effect.

TS_Variations01.jpg

This is how the maps look.

NormalVaritions02.jpg

Link to comment
Share on other sites


anselm Hexicola wrote:


Yes, fair enough. But I am not sure how one would do that.

In my post above, the normal map was produced by baking from a simple 3D mesh to a plane in Blender; then I saved the image.


If you want the hemi sphere less pronounced, you would just make the geometry more flat instead of bulgy.

Link to comment
Share on other sites

Out of interest, I thought I would see whether I could make a normal map "deeper" in Gimp. The problem with using the usual colour manipulations is that the colours you are left with are not normalised, As Arton said, the rgb value of eaxh pixel is a vector controlling the angle between the geometric normal and the normal you want. They are encoded as signed buyes, so that the byte value 0 is -128, byte value 128 is 0 and byte 255 is 127. Since (you don't want to have normals pointing into the surface, blue is always >= 128, while red and green can vary over the who;e range. However, the values are supposed to be normalised. That is to say the vectors should always have the same length, 127.  To satisfy that, you need sqrt(r²+g²+c²) = 127. Although rendering software will generally do its best to deal with un-normalised values, the normalmap plugin in Gimp has an option to just normalise the pixels in a normal map.

I started with a normal map baked in Blender (top left) and use curves to stretch the red and green chanels as shown at the top right. Then I applied the normalise funtion from normalmap. That gave the map at the bottom left. To its right is a map baked in Blender from the same geometry after stretching it 2x aling the baking ray direction (ie z for the horizontal plane baking target). You can see it's fairly similar to the one strtched in Gimp. At the bottom are the three maps applied to a prim cube inworld. I seems to have worked reasonably well. I would still prefer to do the bake with the scaled geometry, but where you don't have the geometry (e.g. in normal maps made from images), it should work ok. It's important to keep the curves symetrical so that you don't tilt the whole face one way or the other.

normul.png

By the way, these maps are the right way round. They should look as if there is a red light on the right and a green light at the top. Otherwise, the "swizzle" is wrong and you may get conflictiing highlighting in one direction or the other. If both are wrong, then it looks as if the whole thing is the wrong vway bround, bumps turn into hollows and vice-versa. What matter here is the orientation of the map with respect to the U and V axes of your UV map. So that is why rotating the map before applying it has the same effects. By sefault, the normalmap plugin for Gimp uses different "swizzle" from the Blender baker. You have to check the Invert Y checkbox to get the right output fot SL. Alternatively, if you do have a map with the wrong swizzle,  you can just flip the vertical repeat in inworld (by setting it to a negative number). You would have to flip the diffuse texture too if it's matched with the normal map. 

 

Link to comment
Share on other sites

Just a comment on inverted normal maps and tangent axis/swizzles etc:

Rather than inverting your repeats in SL, or rebaking with correct tangents (ie: +y instead of -y), all you need to do is invert the offending channel in Gimp/Photoshop. I'm not sure how to do it in Gimp, but in PS its as easy as going into the channels tab (usually under layers), selecting the correct channel and hitting ctrl+I. In most cases it'll be the green channel (y axis).

Link to comment
Share on other sites

arton Rotaru - "Your image looks pretty much inverted."

Drongle McMahon - "...  maps [....] should look as if there is a red light on the right and a green light at the top."

Useful to have that pointed out.

I have continued my (albeit amateurish but now better-informed) tests of manipulating normal maps.

What I think I now know is :-

   1. [iNWORLD EDITING] For any normal map, there is no difference between a)rotating by 180 deg and b)changing the sign of the y-offset. Either pops the apparent geometry in or out. [EDITED22/4/2015  This is incorrect - see Drongle's post below. ]

   2. [OFFLINE TOOLS] Manipulating the Red or Green colour curves (as demonstrated by Drongle in his post) does a good job of accentuating the apparent depth of detail - but Red does it IN, and Green does it OUT (or vice-versa depending on what you started with). So, maybe, it hardly matters which one you choose - you can always flip the effect with the inworld editor.

Here is my latest attempt to get a useful Normal map from that blurry stone texture using the Gimp plugin.

I still dont really know what settings to use, having tried several. In this case,I used Sobel3x3 for the Filter and None for the Conversion.

Screenshot_1.png

 

Next step = change with Colour Curves, going a bit extreme just to see.

green curve.png     red curve.png

Here are the 3 maps (respectively 1. map made by Gimp plugin, 2.Green curve alteration, 3.Red curve alteration) :-

Gimp plugin normal.png    green curve tweak.jpg    red curve tweak.jpg

This is them applied inworld (3PM sun) :-

inworld 3PM.png

(Here the original from the Gimp plugin is in the middle, the "doctored" ones either side.)

I count this as a success!  As it happens, I will use the RHS version because its bumps/pits are recessed; but equally the LHS one looks identical if y-offset is sign-changed or it is rotated.

 

[ ...had hours of fun with this; learned loads; "tips hat" to anton and Drongle ...]

 

Link to comment
Share on other sites

"no difference between a)rotating by 180 deg and b)changing the sign of the y-offset"

I think there should be a difference, but you have to look at the right lighting conditions. I find using a prim light source and moving it around is best, with a bit of shininess - blank specular map with default spinners is ok.Move the light back and forth along either axis.  If you have just the y flipped (a common problem where different software uses different swizzles), you get it behaving like a bump in one direction but like a cavity in the other. That can be a bit disturbing, as it is physically inconsistent. Your brain tries to suppress it. Same thing with x axis flipped on its own. Rotating 180 is the same as flipping both axes, I think, which completes the job, making it all bump or all cavity.

Link to comment
Share on other sites

That was a helpful overview. And I am glad you pointed out my mistake.

Here are a couple of screenshots that I think demonstrate your info.

A cube was quartered and a prim light placed directly overhead.

normal settings1.jpg

normal settings2.jpg

The original normal map was correctly orientated this time (!) - ie. green to the top,red lower right. Unadjusted it would give the appearance of convex bumps. But the exercise was to yield concave bumps, so the 4 versions in the pictures above were altered thus:-

   1.  - x,- y repeats

   2.  + x,+ y repeats; rotated 180 deg.

   3.  - x,+ y repeats

   4.  + x,- y repeats

As you suggested, 3. and 4. give rise to inconsistent effects. Not only do some faces appear convex, but the shadows are illogical.

And, if I understood you correctly, 1. and 2. amount to the same thing.

Link to comment
Share on other sites

  • 1 month later...

hi i've just started trying to design dresses and to give it a go ive bought some pre-maid one with full permision...the problem is ibe got my textures lined out on the uv map, but when i add the normals map it throws the color way off and i can't get it to go back to normal!! Any tips to help me out? oh and i use PS so hehe

Link to comment
Share on other sites

Just to be sure. You don't add a normals map to your color texture (Diffuse map). You just add the texture in-world into the Bumpiness (Normal map) slot, in the Build floaters Texture tab.

Furthermore, showing some screenshots of your issue would make it easier to help you out.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3236 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...