Use sub-pixel differentials for bump mapping helps with reducing artifacts when objects are moving or when textures have high frequency details. Currently we scale it by 0.1 because it seems to work good in practice, we can adjust the value in the future if it turns out to be impractical. Ref: #122892 Pull Request: https://projects.blender.org/blender/blender/pulls/133991
22 lines
515 B
Plaintext
22 lines
515 B
Plaintext
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 */
|
|
|
|
#include "oslutil.h"
|
|
#include "stdcycles.h"
|
|
|
|
shader node_wireframe(string bump_offset = "center",
|
|
int use_pixel_size = 0,
|
|
float Size = 0.01,
|
|
output float Fac = 0.0)
|
|
{
|
|
if (bump_offset == "dx") {
|
|
P += Dx(P) * BUMP_DX;
|
|
}
|
|
else if (bump_offset == "dy") {
|
|
P += Dy(P) * BUMP_DY;
|
|
}
|
|
|
|
Fac = wireframe("triangles", Size, use_pixel_size);
|
|
}
|