Need to set a negative value for normal map bumpiness in the Editor

As we all know ,negative value can invert the bumpiness of Normal map.
But I don’t know in what consideration ,PlayCanvas forbidden user to enter a negative value in Normal Bumpiness .

Well, let’s take a look at the GLSL that uses the bumpiness:

As you can see, it interpolates a normal towards blue (non-bumpy) as bumpiness approaches zero. I don’t think a negative number here would ‘flip’ the normal map. I’m sure @Mr_F will have some clearer reasoning here. :slight_smile:

Hi Will
I though same with you before ,until I did a experiment with PlayCanvas this morning, and I am sure negative number would flip bumpiness .
Please have a try .If I am right ,Normal map will be more flexible used .

Wait a moment ,I am creating a Test Project .
@will Please take a look .There is a slider on top left of screen .

Yes, it should work, because GLSL mix can do extrapolation, even negative.

mix(a,b,c) = a + c * (b - a),
therefore if normal.x = 1, and bumpiness = -1,
0 + -1 * (1 - 0) = -1, so it will get flipped indeed, and your example shows it.

But it’s just limited in Editor for some reason.

Three possible solutions:

  1. We keep things unchanged in the Editor and expect developers to create a script to set a bumpiness value outside the range 0…2.
  2. We make the slider range -2 to 2.
  3. We change the slider to a number edit box and allow any value to be input.

What do you think, @Mr_F?

Perhaps both slider (-2 - 2) and edit box for unrestricted values?

1 Like

Yeah sure ,the second is a good idea .But I suggest both slider and editor box range -2 to 2 .We don’t need too big value actually ,what do you think ?
@scarlex @Mr_F @will

Is there any way to do this, currently?

Hi @MoonAlien822,

No this change didn’t make it to the editor.

So the proposed way to do that is using a script and setting that value on a material in code.