mirror of
https://github.com/blender/blender
synced 2026-11-01 03:16:58 +03:00
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
33 lines
774 B
Text
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;
|
|
}
|
|
}
|
|
}
|