Blender V5.3
gpu_shader_material_hair.bsl.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022-2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
8
9[[node]]
11 float /*offset*/,
12 float /*roughness_u*/,
13 float /*roughness_v*/,
14 float3 /*T*/,
15 float weight,
16 KernelGlobals &kg,
17 ShadingData &sd,
18 Closure &result)
19{
20 color = max(color, float4(0.0f));
21
22#if 0
23 /* NOTE(fclem): This is the way it should be. But we don't have proper implementation of the hair
24 * closure yet. For now fall back to a simpler diffuse surface so that we have at least a color
25 * feedback. */
26 ClosureHair hair_data;
27 hair_data.color = color.rgb * weight;
28 hair_data.offset = offset;
29 hair_data.roughness = float2(roughness_u, roughness_v);
30 hair_data.T = T;
31#else
32 ClosureDiffuse hair_data;
33 hair_data.color = color.rgb * weight;
34 hair_data.N = sd.N;
35#endif
36 result = closure_eval(kg, sd, hair_data);
37}
38
39[[node]]
41 float /*melanin*/,
42 float /*melanin_redness*/,
43 float4 /*tint*/,
44 float3 /*absorption_coefficient*/,
45 float /*roughness*/,
46 float /*radial_roughness*/,
47 float /*coat*/,
48 float /*ior*/,
49 float /*offset*/,
50 float /*aspect_ratio*/,
51 float /*R*/,
52 float /*TT*/,
53 float /*TRT*/,
54 float /*random_color*/,
55 float /*random_roughness*/,
56 float /*random*/,
57 float weight,
58 KernelGlobals &kg,
59 ShadingData &sd,
60 Closure &result)
61{
62 /* Placeholder closure.
63 * Some computation will have to happen here just like the Principled BSDF.
64 * For now fall back to a simpler diffuse surface so that we have at least a color feedback. */
65#if 0
66 ClosureHair hair_data;
67 hair_data.color = color.rgb * weight;
68 hair_data.offset = offset;
69 hair_data.roughness = float2(0.0f);
70 hair_data.T = sd.curve_B;
71#else
72 ClosureDiffuse hair_data;
73 hair_data.color = color.rgb * weight;
74 hair_data.N = sd.N;
75#endif
76 result = closure_eval(kg, sd, hair_data);
77}
btScalar max
Closure closure_eval(KernelGlobals &kg, ShadingData &sd, ClosureDiffuse diffuse)
void node_bsdf_hair(float4 color, float, float, float, float3, float weight, KernelGlobals &kg, ShadingData &sd, Closure &result)
void node_bsdf_hair_principled(float4 color, float, float, float4, float3, float, float, float, float, float, float, float, float, float, float, float, float, float weight, KernelGlobals &kg, ShadingData &sd, Closure &result)
#define T
packed_float3 curve_B