39 uiItemL(layout,
TIP_(
"Nishita not available in Eevee"), ICON_ERROR);
68 tex->sun_direction[0] = 0.0f;
69 tex->sun_direction[1] = 0.0f;
70 tex->sun_direction[2] = 1.0f;
71 tex->turbidity = 2.2f;
72 tex->ground_albedo = 0.3f;
75 tex->sun_intensity = 1.0f;
77 tex->sun_rotation = 0.0f;
79 tex->air_density = 1.0f;
80 tex->dust_density = 1.0f;
81 tex->ozone_density = 1.0f;
93 float ctheta =
cosf(theta);
94 float cgamma =
cosf(gamma);
96 return (1.0 + lam[0] *
expf(lam[1] / ctheta)) *
97 (1.0 + lam[2] *
expf(lam[3] * gamma) + lam[4] * cgamma * cgamma);
102 float theta = sun_angles[0];
103 float theta2 = theta * theta;
104 float theta3 = theta2 * theta;
107 float chi = (4.0f / 9.0f -
T / 120.0f) * (
M_PI - 2.0f * theta);
109 sunsky->
radiance[0] = (4.0453f *
T - 4.9710f) *
tanf(chi) - 0.2155f *
T + 2.4192f;
112 sunsky->
radiance[1] = (0.00166f * theta3 - 0.00375f * theta2 + 0.00209f * theta) *
T2 +
113 (-0.02903f * theta3 + 0.06377f * theta2 - 0.03202f * theta + 0.00394f) *
115 (0.11693f * theta3 - 0.21196f * theta2 + 0.06052f * theta + 0.25886f);
117 sunsky->
radiance[2] = (0.00275f * theta3 - 0.00610f * theta2 + 0.00317f * theta) *
T2 +
118 (-0.04214f * theta3 + 0.08970f * theta2 - 0.04153f * theta + 0.00516f) *
120 (0.15346f * theta3 - 0.26756f * theta2 + 0.06670f * theta + 0.26688f);
122 sunsky->
config_Y[0] = (0.1787f *
T - 1.4630f);
123 sunsky->
config_Y[1] = (-0.3554f *
T + 0.4275f);
124 sunsky->
config_Y[2] = (-0.0227f *
T + 5.3251f);
125 sunsky->
config_Y[3] = (0.1206f *
T - 2.5771f);
126 sunsky->
config_Y[4] = (-0.0670f *
T + 0.3703f);
128 sunsky->
config_x[0] = (-0.0193f *
T - 0.2592f);
129 sunsky->
config_x[1] = (-0.0665f *
T + 0.0008f);
130 sunsky->
config_x[2] = (-0.0004f *
T + 0.2125f);
131 sunsky->
config_x[3] = (-0.0641f *
T - 0.8989f);
132 sunsky->
config_x[4] = (-0.0033f *
T + 0.0452f);
134 sunsky->
config_y[0] = (-0.0167f *
T - 0.2608f);
135 sunsky->
config_y[1] = (-0.0950f *
T + 0.0092f);
136 sunsky->
config_y[2] = (-0.0079f *
T + 0.2102f);
137 sunsky->
config_y[3] = (-0.0441f *
T - 1.6537f);
138 sunsky->
config_y[4] = (-0.0109f *
T + 0.0529f);
155 sun_angles[0] =
acosf(
tex->sun_direction[2]);
156 sun_angles[1] =
atan2f(
tex->sun_direction[0],
tex->sun_direction[1]);
158 if (
tex->sky_model == 0) {
166 "node_tex_sky_preetham",
182 if (
tex->sky_model == 1) {
184 sun_angles[0] = fmin(
M_PI_2, sun_angles[0]);
186 tex->turbidity,
tex->ground_albedo, fmax(0.0,
M_PI_2 - sun_angles[0]));
188 float config_x07[8], config_y07[8], config_z07[8], config_xyz8[3];
189 for (
int i = 0; i < 8; ++i) {
191 config_y07[i] = (
float)sky_state->
configs[1][i];
194 for (
int i = 0; i < 3; ++i) {
198 for (
int i = 0; i < 3; i++) {
206 "node_tex_sky_hosekwilkie",
241 if (
params.node_tree().typeinfo->validate_link(
246 tex->sun_disc =
false;
247 params.update_and_connect_available_socket(
node,
"Vector");
typedef float(TangentPoint)[2]
struct Scene * CTX_data_scene(const bContext *C)
void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn)
void node_type_update(struct bNodeType *ntype, void(*updatefunc)(struct bNodeTree *ntree, struct bNode *node))
void nodeSetSocketAvailability(struct bNodeTree *ntree, struct bNodeSocket *sock, bool is_available)
void node_type_init(struct bNodeType *ntype, void(*initfunc)(struct bNodeTree *ntree, struct bNode *node))
void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size)
void node_type_storage(struct bNodeType *ntype, const char *storagename, void(*freefunc)(struct bNode *node), void(*copyfunc)(struct bNodeTree *dest_ntree, struct bNode *dest_node, const struct bNode *src_node))
struct bNodeSocket * nodeFindSocket(const struct bNode *node, eNodeSocketInOut in_out, const char *identifier)
#define NODE_CLASS_TEXTURE
void nodeRegisterType(struct bNodeType *ntype)
bool BKE_scene_uses_blender_eevee(const struct Scene *scene)
void BKE_texture_mapping_default(struct TexMapping *texmap, int type)
void BKE_texture_colormapping_default(struct ColorMapping *colormap)
#define TEXMAP_TYPE_POINT
GPUNodeLink * GPU_uniform(const float *num)
bool GPU_stack_link(GPUMaterial *mat, struct bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture SH_NODE_TEX_SKY
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiItemL(uiLayout *layout, const char *name, int icon)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
Span< SocketDeclarationPtr > outputs() const
static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
static void sky_precompute_old(SkyModelPreetham *sunsky, const float sun_angles[], float turbidity)
static int node_shader_gpu_tex_sky(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode *node)
static void node_shader_update_sky(bNodeTree *ntree, bNode *node)
static float sky_perez_function(const float *lam, float theta, float gamma)
static void node_declare(NodeDeclarationBuilder &b)
static void node_shader_buts_tex_sky(uiLayout *layout, bContext *C, PointerRNA *ptr)
void search_link_ops_for_declarations(GatherLinkSearchOpParams ¶ms, Span< SocketDeclarationPtr > declarations)
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
color xyz_to_rgb(float x, float y, float z)
void register_node_type_sh_tex_sky()
void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *UNUSED(out))
void node_shader_gpu_default_tex_coord(GPUMaterial *mat, bNode *node, GPUNodeLink **link)
void get_XYZ_to_RGB_for_gpu(XYZ_to_RGB *data)
void sh_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass)
void node_copy_standard_storage(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
void SKY_arhosekskymodelstate_free(SKY_ArHosekSkyModelState *state)
SKY_ArHosekSkyModelState * SKY_arhosek_xyz_skymodelstate_alloc_init(const double turbidity, const double albedo, const double elevation)
SKY_ArHosekSkyModelConfiguration configs[11]
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
void(* draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
NodeDeclareFunction declare