diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2020-07-13 02:40:47 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2020-07-13 03:00:38 +0300 |
commit | 77cd8182f865022320d0e48b31b599bad033dab5 (patch) | |
tree | 3f27b7fe4dfb40a56ab0a6c654ea1ca5ba8be5ee | |
parent | 474dcbcf126a308ea46543fcd914aa4bebf30a49 (diff) |
Cycles: Remove Vector input on Sky texture when using the included sun
When using the sun, we need to sun sampling logic to avoid excessive
sampling map resolution, but that logic assumes that the Vector input
comes from the view direction.
That is the case in the vast majority of cases anyways, so the easiest
solution is to just remove the input for that case.
Differential Revision: https://developer.blender.org/D8091
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 4 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_tex_sky.c | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 2440b16aeb8..0658b2f048a 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -4421,7 +4421,7 @@ static void def_sh_tex_sky(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "sky_model"); RNA_def_property_enum_items(prop, prop_sky_type); RNA_def_property_ui_text(prop, "Sky Type", "Which sky model should be used"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update"); prop = RNA_def_property(srna, "sun_direction", PROP_FLOAT, PROP_DIRECTION); RNA_def_property_ui_text(prop, "Sun Direction", "Direction from where the sun is shining"); @@ -4445,7 +4445,7 @@ static void def_sh_tex_sky(StructRNA *srna) RNA_def_property_ui_text(prop, "Sun Disc", "Include the sun itself in the output"); RNA_def_property_boolean_sdna(prop, NULL, "sun_disc", 1); RNA_def_property_boolean_default(prop, true); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update"); prop = RNA_def_property(srna, "sun_size", PROP_FLOAT, PROP_ANGLE); RNA_def_property_ui_text(prop, "Sun Size", "Size of sun disc (angular diameter)"); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c index 70f3f80eb4b..7e15daaf666 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c @@ -214,6 +214,14 @@ static int node_shader_gpu_tex_sky(GPUMaterial *mat, } } +static void node_shader_update_sky(bNodeTree *UNUSED(ntree), bNode *node) +{ + bNodeSocket *sockVector = nodeFindSocket(node, SOCK_IN, "Vector"); + + NodeTexSky *tex = (NodeTexSky *)node->storage; + nodeSetSocketAvailability(sockVector, !(tex->sky_model == 2 && tex->sun_disc == 1)); +} + /* node type definition */ void register_node_type_sh_tex_sky(void) { @@ -225,6 +233,8 @@ void register_node_type_sh_tex_sky(void) node_type_init(&ntype, node_shader_init_tex_sky); node_type_storage(&ntype, "NodeTexSky", node_free_standard_storage, node_copy_standard_storage); node_type_gpu(&ntype, node_shader_gpu_tex_sky); + /* remove Vector input for Nishita */ + node_type_update(&ntype, node_shader_update_sky); nodeRegisterType(&ntype); } |