blender/intern/cycles/kernel/osl/shaders/node_uv_map.osl
Brecht Van Lommel f987ef7b6e Shaders: Add Filter Width input to Bump node
This makes it possible to restore previous Blender 4.3 behavior of bump
mapping, where the large filter width was sometimes (ab)used to get a bevel
like effect on stepwise textures.

For bump from the displacement socket, filter width remains fixed at 0.1.

Ref #133991, #135841

Pull Request: https://projects.blender.org/blender/blender/pulls/136465
2025-03-25 16:29:13 +01:00

33 lines
774 B
Text

/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
*
* SPDX-License-Identifier: Apache-2.0 */
#include "stdcycles.h"
shader node_uv_map(int from_dupli = 0,
string attribute = "",
string bump_offset = "center",
float bump_filter_width = BUMP_FILTER_WIDTH,
output point UV = point(0.0, 0.0, 0.0))
{
if (from_dupli) {
getattribute("geom:dupli_uv", UV);
}
else {
if (attribute == "")
getattribute("geom:uv", UV);
else
getattribute(attribute, UV);
}
if (bump_offset == "dx") {
if (!from_dupli) {
UV += Dx(UV) * bump_filter_width;
}
}
else if (bump_offset == "dy") {
if (!from_dupli) {
UV += Dy(UV) * bump_filter_width;
}
}
}