Blender V5.3
gpu_shader_ray_utils.bsl.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
8
18{
19 constexpr float origin = 1.0f / 32.0f;
20 constexpr float float_scale = 1.0f / 65536.0f;
21 constexpr float int_scale = 256.0f;
22
23 int3 of_i = int3(int_scale * Ng);
24 of_i = int3((P.x < 0.0f) ? -of_i.x : of_i.x,
25 (P.y < 0.0f) ? -of_i.y : of_i.y,
26 (P.z < 0.0f) ? -of_i.z : of_i.z);
28
29 float3 uf = P + float_scale * Ng;
30 return float3((abs(P.x) < origin) ? uf.x : P_i.x,
31 (abs(P.y) < origin) ? uf.y : P_i.y,
32 (abs(P.z) < origin) ? uf.z : P_i.z);
33}
VecBase< int, D > floatBitsToInt(VecOp< float, D >) RET
VecBase< float, D > intBitsToFloat(VecOp< int, D >) RET
#define abs
float3 offset_ray(float3 P, float3 Ng)
float z
Definition sky_math.h:136
float y
Definition sky_math.h:136
float x
Definition sky_math.h:136