Cycles bump node: change the Strength value to work better, previously it would

give results that were either too weak or too strong, this makes it give more
predictable results. The downside is that it breaks backwards compatibility but
the previous behavior was almost broken.
This commit is contained in:
Brecht Van Lommel
2013-05-09 14:05:37 +00:00
parent d326d92b2f
commit d236b4d60f
3 changed files with 12 additions and 8 deletions

View File

@@ -40,10 +40,12 @@ surface node_bump(
float det = dot(dPdx, Rx);
vector surfgrad = (SampleX - SampleCenter) * Rx + (SampleY - SampleCenter) * Ry;
surfgrad *= Strength;
float absdet = fabs(det);
float strength = clamp(Strength, 0.0, 1.0);
/* compute and output perturbed normal */
NormalOut = normalize(absdet * NormalIn - sign(det) * surfgrad);
NormalOut = normalize(strength*NormalOut + (1.0 - strength)*NormalIn);
}