30 const float alpha = r.
w;
50template<
class Float3Type>
63template<
class Float3Type>
85template<
class Float3Type>
102 N /= (
N.x +
N.y +
N.z);
115 const float blend =
node.blend;
116 const float limit = 0.5f * (1.0f + blend);
119 if (
N.x > limit * (
N.x +
N.y) &&
N.x > limit * (
N.x +
N.z)) {
122 else if (
N.y > limit * (
N.x +
N.y) &&
N.y > limit * (
N.y +
N.z)) {
125 else if (
N.z > limit * (
N.x +
N.z) &&
N.z > limit * (
N.y +
N.z)) {
128 else if (blend > 0.0f) {
130 if (
N.z < (1.0f - limit) * (
N.y +
N.x)) {
131 weight.
x =
N.x / (
N.x +
N.y);
132 weight.
x =
saturatef((weight.
x - 0.5f * (1.0f - blend)) / blend);
133 weight.
y = 1.0f - weight.
x;
135 else if (
N.x < (1.0f - limit) * (
N.y +
N.z)) {
136 weight.
y =
N.y / (
N.y +
N.z);
137 weight.
y =
saturatef((weight.
y - 0.5f * (1.0f - blend)) / blend);
138 weight.
z = 1.0f - weight.
y;
140 else if (
N.y < (1.0f - limit) * (
N.x +
N.z)) {
141 weight.
x =
N.x / (
N.x +
N.z);
142 weight.
x =
saturatef((weight.
x - 0.5f * (1.0f - blend)) / blend);
143 weight.
z = 1.0f - weight.
x;
147 weight.
x = ((2.0f - limit) *
N.x + (limit - 1.0f)) / (2.0f * limit - 1.0f);
148 weight.
y = ((2.0f - limit) *
N.y + (limit - 1.0f)) / (2.0f * limit - 1.0f);
149 weight.
z = ((2.0f - limit) *
N.z + (limit - 1.0f)) / (2.0f * limit - 1.0f);
161 const float missing_alpha =
stack_load(stack,
node.missing_alpha);
165 if (weight.
x > 0.0f) {
170 if (weight.
y > 0.0f) {
175 if (weight.
z > 0.0f) {
189template<
class Float3Type>
199template<
class Float3Type>
207 const float missing_alpha =
stack_load(stack,
node.missing_alpha);
ccl_device float4 color_srgb_to_linear_v4(const float4 c)
ccl_device float2 direction_to_mirrorball(float3 dir)
ccl_device float2 direction_to_equirectangular(const float3 dir)
ccl_device_forceinline float4 kernel_image_interp_with_udim(KernelGlobals kg, ccl_private ShaderData *sd, const int udim_id, dual2 uv, const float4 missing_rgba)
ccl_device_noinline void svm_node_tex_environment(KernelGlobals kg, ccl_private ShaderData *sd, ccl_private float *ccl_restrict stack, const ccl_global SVMNodeTexEnvironment &ccl_restrict node)
ccl_device_inline Float3Type texco_remap_square(const Float3Type co)
CCL_NAMESPACE_BEGIN ccl_device float4 svm_image_texture(KernelGlobals kg, ccl_private ShaderData *sd, const int id, const dual2 uv, const uint flags, const float4 missing_rgba)
ccl_device_inline auto svm_node_tex_image_mapping(const Float3Type co, const uint proj)
ccl_device_noinline void svm_node_tex_image(KernelGlobals kg, ccl_private ShaderData *sd, ccl_private float *ccl_restrict stack, const ccl_global SVMNodeTexImage &ccl_restrict node)
ccl_device_inline auto svm_node_tex_environment_projection(Float3Type co, const uint proj)
ccl_device_noinline void svm_node_tex_image_box(KernelGlobals kg, ccl_private ShaderData *sd, ccl_private float *ccl_restrict stack, const ccl_global SVMNodeTexImageBox &ccl_restrict node)
ccl_device_inline void stack_store_float(ccl_private float *stack, const uint a, const float f)
ccl_device_inline void stack_store_float3(ccl_private float *stack, const uint a, const float3 f)
ccl_device_inline bool stack_valid(const uint a)
ccl_device_inline T stack_load(const ccl_private float *stack, const uint a)
#define ccl_device_inline
#define ccl_device_noinline
#define CCL_NAMESPACE_END
VecT safe_normalize(VecT vector)
ccl_device_inline void object_inverse_normal_transform(KernelGlobals kg, const ccl_private ShaderData *sd, ccl_private float3 *N)
@ NODE_IMAGE_COMPRESS_AS_SRGB
@ NODE_IMAGE_ALPHA_UNASSOCIATE
ccl_device_inline dual2 map_to_tube(const dual3 co)
ccl_device_inline dual2 map_to_sphere(const dual3 co)
ccl_device_inline dual3 fabs(const ccl_private dual3 &a)
CCL_NAMESPACE_BEGIN ccl_device_inline float4 zero_float4()
ccl_device_inline_method dual< float > x() const
ccl_device_inline_method dual< float > y() const
ccl_device_inline_method dual< float > z() const