Blender V5.3
gpu_shader_material_displacement.bsl.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019-2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
8
9[[node]]
10void node_displacement_object(float height,
11 float midlevel,
12 float scale,
13 float3 N,
15 ShadingData &sd,
16 float3 &result)
17{
18 float3 lN;
20 float3 l_displacement = (height - midlevel) * scale * normalize(lN);
21 /* Apply object scale and orientation. */
22 direction_transform_object_to_world(l_displacement, kg, sd, result);
23}
24
25[[node]]
26void node_displacement_world(float height, float midlevel, float scale, float3 N, float3 &result)
27{
28 result = (height - midlevel) * scale * normalize(N);
29}
#define resource_table
VecBase< float, D > normalize(VecOp< float, D >) RET
void node_displacement_world(float height, float midlevel, float scale, float3 N, float3 &result)
void node_displacement_object(float height, float midlevel, float scale, float3 N, KernelGlobals &kg, ShadingData &sd, float3 &result)
void direction_transform_world_to_object(float3 vin, KernelGlobals &kg, const ShadingData &sd, float3 &vout)
void direction_transform_object_to_world(float3 vin, KernelGlobals &kg, const ShadingData &sd, float3 &vout)
float3x3 scale(float3x3 mat, float2 scale)
#define N